Repository navigation
fix(web): list the file change a failed edit or write already applied - #341
Merged
liuedcson merged 1 commit intoNov 2, 2026
Merged
Conversation
Turn changes, delivery versions and per-turn undo all keyed "did this call change a file" off `isError`. A call can fail after its write landed — a cancelled `then_run` keeps the receipt, a result-preparation failure keeps the details — so its patch was dropped. The change card and delivery card then omitted a file that was really changed, and undo either reported a turn without changes or silently left the file behind while telling the model the turn was reverted. Read the change record instead: a result with a patch, or with the reason it recorded none, describes what the call left in the file whatever its status. A call that failed before writing records neither, so it stays out of the changes and out of the skipped list.
liuedcson
requested review from
MelodyVAR,
Uking-xxx and
ZouR-Ma
as code owners
November 2, 2026 09:18
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.
Problem
Turn changes, delivery versions and per-turn undo all keyed "did this call change a file" off
isError. A call can fail after its write landed — a cancelledthen_runkeeps the receipt, a result-preparation failure keeps the details — so its patch was dropped:The record itself is intact in the session JSONL; only the readers skipped it.
Refs #337.
Change
Read the change record instead of the call status: a result with a
patch, or with the reason it recorded none (untracked), describes what the call left in the file whatever itsisErroris. A call that failed before writing records neither, so it stays out of both the changes and the skipped list.apps/web/client/src/state/session.ts:fileChangeno longer drops every failed result (live rows and history).apps/web/src/turn-changes.ts: onerecordsAppliedChangepredicate used byturnChanges(cards, undo, conflict checks) andreplayFile(per-turn versions).apps/web/AGENTS.md: state the invariant, so it is not "cleaned up" later.Rows still read as failed; only the change they applied is kept.
Validation
apps/web:pnpm exec tsx --tsconfig ../../tsconfig.json --test test/turn-changes.test.ts test/client-live-turn-changes.test.ts— 41 passed.pnpm --filter @step-harness/web typecheckandpnpm --filter @step-harness/web test— 864 tests, 0 failed.pnpm run checkin the desktop worktree — passed.Regressions cover: a failed call's change is listed, is not a skip, and undo restores the file; a failed later turn is still what makes an earlier undo a conflict; a failed call that recorded nothing is neither a change nor a skip; a failed call's delivery version stays exact.
Not covered
A call cancelled in the narrow window after the write but before the receipt is built throws a plain error with no details, so nothing is recorded to list. That is a kernel-side ordering issue tracked separately; this change only stops the readers from discarding records that exist.