Skip to content

fix(session): preserve managed append uncertainty - #4193

Merged
Yeachan-Heo merged 1 commit into
devfrom
fix/dev-ci-title-source-error-contract
Aug 10, 2026
Merged

fix(session): preserve managed append uncertainty#4193
Yeachan-Heo merged 1 commit into
devfrom
fix/dev-ci-title-source-error-contract

Conversation

@Yeachan-Heo

Copy link
Copy Markdown
Owner

Dev CI repair

Repairs the sole deterministic red in Dev CI run 31414887852, shard test:@gajae-code/coding-agent:shard-6-of-8, at exact dev 79e4e0a097aeb54cfe94f79b8919af778dbc5c68.

The failing test expected the injected pre-commit header_patch_write_failed cause 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: Linux append_managed can emit terminal identity_mismatch or not_found after write_all, while TypeScript treated both as definitely pre-commit.

Causal fix

  • Make the failure injection explicitly pre-commit, preserving header_patch_write_failed, the byte-identical source transcript, and old cwd/session-file authority.
  • Conservatively keep only provable size preflight failures direct; classify identity_mismatch and not_found as managed_append_committed_outcome_uncertain while preserving the native code as cause.
  • Add Linux post-commit regressions for both terminal codes. Each calls the real append boundary exactly once, proves no retry, retains one destination header_patch as 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

  • Focused three-case cwd patch suite: 10 consecutive repetitions, all passed.
  • 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

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

MERGE_READY

Exact-head terminal verdict for 0903f77ab7ef07354b48cccbb34368075844492a.

Causal contract

  • Pre-commit header-patch rejection remains direct as header_patch_write_failed, with injection hit exactly once, byte-identical source transcript, and old cwd/session-file authority.
  • Linux terminal identity_mismatch and not_found can occur after write_all; both now remain managed_append_committed_outcome_uncertain with the native code preserved as the error cause.
  • Both post-commit regressions prove exactly one physical RecoveryFsRoot.appendManaged call, no unsafe retry, one retained destination header_patch, and byte-identical restored source authority.

Local evidence

  • Focused three-case cwd patch suite: 10 consecutive green repetitions.
  • Title-source persistence: 10 passed, 0 failed.
  • Move-to + session-storage: 101 passed, 20 skipped, 0 failed.
  • Session-manager: 366 passed, 5 skipped, 0 failed across 30 files.
  • bun --cwd=packages/coding-agent run check: Biome and TypeScript passed.
  • Final committed diff: exactly 3 intended files; no generated native drift or artifact JSON.

Exact-head CI

No merge or release performed.

Verdict: MERGE_READY

Signed-off-by: GJC Dev CI Repair dev-ci@gajae.dev

@Yeachan-Heo

Copy link
Copy Markdown
Owner Author

MERGE_READY — exact-head CI terminal green

Exact head 0903f77ab7ef07354b48cccbb34368075844492a on base 79e4e0a097aeb54cfe94f79b8919af778dbc5c68 is terminal green and mergeable clean.

Evidence:

  • Dev CI 31418938781: success
  • Public site sync 31418938886: success
  • Commit checks: 19 success, 0 failure, 0 pending
  • Focused three-case cwd patch suite: 10 consecutive passes
  • title-source suite: 10 pass
  • move-to + storage: 101 pass / 20 skip
  • session-manager: 366 pass / 5 skip
  • package check: pass

The repair preserves causal direct errors for provable pre-commit rejection and conservatively treats post-write-capable identity_mismatch / not_found as managed_append_committed_outcome_uncertain, with one physical append attempt and no unsafe retry.

No merge or release was performed.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo
Yeachan-Heo merged commit 058c96c into dev Aug 10, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant