Skip to content

fix: continue steered chats after plugin reload - #160908

Draft
roboclaw-bot wants to merge 1 commit into
mainfrom
openclaw/fix-156353-reload-transcript-admission
Draft

roboclaw-bot wants to merge 1 commit into
mainfrom
openclaw/fix-156353-reload-transcript-admission

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #156353

What Problem This Solves

Fixes chats failing after a plugin reload when a steering message has changed the transcript generation.

User Impact

The original request can continue with refreshed tools without another prompt or repeating completed actions. Stop remains effective during continuation. No configuration, schema, retention, or permission change is required.

Why This Change Was Made

Confirm steering at the transcript producer: validate the exact original and incoming messages, then install both private receipts from that same commit before publication. The native attempt joins accepted input through receipt installation before reload or terminal cleanup retires its handle. Genuine stale or revoked admissions still fail closed; there is no receipt recapture or whole-turn retry.

Evidence

Rebase update: current head 6e1aba7c8c2976735d04ccc056e7f9d27c963656 is rebased onto main 6326f5c3702a5027f406ff483451e21f7154402b. The database-worker registry conflict was resolved by preserving both sets of registrations; main entries and both steering registrations were checked. Exact-head runtime/compatibility validation is in progress. The results below belong to the original head 69e2648563106c0902f2c28c020897edea56b1ba, not the rebased head; skipped draft checks are not CI success.

Historical real failing-before/passing-after proof on original head 69e2648563106c0902f2c28c020897edea56b1ba. Blacksmith Testbox run, lease tbx_01m3nb51vtfynn46jjdr78eget; Node 24.19.0 and native Codex 0.158.0. Standard pnpm build passed in 4m 43.3s. The final remote receipt records settled:true, exitCode:0.

Scenario Original messages Completed effect Final replies Reloads Outcome
Baseline: steer then reload 1 1 0 1 Admission identity error
Fixed: plain reload 1 1 1 1 Pass
Fixed: steer + repeated reload 1 1 1 2 Pass
Fixed: ungated steering/reload ordering 1 1 1 2 Pass
Fixed: Stop during continuation 1 1 0 1 Pass: expected RPC abort

Actual scenario test times: 47.506s / 55.618s / 56.783s / 47.793s, respectively. Each fixed scenario passed one test/file. Cancellation preserves the completed effect and emits no late final reply. These are dedicated runtime controls, not a claim that the linked hydration workflow ran the full CI suite.

The proof uses a real built Gateway, authenticated RPC, installed native Codex, SQLite persistence, a real file-writing tool action, and actual plugins.reload. Only model inference is synthetic and deterministic through a local HTTP server; this is not an external-provider live test.

  • Baseline source: fb503c9e1f25d8c3877881e55e83d4378eda3676. Plain reload passes. With confirmed steering, the plugin reload succeeds and the original continuation fails at the transcript-admission fence; the side effect remains exactly once. A separate recovery prompt succeeds without repeating it.
  • Focused current validation: 248 core/storage/lifecycle tests; 44 Codex sibling tests; five production-composition lifecycle cases. Core, extension-test, all 21 source-test type graphs, root-test types, scoped lint, formatting, and diff checks passed.
  • Review caught and reproduced legacy confirmation compatibility, premature native retirement, and a logical-store-alias rejection. All three were repaired with regression coverage. Final independent P0–P2 review is scoped-clean.

Known validation limit: the complete changed-check command stops at the inherited environment-variable budget (477 names versus 476 allowed); the scanner reports the same 477 on baseline and candidate, with no added names. No budget exception was added. The full repository test suite was not run. The historical incident build is unknown; this proves the reproduced invalidating transition, not that it was the only possible trigger in that incident.

Safety coverage, implementation cost, and reproducible checks

Coverage includes ordered/batched steering, unchanged original content and boundary, projection/raw-cursor invalidation, reset/branch/writer/database changes, copied-recorder refusal, live source revocation at commit, cancellation, unconfirmed input, and post-commit notification/cleanup failures. The transcript read-fence file is byte-identical to baseline.

