Skip to content

fix(runtime): preserve tool evidence under context pressure - #1289

Merged
XuPeng-SH merged 2 commits into
mainfrom
fix/execution-outcome-continuity
Nov 13, 2026
Merged

XuPeng-SH merged 2 commits into
mainfrom
fix/execution-outcome-continuity

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Capability assessment: Updated: Context-pressure recovery preserves unique tool evidence through the existing complete-input summary and session-artifact surfaces; model choice, policy, User Runner and MOI boundaries are unchanged. See docs/design/context-window-management.md.

Summary

When summary generation failed or was unavailable, a long tool task could lose unique confirmed results behind a fixed compaction marker. A regression against the base reproduces this with one human request and 32 paired tool receipts. Pressure now permits exact-result deduplication, a validated complete-input semantic summary, or an authorized durable history artifact; otherwise the existing typed context-window error preserves the source history.

Remove lossy result clipping, dropped-round summary retries, repeated mechanical stages, server-local canonical microcompaction and unused configuration/state plumbing. Keep ordinary instructions, current tool pairs, active controls and semantic mailbox/child-result evidence. Carry existing history artifact handles through later successful summaries deterministically, and recover the exact dedup target even after the live tail is replaced.

Related issue

Refs #1016, #1249, #1261, #1100, #1119.

Issue Current evidence and scope
#1100 Fixes reproduced failed-summary evidence loss, including a single-human long tool task. Complete-input summaries no longer retry with omitted rounds.
#1261 Protects retained tool/child evidence and recovery handles. Shared-DB callback/ownership controls pass; existing merged outcome-delivery fixes remain the owners.
#1016 Reuses existing cancellation/ownership controls. This does not prove remote MCP process termination, wait/reap or cross-replica settlement.
#1249 Preserves existing explicit recovery and unknown-side-effect ownership. The original browser incident has not been replayed.
#1119 Nine current public HTTP scenarios measure 17–19 SQL statements including detached observation. No historical 3x latency claim or unrelated persistence redesign.

The remaining external and performance acceptance criteria are not auto-closed by this PR.

Change type

  • Bug fix
  • Documentation
  • Refactor or performance improvement
  • Test

User and compatibility impact

Unique results remain available when optional summarization fails. The model retains normal tool/model recovery choices and receives truthful current-reader guidance. No schema, dependency, lifecycle status or MOI consumer contract changes.

The existing history artifact format caps the full public snapshot at 4 MiB. If it cannot be stored/read under the current admission, history is preserved and existing context-limit handling applies. Reader pages are bounded, but the current store loads the complete artifact per read. Pressure recovery uses the existing artifact transaction/readback and may require more than one net-reducing pass; raw provider usage remains telemetry, not an invented post-rewrite measurement.

Architecture and complexity delta

  • Canonical owners: shared summary input/validation, canonical rewrite permits, exact-output dependency links, session-owned history artifact persistence and final tool-surface projection.
  • Existing callers checked: pre-turn/resume, reactive budget recovery, request/Memoria fallback, final wire/physical retries, canonical commit/checkpoint restore and CLI consumers.
  • Removed: lossy truncation/pruning lanes and their primitive-only tests, partial-input PTL retry loops, repeated identical compression attempts, canonical local-file microcompaction, unused compact_strategy plumbing and max_ptl_retries.
  • No parallel state machine, table, poller, new writer or compatibility store. Request-local cleanup uses existing authority/dependency rules and preserves expired semantic-input frames. Ordinary low-pressure turns add no SQL. Dedup runs before fallback storage, which is skipped when its applicable pressure threshold is relieved.

Verification

  • Base: 9dc06cd33011ce940c7cb8d8d2ba09bacb53eab0. Final cumulative reviewed diff: 2d87ebe9d11d81ec6dc3bd651efa0cb85137969a2895c6cdd12286b0dccaaeaf; CI-fixture correction commit 5e6a12751e395361d363b77d99e970781fd29c5c.
  • cargo fmt --all -- --check, git diff --check: pass.
  • Affected-closure Clippy (astra-runtime, astra-turn-core, astra-cli, all targets, --no-deps -- -D warnings): pass; final test-only edits rechecked in runtime.
  • Core summary: 13 pass. Runtime offline: cargo nextest run --locked --manifest-path Cargo.toml -p astra-runtime --profile ci passes all 6,048 selected cases; 194 opt-in cases are excluded. The final correction only changes the ignored DB fixture; the offline selection and production are unchanged. Four compaction integration targets retain 21 passing cases, including two dedicated history-copy accounting tests.
  • Runtime tests include the actual scripted provider loop, compaction/checkpoint/restore/deferred-tool carrier, final-wire and physical retry budgets, canonical commit/objective continuity, summary failure/cancellation, invalid/stale permits, protected instructions and expired child/mailbox evidence.
  • Real isolated MatrixOne 4.2.8: the 11 artifact/ownership/cancellation controls remain passing. Three final-source continuation/compaction/recovery entrypoint cases also pass, with actual streamed inline summary, positive pre-turn savings before the first primary request, typed Work settlement/current overview and no duplicate delivered work.
  • Scripted localhost HTTP /chat/stream: 9 SQL-budget scenarios pass with 17–19 total statements and successful observer completion. Post-provider context-limit preservation of answer/usage/tool facts also passes.
  • Unsuppressed ThreadSanitizer: 13 core summary tests and 14 runtime artifact/cancellation/deadline/admission/continuity tests pass; nightly-2026-10-12, rebuilt std, x86_64-unknown-linux-gnu, -Zsanitizer=thread -Cforce-frame-pointers=yes, --test-threads=2 for runtime. Core source is byte-identical to its sanitizer-tested snapshot. No suppressions. Production is unchanged by the fixture-only CI correction; owner concurrency and SQL evidence is reused.
  • Live recovered_validation_user_facing_completion: one bounded replay on the unchanged original commit and same model passed all hard criteria, including the unchanged 0.85 hard judge. The earlier rejection had no captured reason; this pass does not claim to explain it or replace post-push CI.
  • Design and complete/delta review: explicitly selected gpt-6.1-terra / max, task execution_design, session 01a1c30a-db65-71b0-a05c-e465e9dc17bb; final reviewed source has no material blocker. Validation gates are reconciled before publication. CI is not awaited or asserted passed.

Final checklist

  • Tests exercise the owning behavior and realistic failure/authority boundaries.
  • Updated the context-window design contract.
  • Checked the diff for credentials, private endpoints, generated files and unrelated changes.
  • Conventional Commit title.

@mergify

mergify Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH
XuPeng-SH merged commit 71da5a7 into main Nov 13, 2026
41 checks passed
@XuPeng-SH
XuPeng-SH deleted the fix/execution-outcome-continuity branch November 13, 2026 21:51
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