Repository navigation
feat(executor): turn-boundary snapshot/rollback (Phase 3b) - #152
Merged
Merged
Conversation
Caller-owned turn-level git snapshot at submitMessage entry + /rollback manual command. Complementary to in-band auto-rollback (PR #139): in-band = single-call self-contained + opt-in; turn-boundary = caller owns the snapshot, model/user decides to /rollback — safer for the edit-test-fail coding loop. - types.ts: SnapshotResult/RollbackResult wire types - ExecutorClient.ts: snapshotCreate/rollback client methods (UDS RPC) - ExecutorInstance.ts: methods with ensureStarted health gate - executorDriver.ts: ExecutorClientLike test seam extended - turnSnapshot.ts (new): turn-boundary manager — takeTurnSnapshot (fail-soft, non-repo no-op), recordTurnFailure (counter, threshold 3), lastHint (staged hint drain), rollbackToTurn, ring of 5 - QueryEngine.ts: takeTurnSnapshot at submitMessage entry; case 'user' is_error scan + hint injection to mutableMessages - commands/rollback/ (new): /rollback [turnId] local-jsx command - tests: 21 unit tests (fake client: take/rollback, failure counter, non-repo no-op, ring bounds, default-off byte-identical) Gate: default off, FUSION_CODE_EXECUTOR_TURN_SNAPSHOT=1 (strict truthy). Byte-identical when env unset — takeTurnSnapshot no-op returns null, no client calls, no ring entry, no hint. Double-gate with FUSION_CODE_EXECUTOR_ENABLED (executor must be on too). Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 27, 2026
…152) Co-Authored-By: Claude Fable 5 <[email protected]>
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
Implements PR #1 (M1) of the fusion-code enhance ar-plan (
architecture/fusion-code-enhance-ar-plan-0827.md§1 P0): caller-owned turn-boundary git snapshot +/rollbackmanual command.Complementary to the in-band auto-rollback landed in PR #139:
FUSION_CODE_EXECUTOR_AUTO_ROLLBACK. Reverts within one bash call.submitMessageentry; the model/user decides to/rollbackto revert the working tree to before the turn. Manual, not automatic — safer for the edit-test-fail coding loop where auto-rollback would revert legit edits on test failure.Changes
src/services/executor/types.ts—SnapshotResult/RollbackResultwire typessrc/services/executor/ExecutorClient.ts—snapshotCreate/rollbackclient methods (UDS NDJSON-RPC:executor.snapshot_create/executor.rollback)src/services/executor/ExecutorInstance.ts— methods withensureStarted+ health gate; rollback short-circuits emptysnapshot_idsrc/services/executor/executorDriver.ts—ExecutorClientLiketest seam extended with the two methodssrc/services/executor/turnSnapshot.ts(new) — turn-boundary manager:takeTurnSnapshot(turnId)— fail-soft; non-repo cwd (executor returns"") is a no-op; ring of last 5 turnsrecordTurnFailure()— counts same-turnis_errortool results; at threshold 3 stages a/rollbackhint (idempotent per turn)lastHint()— read + clear staged hintrollbackToTurn(turnId?)— defaults to most recent; drops rolled-back + newer turns from ringsrc/QueryEngine.ts—takeTurnSnapshotatsubmitMessageentry;case "user"scanstool_resultis_errorblocks + injects the staged hint as a user-role note for the nextask()src/commands/rollback/(new) —/rollback [turnId]local-jsx commandsrc/__tests__/services/executor/turnSnapshot.test.ts(new) — 21 unit testsGate
Default off, env
FUSION_CODE_EXECUTOR_TURN_SNAPSHOT=1(strict truthy). Byte-identical when env unset:takeTurnSnapshotis a no-op (returnsnull, no client calls, no ring entry, no hint). Double-gate withFUSION_CODE_EXECUTOR_ENABLED(executor must be on).Upstream wire (cross-repo read-only, verified
fusion-executor/crates/fe-ipc/src/lib.rs):executor.snapshot_create{cwd}→{"snapshot_id": id}(empty when non-repo)executor.rollback{snapshot_id, cwd}→{"ok": true}Verification (4 gates)
bun run typecheck— 0 errorsbun test src/__tests__/— 537 pass (21 new + 516 existing)bun run lint— new/edited files clean (repo-wide pre-existing warnings untouched)bun run build:dev— passCo-Authored-By: Claude Fable 5 [email protected]