Repository navigation
fix: preserve context-engine advancement after steering - #168394
Conversation
Preserve transcript generation only for a validated steering-target metadata confirmation, retaining content, provenance, branch, and replacement fences. Remove an unused internal transcript read wrapper. Fixes #168014.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesPreserve transcript generation when a user-event rewrite changes only valid steering correlation metadata. Example: A user sends “Include the correction” while “Start the answer” is running.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR repairs a current durable-context advancement bug at its transcript producer, with no actionable introduced defects found. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe canonical SQLite transcript writer maintains the generation fences consumed by transcript admissions, closed-turn reads, and durable context-engine advancement. flowchart TD
A[Running turn and steering input] --> B[Transcript recorder]
B --> C[Canonical SQLite rewrite]
C --> D[Closed turn reader]
D --> E[Durable turn outbox]
E --> F[Context engine commitTurn]
Technical reviewBest possible solution: Land the narrow canonical-writer repair while preserving genuine mutation fences and existing blocked-row retention. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the steering rewrite, generation mismatch, and blocked advancement path; the contributor also records a failing Gateway baseline and regression negative control. Is this the best way to solve the issue? The repair belongs at the existing transcript writer and is safer than broadly accepting stale generations or refreshing competing admission receipts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1cb9b5aeac88. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +37, Tests +101, Docs +5. Total +143 across 5 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 10, 2026, 7:09 AM ET / 11:09 UTC (Revision 3). |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…168569) #168394 stopped steering confirmation from rotating the transcript generation, so the foreground admission stays valid. Retries after accepted steering with a new run, a reset native binding, or a new context budget now reread the same admission-fenced prefix and finish ok instead of failing with "Current-turn transcript admission identity changed". Assert that contract: same-run retries reuse retained history, rescoped retries reread once without widening it, and cancelled or revoked retries keep their terminal outcomes. Co-authored-by: Peter Steinberger <[email protected]>
) * fix(sessions): keep steered turns advancing durable context Preserve transcript generation only for a validated steering-target metadata confirmation, retaining content, provenance, branch, and replacement fences. Remove an unused internal transcript read wrapper. Fixes openclaw#168014. * chore: defer unrelated transcript export cleanup
…penclaw#168569) openclaw#168394 stopped steering confirmation from rotating the transcript generation, so the foreground admission stays valid. Retries after accepted steering with a new run, a reset native binding, or a new context budget now reread the same admission-fenced prefix and finish ok instead of failing with "Current-turn transcript admission identity changed". Assert that contract: same-run retries reuse retained history, rescoped retries reread once without widening it, and cancelled or revoked retries keep their terminal outcomes. Co-authored-by: Peter Steinberger <[email protected]>
* fix(sessions): keep steered turns advancing durable context Preserve transcript generation only for a validated steering-target metadata confirmation, retaining content, provenance, branch, and replacement fences. Remove an unused internal transcript read wrapper. Fixes #168014. * chore: defer unrelated transcript export cleanup (cherry picked from commit b0e5f30)
…168569) #168394 stopped steering confirmation from rotating the transcript generation, so the foreground admission stays valid. Retries after accepted steering with a new run, a reset native binding, or a new context budget now reread the same admission-fenced prefix and finish ok instead of failing with "Current-turn transcript admission identity changed". Assert that contract: same-run retries reuse retained history, rescoped retries reread once without widening it, and cancelled or revoked retries keep their terminal outcomes. Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit aec6e7a)
* fix(sessions): keep steered turns advancing durable context Preserve transcript generation only for a validated steering-target metadata confirmation, retaining content, provenance, branch, and replacement fences. Remove an unused internal transcript read wrapper. Fixes #168014. * chore: defer unrelated transcript export cleanup (cherry picked from commit b0e5f30)
…168569) #168394 stopped steering confirmation from rotating the transcript generation, so the foreground admission stays valid. Retries after accepted steering with a new run, a reset native binding, or a new context budget now reread the same admission-fenced prefix and finish ok instead of failing with "Current-turn transcript admission identity changed". Assert that contract: same-run retries reuse retained history, rescoped retries reread once without widening it, and cancelled or revoked retries keep their terminal outcomes. Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit aec6e7a)
Three fork-only test copies still asserted contracts upstream changed: - usage.sessions-usage-details: openclaw#163182 usage target (red since before the absorb) - provider-catalog-live-runtime.config: stale split of upstream's rewritten test (openclaw#167462, step 11) - user-turn-transcript.recorder: openclaw#168394 keeps the admission generation (step 20) Test files only. GREEN/RED/GREEN, neighbours and static gates recorded in the lane's .lane/DONE. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg
Fixes #168014
What Problem This Solves
Steering a running turn can permanently prevent a durable context engine from committing that turn, even though the user receives its answer.
User Impact
Successfully steered turns advance durable context once, with the original input, steering message, and responses included. Content, provenance, branch changes, and real transcript replacements still invalidate stale admissions.
Existing terminally blocked outbox rows are unchanged. Private steering metadata is published through the existing transcript update event; delta cursors already past the row do not replay that metadata-only correction.
Why This Change Was Made
Steering confirmation rewrote the user row and rotated the transcript generation. The running turn retained its original admission, so its closed-turn read returned
session-reboundand left advancement permanently blocked.The canonical transcript writer now preserves generation only when the complete before-and-after user events differ solely in a valid
steerTargetRunId. Exact-row compare-and-swap, mutation timestamps, and all other rewrite fences remain intact.Evidence
Fresh-machine live proof: AWS Crabbox
cbx_4fd21a690d45,r7a.xlarge, Node 24.21.0, 30.6 GiB. Separate real Gateway processes used isolated state/config and ephemeral loopback ports, the QA mock OpenAI provider, and a durable SQLite-backed context-engine plugin. The production-reverted baseline confirmed one steer but made zerocommitTurncalls and retained one blockedsession-reboundrow (124.492s). The fix committed exactly once with all four input/response messages and left the outbox empty (126.836s). Both delivered the steered answer. A subsequent recovery-probe turn was aborted before completion.Negative control: reverting only the production writer made the new acceptance regression fail with the intended assertion and
durable turn advancement is blocked ... transcript range is session-reboundwarning (38.006s).Full module proof: 448 explicit test files, 5,027 tests, nine routed Vitest shards passed in 4,594.225s. Coverage includes all session-storage, session, and harness module tests, direct importers, and cursor/display siblings. The new acceptance regression took 4.660s; the five new genuine-mutation fence cases took 0.356–0.494s each. These exercise real SQLite workers and the durable acceptance/outbox boundary without timers, sleeps, or polling in the new tests.
Checks: core types and all three required test-type graphs passed on the lease. Targeted oxlint, formatting, and
git diff --checkpassed locally. Independent Codex autoreview is scoped-clean through P2; the final deslop pass required no additional source changes. ClawSweeper’s exact-head review reported zero findings and complete fix scope.Inherited failure:
check:changedon the tested base failed only on the stale max-lines entry forsrc/commands/doctor-memory-search.test.ts; conflict-marker and line-growth ratchets passed. The stale entry was removed upstream in 72eafadc01a0. Neither that test nor its baseline file is changed by this PR.Inherited hosted CI failure: check-test-types-core-4 reports
TS2345atsrc/gateway/control-ui-public-session-refresh.test.ts:51. Upstream 06c6e83f4351 extractsrenderedEntryScript[1]without narrowing that capture beforerunInNewContext. The failing test and renderer are byte-identical between CI's main parent (86bc4f7df36b) and the tested merge; neither is changed by this PR. Main now contains the coordinator's fix 8420f82cbbf8, which narrows the captured script beforerunInNewContext. Landing uses the native inherited-failure exception for exactlycheck-test-types-core-4and its aggregateopenclaw/ci-gate. The gateway-root graph is the failing graph; the other, plugin-SDK, commands, and agents/sessions graphs in that CI job passed. No CI rerun or extra push was requested.Proof identity, commands, and size
Reviewed/tested head:
2e6a59aa1d6568a46863dda3907aed48204a35b8.Last main merge and production-reverted baseline:
56521b610f441ae4f7190a2d82b7acd4feba2991.Crabbox run:
run_0070108ed195ae637c34a2bb41cf9157.The bootstrap verified the full head, tree, clean tracked files, production hash, no instance-role credentials, and pinned toolchain before proof, then reverified the source afterward.
The module run used
node scripts/run-vitest.mjswith all 448 explicit paths. Two existing synthetic benchmark files were enabled withOPENCLAW_SESSION_ENTRY_SNAPSHOTS_BENCH=1andOPENCLAW_SESSION_PUBLICATIONS_BENCH=1.pnpm tsgo:core pnpm tsgo:core:test --ci-graphs-json '["core-test-agents-sessions","core-test-agents-tools","core-test-other"]' --concurrency 1 pnpm check:changedThe live comparison used the same source tree with only
session-accessor.sqlite-transcript-store.tsreverted for the baseline, followed by the unchanged candidate. Source hashes and terminal/outbox/commit observations were recorded separately for both processes.Production: +38/-1 (net +37); tests: +102/-1; docs: +5/-0. The production growth provides complete-event validation that keeps genuine stale ranges rejected. Hosted PR CI is separate from this completed lease proof.