Repository navigation
fix(sessions): steered or annotated turns are lost on retry with 'admission identity changed' - #165437
fix(sessions): steered or annotated turns are lost on retry with 'admission identity changed'#165437Oldrich333 wants to merge 1 commit into
Conversation
…pt rewrite The transcript generation is session-wide and every in-place row rewrite (steer confirmation, prompt annotation) rotated it, so any other running turn's next fenced read threw 'admission identity changed' although its admitted row never moved. Rows-preserving rewrites now keep the generation's epoch; destructive replacement starts a new one. Read fences compare epochs; writes keep comparing the full generation.
|
🦞👀 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 real behavior proof before merge. Reviewed October 5, 2026, 4:12 AM ET / 08:12 UTC. ClawSweeper reviewWhat this changesThe PR separates transcript generations into epochs and rotations so running turns can reread history after in-place rewrites while destructive replacements still invalidate their admission. Merge readiness⛔ Blocked before merge - 6 items remain The PR addresses a source-confirmed failure that remains on main and in the latest release. It has useful work beyond the related reload repair, but its broader admission-validity contract and exact-patch evidence remain unresolved. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw stores conversation transcripts in SQLite. Running turns carry admission receipts that bound subsequent history reads; transcript writers update the stored generation and derived history projections. flowchart TD
A[Incoming user turn] --> B[Transcript admission receipt]
C[Transcript rewrite] --> D[SQLite generation watermark]
B --> E[History read fence]
D --> E
E --> F[Bounded conversation history]
F --> G[Retry or continuation]
Decision needed
Why: Row identity alone does not establish that every payload rewrite preserves the admission contract, and the applicable storage policy requires acceptance of changed reader-consistency semantics. Before merge
Findings
Agent review detailsSecurityNeeds attention: No supply-chain change or proven authorization bypass was found, but the expanded stale-admission validity boundary needs safety qualification. PR surfaceSource +29, Tests +47. Total +76 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep valid turns readable across harmless steering and annotation updates while retaining explicit invalidation for admission-changing rewrites and a verified upgrade and rollback contract. Do we have a high-confidence way to reproduce the issue? Yes, source provides a high-confidence path: admit a turn, confirm steering through an in-place rewrite, then reread history using the original receipt. Current main rejects the generation-only mismatch; this read-only review did not execute the path. Is this the best way to solve the issue? Unclear. Repairing the shared transcript owner is appropriate, but preserving admission for every payload rewrite is broader than the demonstrated steering defect and needs a qualified validity contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c1b9f4ec91e5. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
chessing234
left a comment
There was a problem hiding this comment.
Reviewed commit 739c792fbd908f414a5eba810e6d088c47f6ef22.
Inspected transcript admission identity preservation for retry and steering. No actionable correctness issue found.
Validation: static source review only; runtime tests were not run. This review makes no assertion that CI or platform tests pass.
Closing in favour of #160908. ClawSweeper's review asked to limit admission preservation to validated harmless rewrites instead of every in-place payload rewrite. #160908 does that at the producer: it confirms the steering commit and installs the refreshed original-turn receipt. Our retry/fallback paths and the evidence for them are now in a comment on #160908. If a non-steering in-place rewrite turns out to break running turns, I'll open a new PR scoped to that writer, with runtime proof. |
Related: #156353, #160908
What Problem This Solves
Fixes: a running turn dies with
SessionTranscriptReadFenceError: Current-turn transcript admission identity changedwhen its session transcript is rewritten in place while it runs (a Steer confirmation, a prompt annotation) and the turn then reads history again (in-turn retry, model fallback, a tool reading its own session).User Impact
User impact: a steered or annotated turn finishes and replies instead of being lost; the user does not have to resend the message.
Why This Change Was Made
The transcript generation is session-wide. Every in-place row rewrite rotates it, even though the admitted user row stays exactly where it was. Only the rewriting recorder refreshes its own receipt; every other running turn keeps the old generation, and its next fenced read throws.
This change splits the generation into an epoch and a rotation:
rewriteSqliteTranscriptEventRowsInTransaction,updateSqliteTranscriptEventJsonInTransaction) produce<epoch>-<fresh>.The existing contract is kept: a destructive replace still invalidates every running turn's fence, even when it re-inserts identical rows (
session-transcript-runtime.read-fence.test.tscovers this unchanged). An earlier comment on #156353 proposed dropping the generation clause entirely; that also lets an identical-shape destructive replace through, so this PR does the narrower thing.Compared with draft #160908 (refresh receipts at the Codex steering path): this covers every harness and every in-place rewrite source in one place.
Evidence
keeps a running turn's fence after an in-place rewrite of a later row(session-accessor.sqlite-admission-fence.test.ts): persist source / admitted / steered rows, rewrite the steered row in place, assert the generation rotated, then a fenced read under the original receipt succeeds. Fails onmainwithCurrent-turn transcript admission identity changed.session-transcript-runtime.read-fence.test.ts: a receipt whose generation differs only in the rotation part reads the same events (fails onmain); every existing negative case, including the identical-events replace, still throws.tsgocore + config-cli + plugin-sdk test projects: 0 errors.oxfmt --check,oxlintclean.pnpm test <file> --maxWorkers=1on a shared host (warm): admission-fence 27 s (VitestDuration24.9 s), runtime read-fence 19 s (13.2 s). CI duration not available from our side.admission identity changederrors in Gateway journals and MCP logs. Before it: 3 lost turns on two Gateways, including a webchat user turn after a Steer + provider-overload retry (admitted row unchanged; generation-only mismatch).