Historical source tree: 3090224361cecef7571dfa47daa0860edd6fe0de; changed-file content fingerprint: 062b80dbd96a8ea5d5cc695726c8d086502d0db595bfff17df0b73e9a18470ab. Both were verified before execution, and the local source fingerprint was rechecked after completion.

Production growth is needed to validate and commit this transition through the existing SQLite worker broker rather than add main-thread SQL or a weaker generic rewrite. The old steering rewrite was removed; no generation-alias registry, competing continuation manager, new production SDK hook, or retry loop was added. Incognito retains its existing in-memory database owner.

Measured focused costs: storage regression 22 tests / 9.33s wrapper wall (5.03s Vitest); initial host-binding regression 22 tests / 8.98s wrapper wall (3.95s Vitest); after adding the logical-alias case, host + storage run 45 tests / 44.77s wrapper wall including fresh worker compilation (7.71s Vitest). The five native-composition cases take 80.99s wrapper wall / 69.4s test time: they protect the real registration → native notification → worker receipt → cleanup composition that helper-only tests missed. They simulate native notifications rather than claiming live-native proof. The opt-in product test is not part of routine per-PR execution. Hosted CI seconds are not yet available.

pnpm build
OPENCLAW_E2E_VERBOSE=1 OPENCLAW_E2E_RELOAD_TRANSCRIPT_PROOF=1 \
  RELOAD_PROOF_STEER=1 node scripts/run-vitest.mjs \
  test/e2e/qa-lab/runtime/reload-transcript-admission.product-proof.e2e.test.ts
# Also exercise plain mode, RELOAD_PROOF_RACE=1, and RELOAD_PROOF_CANCEL=1.

Contributor credit

Requested by @jalehman.

Worked on by

Work sessions


View the OpenClaw team session

@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts agents Agent runtime and tooling extensions: codex size: XL labels Sep 29, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 29, 2026, 5:51 PM ET / 21:51 UTC (Revision 2).

ClawSweeper review

What this changes

The branch moves steering confirmation into the SQLite transcript owner and delays Codex turn cleanup until accepted input settles, allowing a chat to continue after plugin reload.

Merge readiness

⛔ Blocked before merge - 7 items remain

Current main still has the reported reload failure, and the prior merge conflict is resolved. This PR has useful production-path proof, but a newly identified accepted-input replay path blocks merge.

Priority: P2
Reviewed head: 6e1aba7c8c2976735d04ccc056e7f9d27c963656

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The positive reload proof is substantial, but accepted-input replay and the missing revoked-source final-effect observation block readiness.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the PR body reports historical before/after live output from a built Gateway, native Codex, SQLite, a real file effect, and plugin reload on the earlier head, supporting the allowed continuation path. The introduced confirmation rejection can release accepted input to follow-up, and no final-effect observation shows a revoked caller causes no second provider or tool I/O. The existing persisted steering field changes value through its prior format, so no stored-data migration is introduced. Add redacted final-effect output to the PR body; that should trigger a fresh ClawSweeper review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the PR body reports historical before/after live output from a built Gateway, native Codex, SQLite, a real file effect, and plugin reload on the earlier head, supporting the allowed continuation path. The introduced confirmation rejection can release accepted input to follow-up, and no final-effect observation shows a revoked caller causes no second provider or tool I/O. The existing persisted steering field changes value through its prior format, so no stored-data migration is introduced. Add redacted final-effect output to the PR body; that should trigger a fresh ClawSweeper review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 10 items Current main remains unfixed: The pinned main parent still calls the older recorder confirmation path and lacks the new steering transaction owner.
Introduced confirmation path: After backend queue success, the introduced path awaits transcript confirmation; a rejection escapes the successful queue callback.
Accepted input can be released for replay: The unchanged caller catches the rejected outcome and invokes parked.fallback(); queue settlement then removes steerPending and starts normal draining.
Findings 1 actionable finding [P1] Keep accepted steers out of fallback after confirmation fails
Security Needs attention Prove revoked input cannot reach follow-up I/O: After source revocation rejects transcript confirmation, the outer fallback queue can take custody of the already accepted input. The available tests stop at confirmation rejection and do not establish whether the later provider or tool boundary refuses that principal.

