fix(session): preserve managed append uncertainty - #4193
Conversation
Retained append identity and absence codes can be emitted after bytes are written, so treating them as pre-commit allowed unsafe causal rollback assumptions. Keep only size preflight failures direct and lock both committed terminal paths with physical append-count evidence. Lore-id: 8c2f1d4a Constraint: pre-commit injected header patch failures must preserve their causal error and source authority Constraint: post-write identity_mismatch and not_found outcomes must remain committed-outcome-uncertain and must not be retried Rejected: update the expected error string | would erase the pre-commit versus post-commit contract Confidence: high Scope-risk: narrow Reversibility: clean Tested: focused cwd patch suite 10 repetitions; title-source suite; move-to and session-storage suites; full session-manager suite; coding-agent package check
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0903f77ab7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function managedAppendFailure(code: string | undefined): Error { | ||
| const error = new Error(code ?? "managed_append_failed"); | ||
| return code === "identity_mismatch" || code === "not_found" || code === "content_too_large" | ||
| return code === "content_too_large" || code === "too_large" |
There was a problem hiding this comment.
Add the session fix to the coding-agent changelog
This changes the shipped managed-session failure classification but leaves packages/coding-agent/CHANGELOG.md unchanged, so the next release notes will omit the fix. Add an entry under ## [Unreleased] as required by the repository contract.
AGENTS.md reference: AGENTS.md:L188-L188
Useful? React with 👍 / 👎.
MERGE_READYExact-head terminal verdict for Causal contract
Local evidence
Exact-head CI
No merge or release performed. Verdict: MERGE_READY Signed-off-by: GJC Dev CI Repair dev-ci@gajae.dev |
MERGE_READY — exact-head CI terminal greenExact head Evidence:
The repair preserves causal direct errors for provable pre-commit rejection and conservatively treats post-write-capable No merge or release was performed. — |
Dev CI repair
Repairs the sole deterministic red in Dev CI run 31414887852, shard
test:@gajae-code/coding-agent:shard-6-of-8, at exactdev79e4e0a097aeb54cfe94f79b8919af778dbc5c68.The failing test expected the injected pre-commit
header_patch_write_failedcause but the Linux seam returned a synthetic failed native result, which current retained-append semantics correctly treated as potentially committed. Investigation also found a production classification hole: Linuxappend_managedcan emit terminalidentity_mismatchornot_foundafterwrite_all, while TypeScript treated both as definitely pre-commit.Causal fix
header_patch_write_failed, the byte-identical source transcript, and old cwd/session-file authority.identity_mismatchandnot_foundasmanaged_append_committed_outcome_uncertainwhile preserving the native code ascause.header_patchas physical commit evidence, and restores the byte-identical source authority.Overlap search
Searched open/closed issues and PRs for
header_patch_write_failed,managed_append_committed_outcome_uncertain, and session title-source persistence before implementation. No active repair overlapped this failure. #4151 introduced the conservative retained-append classification; #4188 did not change this contract. This PR is the signed tracking context for the Dev CI repair.Verification
bun test packages/coding-agent/test/session-manager/title-source-persistence.test.ts— 10 passed.bun test packages/coding-agent/test/session-manager/move-to.test.ts packages/coding-agent/test/session-storage.test.ts— 101 passed, 20 skipped.bun test packages/coding-agent/test/session-manager— 366 passed, 5 skipped across 30 files.bun --cwd=packages/coding-agent run check— Biome and TypeScript passed.No merge or release is requested.
Signed-off-by: GJC Dev CI Repair dev-ci@gajae.dev