Repository navigation
fix(sessions): acknowledge committed input retries without duplicate turns - #188527
Conversation
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eeff73a32a
ℹ️ 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".
5a19197 to
2bbbe29
Compare
|
Final-head baseline attribution (
Baseline reproduction removed all of this PR’s production edits and ran only these two cases in Merged as |
Accept the storage owner’s matched keyed receipt after a later turn. Preserve unfinished current-turn replay and refuse changed content or requester identity. Carry the historical acknowledgment through prompt preparation and terminal completion so committed subagent announcement retries succeed without another model call or delivery.
2bbbe29 to
599245a
Compare
|
Codex review: needs maintainer review before merge. What this changesThis PR acknowledges matching committed input retries without appending another user message or running another model turn. Example: Input key run-42:user is retried after its reply and a newer conversation turn.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a current retry failure, preserves unfinished-turn recovery, and has no actionable introduced defect found in the reviewed diff. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherSession storage matches keyed inputs, the session manager adopts committed receipts, and embedded prompt admission distinguishes unfinished work from historical acknowledgments before terminal settlement. flowchart TD
A[Retried input] --> B[Pending input custody]
B --> C[Canonical transcript lookup]
C --> D[Prompt admission]
D --> E[Resume unfinished turn]
D --> F[Acknowledge committed input]
E --> G[Terminal settlement]
F --> G
Technical reviewBest possible solution: Keep storage responsible for exact deduplication and carry one acknowledgment outcome through existing prompt admission and terminal settlement. Do we have a high-confidence way to reproduce the issue? Current main visibly throws on a storage-matched historical keyed receipt, and the PR reports red-before/green-after regressions at receipt adoption and prompt admission; no target code was executed during this review. Is this the best way to solve the issue? The patch addresses both halves of the invariant: accept a matching committed receipt while preventing a second execution, using existing storage, custody, recovery, and terminal owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4591070b2f4b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +78, Tests +156, Docs +5, Other +127. Total +366 across 25 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel 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 Reviewed October 30, 2026, 1:33 PM ET / 17:33 UTC. |
…turns (openclaw#188527) * fix(sessions): acknowledge delivered input retries without another turn Accept the storage owner’s matched keyed receipt after a later turn. Preserve unfinished current-turn replay and refuse changed content or requester identity. Carry the historical acknowledgment through prompt preparation and terminal completion so committed subagent announcement retries succeed without another model call or delivery. * test(sessions): type keyed replay fixtures and acknowledgment spies * fix(sessions): preserve failed-attempt profile recovery on replay * test(sessions): assert no-op replay across continuation and Talk callers
Backport accepted fixes onto 2026.11.5-beta.2. Base: bc061f9 Canonical source tree before commit: e6c0c39 These are adapted/squashed backports; do not claim each is an exact Git cherry-pick. Source provenance (selected verified commits; other cohorts use their frozen patch/adoption manifests): runtime-B: b20a0cc fix(macos): connect with configured credentials despite stale app environment (#191468) c4c0942 fix(update): failed updates from 10.7–10.9 crash in automatic migration recovery (#189713) 6aae408 fix(update): preserve recovery errors and async triage callbacks (#191495) 8910654 fix(macos): prevent first-launch Gateway failures after upgrades (#191436) 00b2ff4 fix: parent sessions miss child approvals with a custom session store (#189827) c6142a8 fix: avoid copying managed plugin binaries during Gateway startup (#187865) e72b356 fix(anthropic): avoid token profile collisions (#187875) 807075d fix(anthropic): set API workspace at login (#186976) bafe92f fix(exec): preserve no-timeout results from macOS app nodes (#190729) 9b05a64 fix(imessage): use a PostgreSQL-safe recovery cursor key (#184919) 6ba197f fix: session search on PostgreSQL scans every transcript row instead of using the text index (#187909) 4f49aa5 fix(sessions): PostgreSQL session search scans every transcript row again after the 5th search on a connection (#188979) de3936c fix(macos): Mac tab shows a blank or stale page when a load fails (#185432) e977080 fix(macos): prevent duplicate voice sends and false sent feedback (#186271) provider-compaction: 1b43c2e fix(compaction): preserve active request provenance (#180214) 7b0cfe3 fix(google): restore tool calls with Python keyword parameters (#191561) 9039ceb fix(ci): keep compaction attribution helpers internal d6a1327 feat(google): use the Interactions API for Gemini Flash models (#189395) fe0f8d1 fix(google): Gemini models ignore configured topP (#190695) history: c51d733 fix(sessions): stop expanding archive reads from exhausting memory (#190690) 3c8bd4d fix(sessions): page oversized earlier history instead of failing at 8 MiB (#188450) b195f61 fix(sessions): page oversized transcript history in both directions (#188483) b65482e fix(gateway): preserve older history across hidden message gaps (#188557) 3d4fc94 fix(sessions): avoid oversized listing and imported-history reads (#189284) 33e7baf fix(sessions): bound active accounting without blocking writers (#190182) 682ade7 fix: preserve chat history continuation metadata (#188612) runtime-C: 7e005b0 fix(macos): keep secrets when a Gateway config save fails (#187734) 15cf738 fix(macos): keep Gateway auth when Tailscale exposure is turned off (#187664) b53a06b perf(update): read candidate state inventory without copying the shared database (#187921) 970fc4e fix: restore CLI message sends with agent tool policies (#188058) 73ad731 fix: stop model fallback when session capability metadata changes (#179312) 32305db fix: subagent turns fail after session metadata changes (#183501) d13bd0f fix(codex): include relay conversation instructions in trajectory (#189005) e375530 fix: replies after a plugin reload from Control UI go to the session's last external chat (#190982) 9346376 fix: reasoning-only retry is refused by Anthropic as reasoning_extraction (#184434) direct-auth-state: 1b15408 fix(models): keep the model list when one plugin-owned provider lacks a credential (#189014) 7d8dc60 fix: recover startup migration with retained worker index (#189023) capacity: 41772e3 fix(worktrees): settle completed disk debt on refused postchecks (#188727) command-once-189369: 8269137 fix(plugins): plugin commands that continue the agent run three times on native command turns (#189369) pg-board-189564: 7232a8d fix(boards): publish widgets with PostgreSQL storage (#189564) queued-edit-189869: 92b32ca fix: hold queued messages through inline edits (#189869) Preserve source attribution from original commits. For a genuinely exact individual pick only, use the conventional (cherry picked from commit <sha>) line. Full file-level provenance: coverage-manifest.json; reviewed patch hashes: artifact-registry.json. No held136/native82 content adopted by this work. No release or full-candidate qualification claim. Additional original-source identities (exact adapted hunk scope is in frozen artifacts): release-guides-185258: 39c37e6 docs(release): define ledger-first hotfix routing (#185258) UI-history: 10a6e4f fix(ui): scope provider-add discovery warning to its own provider (#188541), 3d7b4c4 fix(ui): never fail loading earlier chat history without a boundary (#188372) obsolete-cache-188203: 90d82c2 fix: preserve completed reasoning and refill chat snapshots (#188203) webhook-169778: b1f643f fix(startup): keep webhook decisions startup recorded for channels Doctor left pending (#169778) schema-lease-188391: ba6cfcd fix(state): keep lease renewal independent of parent admission (#188391) backfill-188976: c75a8a8 fix(gateway): stop session row backfill once the Gateway is closing (#188976) canonical-disable-188846: 88b56ee fix(config): auto-enable reads and writes mixed-case plugin policy under the canonical id (#188846) matrix-177272: 5a6d22c fix(matrix): stop seeding new thread sessions from the room transcript (#177272) provider-hook-189059: 0588f51 fix(models): isolate every per-provider catalog failure (#189059) unicode-189868: 87396e7 fix(oc-path): avoid reading and editing a different Unicode key (#189868) replay-cohort: 2031044 fix(sessions): acknowledge committed input retries without duplicate turns (#188527), 9114431 fix: resume configured fallback after interrupted attempts (#188672) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes replies and subagent completion announcements failing with
Session transcript keyed user is outside the current turnwhen an already committed input is retried after the conversation advances.User Impact
An identical committed input is acknowledged once, without another model turn, duplicate reply, or announce failure. Interrupted current inputs can still resume. Conflicting content or requester identity remains refused. No schema or configuration changes.
Why This Change Was Made
Storage already returns the canonical message with
appended: false. The session manager incorrectly rejected that receipt based on the current turn. Removing that rejection alone would allow the model loop to process the same input again, so prompt preparation now distinguishes a historical acknowledgment from an unfinished current-turn replay and carries that outcome through terminal completion.The original retry remains bound to its original requester identity while stored approved bytes are adopted. The synchronous persistent API uses the storage owner's full comparison rather than its former key-only shortcut.
Evidence
Focused replay/model-admission tests: 56 passed. Terminal resolution: 48 passed. Session-manager async and synchronous compatibility tests: 31 passed. Changed-file formatting/lint and
pnpm tsgo:corepassed. Test-line ceiling remains unchanged. Recorder, pending-input custody, and prompt-prefix consumers: 72 passed. Export-name collision guard passed; eager-import and PR-wrapper closure checks: 38 passed (245 focused tests total).Independent subagent review (autoreview route unavailable): clean after moving acknowledgment ahead of preflight compaction. The configured autoreview route refused the provider mismatch; no operator configuration was changed.
Base regressions (base
680bf001e246): three historical receipt cases fail with the reported error. At the model boundary, three completed-input cases fail while the interrupted current-turn case passes. The announcement-delivery composition regression also fails on base (delivered: false) and passes with the fix (delivered: true, one user row, zero model/send calls). Tests use isolated SQLite state and actual prompt admission, announcement delivery, and terminal resolution; provider and Gateway transport I/O are synthetic.Owner microbenchmark:
node --expose-gc --import ./scripts/tsx.mjs scripts/perf/keyed-user-replay-measure.ts(separate--allocationpass). Across 5,000 receipt adoptions with 64 managers and 10,240 synthetic retained entries: base rejected all 5,000; candidate acknowledged all 5,000. Main-thread CPU was 17.184 → 1.303 ms; sampled allocations were 6,475,912 → 2,048,448 bytes. Host load was 35.18 → 32.93 for timing and 34.66 → 34.41 for allocation. This isolates receipt adoption, not storage, providers, or whole-Gateway performance. No production load test or deployment was performed.Simplification: removed both historical-turn receipt rejections and the persistent key-only shortcut. Runtime production delta is +78 lines; this growth carries the single already-delivered decision through admission, model suppression, and terminal completion, and validates the original retry before adopting canonical bytes. Deleting the rejection alone would execute the input twice. The benchmark script adds 127 lines of separate measurement tooling (+205 including tooling, excluding tests/docs); tests add a net 156 lines.
No schema/configuration changes, Testbox lease, Team access, or deployment. This correctness lane uses focused production-path integration proof and the owner microbenchmark; no whole-Gateway load/GC result is claimed. All 10 selected replay, announcement, conflict, and rate-limit regressions passed again after the first rebase. The reviewed change, including consumer contract tests, was rebased without conflicts onto main
8f1ef6c97eff. Broad proof is PR CI.CI follow-up: the first run found two typing defects in the benchmark fixture and an existing replay test spy; fixed without production changes, independently reviewed, and verified by a typecheck scoped to those two files plus the three affected restart cases.
The same CI run also failed two unchanged chat-history pagination cases in
src/gateway/server.chat.gateway-server-chat-b.test.ts: “backfills older offset pages across a dense silent gap” (nextOffset: undefined instead of 1) and “centers a bounded page around a message id” (hasMore: true instead of undefined). Both fail identically with all this PR’s production edits removed against CI’s exact main parent7861f59337f9163040c9ccfb1c1f682ede689e27(2 failed, 60 skipped). Baseline command:node scripts/run-vitest.mjs src/gateway/server.chat.gateway-server-chat-b.test.ts --maxWorkers=1 -t 'backfills older offset pages across a dense silent gap|centers a bounded page around a message id'. Failing CI job.Hosted review also found that a same-run authentication failure could be mistaken for delivery while the recovery owner rotates profiles. Added two
401 Unauthorizedcases alongside rate limits: both failed before the correction; all 13 selected completed-input, announcement, conflict, coded-abort, and provider-recovery cases pass afterward. Admission now leaves same-run failed attempts with the existing recovery policy. Fresh independent review is clean.Consumer contract follow-up: updated the existing native requester-settle and Talk consult tests that expected the removed rejection. They now assert canonical no-op receipts and unchanged transcript/tail; true payload conflicts remain rejected and native reconciliation still invokes the command once. Both full focused files pass (24 tests); independent review is clean. No further production change was needed.