fix(ai): prevent stale agent edit overwrites - #309
Open
arhxam wants to merge 1 commit into
Open
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
📝 WalkthroughWalkthroughChangesAgent document conflict handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant LeftPanel
participant chatRun
participant applyAgentDocumentIfCurrent
participant useProjectStore
LeftPanel->>useProjectStore: Capture document and revision
LeftPanel->>chatRun: Start agent run
chatRun-->>LeftPanel: Return agent document
LeftPanel->>applyAgentDocumentIfCurrent: Apply with expected revision
applyAgentDocumentIfCurrent->>useProjectStore: Check current revision
alt Revision unchanged
applyAgentDocumentIfCurrent->>useProjectStore: Set and save document
applyAgentDocumentIfCurrent-->>LeftPanel: Return applied
else Revision changed
applyAgentDocumentIfCurrent-->>LeftPanel: Return conflict
LeftPanel->>LeftPanel: Show warning toast
end
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related issue
Fixes #284
Type of change
Release impact
Desktop impact
Screenshots / video
Not included; the visible change is a localized warning toast on a concurrent-edit conflict.
Testing
npx vitest --run src/lib/ai-edition/store/agentDocumentApply.test.ts(3 passed)npm run test(1,680 passed, 1 skipped across 141 files)npx tsc --noEmitnpx tsc -p tsconfig.test.json --noEmitnpx biome checkon the implementation, test, component, and locale filesnpm run docs:checknpm run i18n:checknpm run build-viteAuthored with Codex assistance and manually verified against the issue's concurrent-edit reproduction.
Summary by CodeRabbit
New Features
Localization
Bug Fixes