Skip to content

fix(runtime): preserve turn-scoped tool results and pruning (F01) - #55

Merged
lg2m merged 4 commits into
mainfrom
fix/eng-781-f01-tool-result-replay
Sep 16, 2026
Merged

lg2m merged 4 commits into
mainfrom
fix/eng-781-f01-tool-result-replay

Conversation

@lg2m

@lg2m lg2m commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

F01: preserve tool-result identity during replay

Closes ENG-781.

Spec: docs/plans/progress/harness-repairs.md (F01 acceptance and owned paths).

What changed

  • Reconstruct results using run + turn ordinal + provider call ID. IDs reused in later turns no longer overwrite earlier results or conceal interrupted calls.
  • Prune with the exact result's stored effect and its own assistant turn's tool name/arguments. A later read cannot make earlier shell/external output prunable.
  • Preserve legacy-name fallback only when effect metadata is absent. Rebuild messages lazily: unchanged results are not copied.
  • No new crate, dependency, provider special case, SQL query, schema migration, or wire change.

Verification

  • Three public-session regressions fail against main 20d4f6b, pass on the candidate: follow-up/reopen/compaction/history, missing legacy results beside reused IDs, and mixed-effect pruning.
  • env -u NO_COLOR TERM=xterm-256color cargo test --workspace --quiet: 1,443 passed, 5 ignored. Tests run with loopback permission. Initial sandbox binding and inherited NO_COLOR failures are environment-specific and recorded in the ledger.
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo build --workspace
  • Independent second-agent spec and standards review: implementation approved, including removal of an eager-copy regression identified during review.

Measurements

30 alternating release-binary pairs, 900 follow-ups per case/arm, after 24 persisted 12 KB tool results:

Public follow-up execution Baseline median Candidate median
Prunable read history 50.983 ms 50.674 ms
Retained shell history 51.404 ms 50.802 ms

Inconclusive under host noise: I/O some avg10 ranged 27.37–46.50%; adjacent same-binary batch medians varied by up to 147%. No speedup, tail-budget pass, or scale qualification claimed. Quiet-host qualification remains open under audit F15. The ignored measure_replay_follow_up fixture makes this reproducible; raw receipts are under target/qq-perf/f01-2026-09-16/ (not committed).

Baseline production sources are pristine 20d4f6b; candidate implementation is 977d28b. Baseline was captured after implementation in a separate worktree, not before edits (documented process deviation). A stale shared Cargo artifact was rejected; distinct binaries were verified by baseline 0/3 versus candidate 3/3 regression results and SHA-256. Fetch PR #50 landed during measurement; merge-tree with b75ebac is clean. Measurements intentionally exclude that unrelated feature from both arms.

Docs and compatibility

docs/design/transcript.md describes replay identity and pruning semantics; the repair ledger records scope and receipts. Existing persisted sessions are read correctly without rewriting history. Protocol/descriptor/schema unchanged.

Remaining audit findings are separate slices and PRs; this PR does not claim they are fixed. No self-merge.

ENG-781 / F01: repeated_call_ids_replay_their_own_results_after_follow_up_and_reopen fails on main: the first successful read is replaced by the next turn error. Public session commands and captured provider requests cover follow-up and reopen.
ENG-781 / F01. Preserve run/turn/provider-call identity, match pruning metadata to each result, and retain missing-result repair and legacy effects. Three public session regressions cover restart, compaction, history, and mixed effects. Workspace 1443 passed; formatting, Clippy, and build green. Independent implementation review approved; performance receipt follows.
@lg2m
lg2m merged commit c466605 into main Sep 16, 2026
4 checks passed
@lg2m
lg2m deleted the fix/eng-781-f01-tool-result-replay branch September 16, 2026 23:18
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