Fix orchestration stale manifest writes after external bundle swap#365
Closed
cursor[bot] wants to merge 1 commit into
Closed
Fix orchestration stale manifest writes after external bundle swap#365cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
When git checkout replaces manifest.json with a different runId, the watcher marked the run suspended but kept a stale in-memory manifest. Subsequent manifestPatch/claimTask calls could overwrite the foreign manifest on disk. Clear the runtime cache on runId mismatch, treat mismatches in loadIntoRuntime as suspended, and reject all mutation paths while suspended. Add a regression test for the watcher + patch interaction. Co-authored-by: Arul Sharma <arul28@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This was referenced May 26, 2026
Owner
|
Closing in favor of #382. I validated the stale-manifest bug and folded the corrected version into the combined orchestration hardening lane. |
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.
Bug and impact
Stale manifest overwrite (data corruption)
When
manifest.jsonon disk is replaced externally with a differentrunId(e.g.git checkouton the lane worktree), the file watcher marked the runsuspendedbut left the previous in-memory manifest cached.loadIntoRuntimeshort-circuited on that cache, somanifestPatch,claimTask,releaseTask, and related paths could persist the stale manifest and overwrite the foreign bundle on disk.Root cause
handleExternalChangesetsuspendedonrunIdmismatch but did not clearruntime.manifest.runtime.suspended.loadIntoRuntimethrew on diskrunIdmismatch instead of suspending, which could surface as an unhandled error.Fix
runtime.manifest/runtime.planMdwhen the watcher detects a foreignrunId.loadIntoRuntimereads a mismatched manifest from disk.assertRunWritable/ explicit suspended checks.Validation
npx vitest run src/main/services/orchestration/orchestrationService.test.ts -t "external manifest runId"npx vitest run src/main/services/orchestration/orchestrationService.test.ts src/main/services/orchestration/patchPolicy.test.tsDoes not overlap open PRs #363 (CRR alter / remote switch binding) or #364 (plan approval bypass / openRepo binding).