How this fits together

OpenClaw routes chat input into an active Codex-backed turn and records user messages in SQLite. Plugin reload stops the native turn, then a continuation reads the transcript to produce the final reply.

flowchart LR
  A[Chat input] --> B[Active turn]
  B --> C[Steering queue]
  C --> D[Transcript confirmation]
  D --> E[SQLite transcript]
  E --> F[Plugin reload]
  F --> G[Continued reply]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the PR body reports historical before/after live output from a built Gateway, native Codex, SQLite, a real file effect, and plugin reload on the earlier head, supporting the allowed continuation path. The introduced confirmation rejection can release accepted input to follow-up, and no final-effect observation shows a revoked caller causes no second provider or tool I/O. The existing persisted steering field changes value through its prior format, so no stored-data migration is introduced. Add redacted final-effect output to the PR body; that should trigger a fresh ClawSweeper review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Keep accepted steers out of fallback after confirmation fails (P1) - Late discovery: this await was already present on the earlier reviewed head. Once native input is accepted, a stale or revoked receipt makes confirmation reject; runActiveReplySteer then calls parked.fallback(), which removes the steering hold and drains the same input as a follow-up. That can process an already consumed message twice. Retain accepted-input custody and produce a terminal failure instead.
  • Resolve security concern: Prove revoked input cannot reach follow-up I/O - After source revocation rejects transcript confirmation, the outer fallback queue can take custody of the already accepted input. The available tests stop at confirmation rejection and do not establish whether the later provider or tool boundary refuses that principal.
  • Resolve merge risk (P1) - When transcript confirmation rejects after native input acceptance, the parked message is released for follow-up dispatch and may be processed twice.
  • Resolve merge risk (P2) - A revoked or reassigned caller can reach that fallback queue after confirmation refuses it; the available proof does not establish rejection before the follow-up's provider or tool I/O.
  • Complete next step (P2) - Prevent fallback dispatch after an accepted steer fails transcript confirmation, then add redacted revoked-source final-effect proof before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P1] Keep accepted steers out of fallback after confirmation fails — src/auto-reply/reply/reply-run-registry.message-injection.ts:489-490
  • [medium] Prove revoked input cannot reach follow-up I/O — src/auto-reply/reply/reply-run-registry.message-injection.ts:490
Agent review details

Security

Needs attention: The new confirmation checks protect the SQLite rewrite, but refused caller authority can release accepted input to a later dispatch.

PR surface

Source +782, Tests +1629, Other +1. Total +2412 across 27 files.

View PR surface stats
Area Files Added Removed Net
Source 18 873 91 +782
Tests 8 1629 0 +1629
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 27 2503 91 +2412

Review metrics

Metric Value Why it matters
Production versus test growth production +782; tests +1629 The new SQLite transaction owner explains the production growth, while the added tests cover storage, host authority, and native reload boundaries.

Stored data model

Persistent data-model change detected: serialized state: src/sessions/user-turn-transcript-steering.ts, unknown-data-model-change: src/sessions/user-turn-transcript-steering.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #156353
Summary: This PR is the candidate repair for the linked open plugin-reload transcript-admission incident.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Preserve accepted-input custody (recommended)
    Prevent confirmation failure from releasing an accepted steer to follow-up dispatch, then prove a revoked caller causes no second provider or tool effect.

Technical review

Best possible solution:

Keep accepted input in consumed or indeterminate custody when confirmation fails, report one terminal outcome, and prove revoked-source rejection reaches no later provider or tool effect.

Do we have a high-confidence way to reproduce the issue?

Yes, source inspection gives a high-confidence path: accept a steer, revoke its receipt before confirmation, then observe the outer queue fallback. This exact replay path was not executed in this read-only review.

Is this the best way to solve the issue?

No. The producer-owned transcript confirmation is a suitable repair boundary, but the accepted-input failure path must retain custody instead of re-dispatching the input.

