Repository navigation
fix(plugins): continue self-held session sends after reload - #187095
Conversation
OpenClaw-Publication: e08530c4-70a7-4e67-a61f-80f9c719aa59
|
🦞👀 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 changesThis PR retains a session send refused during plugin reload and submits it once after turn cleanup and a healthy replacement outcome. Example: Alice’s root turn holds send-continuation-proof while sending ORIGINAL-CONTINUATION-91ce to its paused child.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: it repairs a current send-loss path, and no actionable patch defect was found. The new revocation scenario addresses the previous review’s authority concern; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherSession tools submit messages through Gateway admission, which acquires plugin-backed model runtimes; the existing handoff owner carries refused sends across turn cleanup and returns their outcomes to the requesting conversation. flowchart TD
A[Root session send] --> B[Gateway admission]
B --> C[Private nonacceptance receipt]
C --> D[Existing turn handoff]
D --> E[Exact reload outcome]
E --> F[Current authority and policy checks]
F --> B
B --> G[Target input and completion]
Technical reviewBest possible solution: Preserve the deadlock refusal and retain only demonstrably unaccepted sends through the existing handoff, executor, authority and reload owners. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the refusal-before-acceptance path and the executor’s terminal error return; the submitted Gateway scenarios exercise that overlap, but this read-only review ran no reproduction. Is this the best way to solve the issue? The change preserves the intentional deadlock guard and reuses one send executor and the existing handoff rather than asking the model to reconstruct or retry a possibly accepted operation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b0e65d76509d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +959, Tests +3293, Other +1. Total +4253 across 40 files. Added test files: 9. View PR surface stats
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 HistoryReview history (1 earlier review cycle)
Reviewed October 28, 2026, 10:56 PM ET / October 29, 2026, 02:56 UTC (Revision 2). |
# Conflicts: # config/test-lines-baseline.txt # src/agents/tools/sessions-send-communication.ts # src/gateway/agent-turn/agent-run-admission-phase.ts
OpenClaw-Publication: 61346614-9ff7-464b-a586-63e3237b2d45
OpenClaw-Publication: dafc7126-ecd3-4e4f-b608-3f19253ba72c
OpenClaw-Publication: 8f7a34ca-3af3-40e9-80c8-bfcc7024b40d
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Why
A root session's original
sessions_sendcan be lost when the admission guard refuses to wait while that turn holds a reloading plugin. The target has not accepted the send; re-running the model is not a safe substitute for retaining that exact send.Changes
NoAcceptrefusal proves that admission did not occur. Join the obsolete owner before using the replacement outcome to continue.Impact
This is root-originating continuation only. A root send to a native child is supported; a native-originating send is still denied. Collector, cron, worker and remote-originating contexts remain unsupported and reject early.
Retention is process-local, not a durable restart queue. Stop does not claim to retract an already accepted send, and restart does not recover retained sends. There is no new configuration or public reload-status change.
Base integration
mainwas merged ata919e5ecc4f6c579e16ab21499ccda3acaa1fb07in merge commitc8ab8cd64ff98cb17e65461b42bc2f6b64634d36(treeaeec667762151057b95750de4f9f9f59e96d7dc4), joining the earlier PR head5aff0439b5c2d0d5426d7ee1dfcbbce9b8ca97e7(feature commitf239726aa340123954d1450d0873739776c29008, treeb59ba20c230b8fc111d55066e9c4fe75e69ca4da).mainwas merged because the PR conflicted with it. Three paths conflicted:config/test-lines-baseline.txt,src/agents/tools/sessions-send-communication.tsandsrc/gateway/agent-turn/agent-run-admission-phase.ts. Both source conflicts come from refactor: resume running sessions after graceful restarts #185730, which removed the subagentterminalOwnerfield and restart-recovery admission. The resolution keeps those removals and every line this PR adds; it introduces no new behavior.main, in separate hunks:attempt.ts,session-tool-handoff.ts,sessions-send-communication.ts,agent-run-admission-phase.ts,agent-run-admission-types.ts,agent-turn-service.tsandserver-plugin-in-process-authority.ts.config/test-lines-baseline.txtnow equalsmain's, so this PR no longer changes it.Static repair after merge CI
Source commit
979c83811135cd8c95d740a5cd93a6c6db5cfb6c(tree5413b1353c838a274febc9dfc990a7caa8531970) was published as head83c2faf2f75d372f31c396a5a1cee49b492d581c.CI run 40795074130 tested the previous head
7595b27merged intomainat71d954df153317e7ce83fbc0509be20405299258. It found these PR-caused failures, which979c838addresses without behavior changes:check-prod-types,check-test-types*, declaration build, SDK boundary): a follow-up failure result withoutselfHeld, a replay-port result type, an untyped mutable refusalstage, a closure over a possibly undefinedchild, and test-only typing inattempt.sessions-yield.test.ts,sessions-send-self-hold.test.tsandserver-plugin-reload-lifecycle.test.ts. The fixes are type-only, except that the follow-up failure now carries an explicitselfHeld: undefined. That path runs only after an accepted start, so it is never retained.madge-import-cycles, 84 modules):agent-admission-refusal.tsimportedagent-run-admission-types.tsfor a type, closing a cycle through the agent tools. It now declares the two dispatch ports it uses locally. The runtime import-cycle check was already clean.agent-admission-refusal.ts; the typed refusal removes it.src/plugins/plugin-replacement-operation.ts, which failedeager-import-closure(2 tests) andpr-worktree-provision(3 tests). The file is now listed inscripts/pr-lib/wrapper-components.txt.Local evidence for the repair:
oxlint --type-checkdiagnostic; the 7 test-type errors were seen only in CI. After the repair, that diagnostic reports no problems in all 36 changed TypeScript files. It is not the canonical type check: localpnpm tsgo:corestill refuses its input before analysis ("Declaration input escapes checkout"), so canonical type and declaration analysis did not run locally.pnpm check:madge-import-cyclesreproduced the same 84-module cycle, then reports 0 cycles after the repair.eager-import-closurepasses 35/35. Of the three failingpr-worktree-provisioncases, two pass locally and the third is skipped on macOS.attempt.sessions-yield(12),server.agent-late-admission(1) andsessions-send-reply-flow.requester(4). Formatting, diff, test-line (6,245,435 against 6,320,000) and assertion-safety checks pass.Remaining CI failures on run 40795074130 that this PR does not cause, as far as the evidence shows:
main: themock-exportsratchet (its inputs are byte-identical tomain), andserver.channels-start-outcomes,server.approval-forwardingandserver-startup-secret-owner-isolation, which fail with the same titles in scheduledmainCI.subagent-registry"does not restore a superseded lifecycle after a successor is released" asserts gateway root work that fix: finish process-owned shutdown within its cleanup deadline #187090 removed onmain. This PR touches neither file. Inferred, not reproduced onmain.server.context-prewarm.remote-proofmeasured 1,340 ms against a 500 ms budget.CI run 40802305283 tested
83c2fafmerged intomainat7074b619ff3087cb61d0825e3ff3457300ccb9ad. The canonical production and test type checks, declaration build, SDK boundary and import-cycle check passed there. Its remaining failures:mainhad lowered the ceiling after this PR's base and has since restored it to 6,320,000 (chore: restore measured test-code headroom #187162). This PR does not change the ceiling; the next run passed against the restored ceiling.sessions-send-tool.admission.test.ts, a file this PR does not change. It came frommain(fix(agents): keep top-level Slack requests' sessions_send completions top-level #187065), also failed scheduledmainCI, and is fixed onmain(fix: restore lint compliance in sessions-send admission tests #187144).server.context-prewarm.remote-prooffailed again (844 ms; 1,340 ms on the previous head). Its 500 ms budget is the largest gap between 20 ms heartbeat callbacks during the post-ready warmup window, not warmup or request latency. The test and the four core modules it exercises are identical on this PR, its CI base and the CI merge, and no causal path from this PR is established; it is also not shown to be inherited.Revocation proof
Current head:
b31e43ac536d40585d28e19bc6c9a29131ca87ce, an empty publication bookkeeping commit on test commit20068cd16f0fba183851189a7782e60f1b1029eb. Tree:20b00d8a25926d85ae091dadec0b210d38ec62d4. CI run 40808307564 passed on this head, merged intomainat960debc51780c899df913ea2ddf3cf971a80ea02.The new product test
server.plugin-reload-send-revocation.product.test.tsanswers the earlier review's request for end-to-end proof that revoking the selected participant during a retained replay prevents the target effect. It runs a real Gateway with trusted-proxy TLS and two paired operator devices, Alice and Bob, in a shared session; Bob joins through the realsession.members.addRPC. No authority, participant or executor is mocked.sessions_senduser only after it has seen that steer.not_accepted/plugin_reload_self_hold. The healthy replacement then replays it once with the same idempotency key.Results:
device.token.revokerevokes Bob's device and his own next request is refused. The replay is then refused by the retained Gateway continuation, whose captured authority is Bob's: the outcome iserrorwith "Gateway continuation authority is no longer active". That check fires earlier than agent admission. The target receives no model request, provider effect or transcript receipt for the message. Because the settlement wake runs under the same revoked source, Alice gets no model wake; the host writes exactly one durable "could not continue this conversation automatically" notice to her conversation instead. Alice's own authority still works.Each case needs a real Gateway, model fixture, plugin reload, two TLS operator clients and a real revocation, which is why the cases take tens of seconds rather than using callback ports. The test keeps the default 120,000 ms budget, binds private handoff stores before imports, and reuses a small plugin fixture helper extracted from the existing product test without changing its behavior. Two independent reviews and a lead review accepted the proof tree.
Evidence
b31e43acompleted successfully andopenclaw/ci-gatepassed, including canonical production and test type checks, the declaration build, SDK boundary, import-cycle checks, duplicates (no test clones), lint and ratchets (6,249,477 test lines against a ceiling of 6,320,170). Under Bun, the new revocation test passed in 64 s with the same oracles as locally (allowed: one effect, one wake, outcomeaccepted; revoked throughdevice.token.revoke: no effects, no target model requests, no wakes, one notice, outcomeerror). The existing three-case test passed in 74 s (effects 1, 1 and 0; one wake each), andserver.context-prewarm.remote-proofpassed in 12 s. CI did not run these product tests under Node.Historical evidence for the reviewed feature tree
b59ba20, before the merge. Reviewed change snapshot:062aafd6dbe1d6c25f4696b7e84b609e499ae3c2d53ada981b4c59f2a5005281(binary diff SHA-256 from base228596060e33dfcddbb6740416f381daac6f84fe).660111f3b78ffa52dc495d82c7854912436af127dfd74e2dcba80bc1b9d7cfab, with 37 changed full-file bodies and 62 unchanged contracts. All 24 partition reports returned, but that is not 24 complete assessments: required caller/full-body context was not guaranteed to accompany each assigned change.381e0ec3d153c5f02063ea21622b753de8c60fdaand were replaced in the committed candidate. They were valid findings, not false positives.062aafd6passed with no findings, and lead review accepted treeb59ba20. Independent and lead reviews of the static repair tree5413b13found no code defects; a reviewer's correction to the evidence wording is reflected here.Gaps
b31e43a: ready for maintainer review, with no findings. Its remaining test note is that a complete Gateway scenario failing on the merge base is not shown; the failing-before evidence above comes from focused tests, not that scenario.server.context-prewarm.remote-proofpassed on this head, and passed in isolated runs at both the earlier CI merge and its base. The heartbeat gaps it measured in the two earlier CI runs (1,340 ms and 844 ms) remain unexplained.pnpm tsgo:corerefused its input before analysis, and the one local AutoReview is INCOMPLETE and covers neither the merge nor the later commits.