Repository navigation
fix(ce-work): clean up native fallback workspaces and transport refs - #2038
Merged
Merged
Conversation
complete-fallback now runs the controller's cleanup once its completion record is written, so a unit finished natively no longer leaves its git worktree and refs/ce-work transport ref behind. Non-abandon cleanup accepts a native-completed unit with a valid completion receipt, resume finishes an interrupted cleanup, and run discovery keeps a run open while any unit's cleanup is incomplete. Fixes #2037
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merged
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
A ce-work unit finished through native fallback now gets its git worktree and
refs/ce-worktransport ref removed whencomplete-fallbacksucceeds, the same way an integrated unit does. Before this, those units endednative-completedwithcleanup: null. Their worktrees stayed registered indefinitely and showed up in worktree-aware tools as abandoned work.Fixes #2037
What changed in the controller
complete-fallbackruns the existing cleanup after its completion record is written, so the completion survives a cleanup failure.cleanupnow accepts anative-completedunit when its completion receipt is valid, and recordsabandoned: false. Before, it refused anything exceptcommittedunits. That meant an instruction to "call cleanup afterFALLBACK_COMPLETED" could not have worked, because only--abandongot through and it recorded a completed unit as abandoned.resumefinishes it. Run discovery now treats any unit with cleanup still outstanding as unfinished, so a run that already passed plan-wide verification is found again instead of returningNOT_FOUND. This also covers an interrupted artifact prune on an integrated (cleaned) unit, which was already a gap.Runs that were already affected by #2037 are repaired the next time
resumeruns on them.Validation
tests/skills/ce-work-unit-workspace-fallback.test.tsdrive the issue's path: failed integration, exact restore, claim, native commit, thencomplete-fallback. They check that the worktree and ref are gone. An interruption case at each of the two crash points (after worktree removal, before artifact pruning) checks that automaticresumefinds the verified run and finishes the cleanup. Both failed before the fix. I also confirmed that the artifact-prune case fails when discovery checks only for a missing cleanup record.bun run test(4960 pass, 0 fail), typecheck,release:validate,plugin:validate, andtest:skill-guardsall pass.references/cross-model-execution.mdwas evaluated before and after on Claude and Codex, one trial each, with a cell where cleanup was interrupted after completion. Before the change, Claude chosecleanup --abandon --expect-job .... After it, both hosts choseresume.Security Disclosure
This change runs the controller's existing destructive cleanup (
git worktree remove --forceon the controller-owned unit workspace andupdate-ref -don its transport ref) on a path that previously kept them. The existing safeguards still apply. Cleanup requires a valid native completion receipt, refuses a live worker, removes only the owned workspace path, and deletes the ref only if it still points at the recorded transport commit. Any uncommitted worker output in that workspace is discarded, because the accepted native commit replaces it.Agent Disclosure
Claude Code · claude-opus-5-5