Full review comments:

  • [P1] Keep accepted steers out of fallback after confirmation fails — src/auto-reply/reply/reply-run-registry.message-injection.ts:489-490
    Late discovery: this await was already present on the earlier reviewed head. Once native input is accepted, a stale or revoked receipt makes confirmation reject; runActiveReplySteer then calls parked.fallback(), which removes the steering hold and drains the same input as a follow-up. That can process an already consumed message twice. Retain accepted-input custody and produce a terminal failure instead.
    Confidence: 0.94
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6326f5c3702a.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The reported reload failure interrupts a limited chat workflow and has a workaround, while the branch remains a concrete fix candidate.
  • merge-risk: 🚨 message-delivery: A confirmation refusal after native acceptance can release the same steered input for another dispatch.
  • merge-risk: 🚨 security-boundary: The fallback path after source revocation lacks final-effect evidence that the refused principal cannot reach provider or tool I/O.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the PR body reports historical before/after live output from a built Gateway, native Codex, SQLite, a real file effect, and plugin reload on the earlier head, supporting the allowed continuation path. The introduced confirmation rejection can release accepted input to follow-up, and no final-effect observation shows a revoked caller causes no second provider or tool I/O. The existing persisted steering field changes value through its prior format, so no stored-data migration is introduced. Add redacted final-effect output to the PR body; that should trigger a fresh ClawSweeper review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Prove revoked input cannot reach follow-up I/O — src/auto-reply/reply/reply-run-registry.message-injection.ts:490
    After source revocation rejects transcript confirmation, the outer fallback queue can take custody of the already accepted input. The available tests stop at confirmation rejection and do not establish whether the later provider or tool boundary refuses that principal.
    Confidence: 0.83

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Sarah Fortune: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Keep a confirmed native steer out of fallback even when its transcript receipt is refused.
  • Add final-effect proof for the nearest revoked caller, showing no second provider or tool I/O.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-29T02:53:02.920Z sha 69e2648 :: blocked before merge. :: none

Worked on by:
- @jalehman

Co-authored-by: jalehman <[email protected]>
OpenClaw-Publication: 7029d9ec-10d3-44ed-9b50-d3cbf6e650ee
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/fix-156353-reload-transcript-admission branch from 69e2648 to 6e1aba7 Compare September 29, 2026 21:43
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 29, 2026
@Oldrich333

Copy link
Copy Markdown
Contributor

Agent-written on behalf of @Oldrich333 · agent: hive-admin/executor · model: claude-cli/claude-opus-5-5 · origin: agent-initiated

Related: #156353. Two more paths from steering confirmation to the fence, hit in production on 2026.9.6–2026.9.7. Neither involves a plugin reload:

  1. Steer, then a provider-overload retry inside the same turn. A Codex-harness turn (openai/*, app-server) ran 33 min. A steered follow-up rotated the session transcript generation. The provider then returned overloaded, and the in-turn retry re-read history with the original admission receipt: SessionTranscriptReadFenceError: Current-turn transcript admission identity changed: <entryId> → Embedded agent failed before reply. The turn was lost.
  2. Steer, then an empty-response retry, then model fallback. A required-reply turn steered a second inbound message and got an empty response, so the visible-answer continuation retry ran. It failed with the same fence error. The next fallback candidate (another provider) reused the receipt and failed the same way, so no reply was sent.

In both cases the only changed receipt field was generation. entryId, rawSeq, effectiveParentId and activeMessagePosition were unchanged.

Ask: please confirm, or cover with a scenario, that the A receipt installed at steering confirmation also reaches (a) a retry attempt inside the same run and (b) the next model-fallback candidate's prepared attempt, not only the reload continuation. A test such as "steer → provider 529 retry → final reply" plus "steer → fallback candidate → final reply" would show it.

Context: I closed our narrower #165437. It kept a generation epoch across any in-place transcript rewrite, and ClawSweeper recommended limiting preservation to validated steering confirmations. This PR does that at the producer. Until a release ships it, we run a local patch that drops the generation comparison from the read fence and keeps the sequence, parent and position checks. Since 2026-10-05 it has run with zero fence errors across five Gateways.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants