Repository navigation
fix(plugins): prevent SDK replies from using retired runtime state - #199700
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: needs maintainer review before merge. What this changesThis PR binds lazy SDK reply dispatch to the runtime host that admitted the operation. Example: Host B handles its first ACP reply after runtime publication changes from 4 to 7.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a useful runtime-ownership repair, and both earlier findings are resolved; no new actionable defect was found, while required CI remains incomplete after infrastructure capacity failures. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherPlugin SDK reply helpers receive channel or ACP reply requests, select the admitting resource host, and lazily invoke core dispatch while that host retains shared-state ownership. flowchart TD
A[Plugin reply request] --> B[SDK facade]
B --> C[Bound resource host]
C --> D[Shared state admission]
D --> E[Captured lazy dispatch]
E --> F[ACP or provider reply]
B --> G[Unbound standalone runtime]
Technical reviewBest possible solution: Keep whole-operation admission and lazy dispatch under the existing resource host, preserving public SDK contracts and standalone behavior. Do we have a high-confidence way to reproduce the issue? Source shows the retained module-global dispatch path; the supplied retirement receipts exercise the repair, while the body correctly disclaims an identical-input original RED/GREEN comparison. Is this the best way to solve the issue? The repair uses the existing lifecycle owner, removes the competing runtime-channel binder, and moves unchanged contracts to lightweight owners without weakening database guards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5c9ef285b21b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +139, Tests +377. Total +516 across 46 files. Added test files: 2. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 HistoryReview history (5 earlier review cycles)
Reviewed November 16, 2026, 5:16 AM ET / 10:16 UTC (Revision 6). |
|
|
@clawsweeper re-review Exact head 910990f addresses both prior findings. The PR body now records complete source-contracts and architecture results, final current-head Node/Bun native-retirement proof, independent review, and unchanged baseline failures. Please review the corrected ownership/type boundaries; preserve the public SDK contracts and closed-host denial. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
Baseline-Refresh: 2c0071cde26849aab9b713870b3ab301e771968c
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
Baseline-Refresh: 0fc123b84f38775709f4d25511e7f8e70fcc1071
|
@clawsweeper re-review Please review exact published head |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…penclaw#199700) * fix(plugins): scope SDK reply dispatch to its runtime owner * test(plugins): type reply dispatch surfaces and isolate lazy mocks * refactor(plugins): isolate reply dispatch contracts * test(plugins): use canonical cron capability types * fix(test): settle automation notice read-boundary turns * fix(agents): preserve JSON normalization for tool metadata * test(agents): register JSON normalization lint exception
What Problem This Solves
Fixes SDK reply dispatch reaching a retired state-database factory when a native SDK module survives replacement of its calling runtime graph.
User Impact
Reply operations stay with the host that admitted them. Fresh hosts can dispatch replies, while calls retained from a closed host remain rejected. Public SDK signatures, lazy exports, and the shipped standalone path are preserved.
Why This Change Was Made
The existing SDK resource host captures the whole lazy ACP/provider dispatch operation, including shared-state admission. Admission and execution therefore share one lifetime. Buffered and plain provider dispatch use one light guarded facade and sanitizer. The runtime-channel duplicate binder is removed.
The private ACP implementation has a distinct core export. Canonical abort, typing, cron, session, and reply-option type owners remove the circular static graph without changing capability validation or runtime bodies. Database lifecycle guards, schemas, configuration, and public operation identities are unchanged.
The production changes implement the generation-owned capability boundary; tests cover its lifecycle and authority invariants. The per-host captured operation capability and shared lifetime boundary replace duplicate dispatch binding and sanitization.
Evidence
Signed candidate:
dd1c5f9439322b7a97979bd9940ad8edac3fee4c, treeedb25d587993b756a3b4f6d337ae2320ef97af6d. The native workflow integrated only captured protected-main3dc7eb96a52859815e1f6b36f524bab875d4a08a, with ordered anchor parents[b00e62f842843e50211eb3058e05481db372f154, 3dc7eb96a52859815e1f6b36f524bab875d4a08a]. Both content conflicts now use the complete current-main catalog and suppression inventory; the stricter optional-property regression assertion is preserved. Of the 98 retained reviewed owner contracts, 97 are byte-identical tob00e62f; the changed cron-admission contract keeps main’s administrator-only template setup and the canonical capability type import. Earlier native anchors and proof remain attributed to their exact sources.Fresh canonical review of the complete
3dc7eb9..dd1c5f9PR range covered all 46 changed files and 18 whole current owner/caller contracts in one 323,463-byte pass: scoped-clean, complete, zero findings. Report SHA-256:1596e860ae2ae0e52374e75d3a504e2653323c2238681abcdc5bfd961ba8ab5e. Prior reviews are reused only for verified unchanged source.On exact
dd1c5f9, pinned Bun passed the strict catalog regression (1), cron operator/template authority tests (55), and the complete suppression-inventory file (14): 70 distinct tests. Four-file canonical lint and formatting passed. These are focused Darwin checks, not a new full build or Linux proof. The required exact-head hosted CI and ClawSweeper review remain separate landing gates.Full build, including SDK declaration emission and export checks, passed on signed
320c764b83528225a299bcadea628f9ec9982b84. Focused Node 24.22.1 and pinned Bun191755ec115ece3dd642eba3cb0143cecb5e5d7aeach passed 17 files / 160 tests. The final910990ffollow-up changes only two erased test type consumers; all production blobs match320c764. Native validation.The whole source-contracts lane passed on
320c764. The complete architecture lane passed on exact910990f, including zero Madge cycles. Exact-head core, Gateway-methods, and agent/session test type graphs plus affected lint/format passed; plugin-SDK and messaging test graphs passed on unchanged inputs at320c764. Exact-head tail.Fresh canonical independent review of
26e8856..910990fcompleted all five ownership assignments with no findings; all 35 changed units and 98 whole source contracts were covered. Report SHA-256:26d694f2d8e6da7dd4a84f16224b1b260ec54966dd221adab0039101efd8b33a. This complements the earlier full ownership review.Ordered native ACP proof on signed
910990fpassed on both Node and pinned Bun: two files / two tests per runtime. A1/A2 normal restart passed with the strict complete-stream assertion and unchanged publication. Actual file-boundary retirement changed publication 4→7; the retained getter was correctly denied, and fresh B's first ACP reply used a factory captured from current publication 7. CJS export identities stayed stable; gaps, overflow, callback failures, and unexpected rejections were zero. Final native proof.That proof verified candidate
910990fplus only seven unpublished diagnostic paths as received tree5951965c272bd78e3a14a5860a72b7fef8ab5108, with public comparison base7ecd67cand the unchanged product fixture. All managed steps joined, the native lease settled successfully, and the exact clean signed candidate tree was restored. Diagnostic hooks and helpers are not in this PR. Native carrier cancellation after lease shutdown is separate from the payload's successful result; these receipts are not hosted CI success stamps.The required-CI investigation found that the automation fixture advanced its global phase when the removed-job handler returned, before the original notice completed its model error roundtrip. It now strictly checks the canonical safe automation-not-found denial with no history, supplies the terminal reply, and awaits the original owner-bound
SessionEventReceipt.settledbefore the next notice. Closed/foreign authority checks are preserved; the owned state directory is private and pending holds release in cleanup.The prior fixture-only checkpoint tree
ad829dfpassed the original canonical pinned-Bun predecessor→target sequence (two files / 12 tests),test-root-e2e, touched-file lint and formatting. All children joined and the native lease settled. Fixture validation. The later signed commit has exactly that tested tree.Fresh canonical independent review of
910990f..b84c4c3completed one pass with 24 whole source contracts and no findings. Report SHA-256:d48e915030e89b0062de17499e92eee54cfc698ac8c15f4bc4686159ab92945c. The unchanged production review and runtime proof above are reused explicitly.Intentional JSON normalization drops optional
undefinedMCP metadata;structuredClonedoes not preserve that contract. The implementation and its single explained lint exception are now provided by current-main PR #199944. This PR retains the stricter assertion that the normalized optional property is absent. Historically, exact candidate tree05e9defpassed canonical lint, formatting, and the pinned-Bun regression while full8862ffcreproduced one original lint error. That raw baseline failure remains a failure. Historical paired validation.The same bounded validation preserved the original three-case order and two-operator overlap in
server.agents.config-readiness.test.tson the integrated source and the complete frozen base. Both arms passed 3/3, with no identity-guard mismatch observed. This is UNATTRIBUTED / NO_REPRO, not a SQLite fix or inherited-failure certificate. The Testbox had four cores / 16.56 GB RAM; the original CI group declared a minimum of 30,064,771,072 bytes (28 GiB), so hardware/cache equivalence is unknown. No database guard or production identity code changed. All children joined and exact source/index restoration completed; the native exit remained 1 solely to preserve the executed baseline lint failure. Task-only scalar hooks are not in this PR.Fresh canonical review of
d4bb8fb..a5b136ecompleted one pass with 25 whole contracts and no findings, including the sole upstream contract delta. Report SHA-256:5f52d4dd97157159b7e0db1e3de7319f1fe767da985a8218f61aa380bfbb4010. The earlier complete SDK-owner and fixture reviews remain explicitly reused.Required CI on
a5b136ecompleted with one owned failure: the explicit suppression inventory did not yet name the approved JSON-normalization exception. The earlierb00e62fcorrection added only the exact file/rule/count entry and its reason; the collector, strict whole-inventory equality, rules, and production source are unchanged. Exact tree09e7c4dpassed the pinned-Bun tooling file (14/14), one-file canonical lint, and formatting. All managed children joined; native exit 0 and lease settlement were verified. Focused inventory validation.Fresh canonical review of
a5b136e..b00e62fcompleted one pass with 12 whole contracts and no findings. Report SHA-256:de8554591d1bafe58494efd28817dafeb3dbba957aae29fe0a42d01fa49ab95f. Earlier SDK-owner, fixture, and lint reviews are reused for unchanged source. That inventory entry is now supplied by current main. New published-head CI and hosted review remain required.Current required CI run 43846074564 tested merge
49196744287e5082752e33636af33310dc34158a, with ordered parents5c9ef285b21b0ba82ab8843618e6933b3d7002e3and this exact candidate. Its executed checkout log and merge tree were verified. All 94 jobs ended: 55 succeeded, 13 failed (12 root jobs plus the aggregate), and 26 were conditionally skipped. Skips are not passes; PostgreSQL conformance, PG16 Gateway cron smoke, and security-fast actually passed.Ten root jobs failed in the external runner startup hook because its 2,400-start daily quota was exhausted, before checkout or test execution. The required type graphs, central formatting/lint surfaces, and all five core lint stripes passed through the qualified local fallback on exact
dd1c5f9using Node 24.22.1 and the frozen private dependency install. This Darwin evidence is not Linux parity or a full-suite success. The first strict local lint profile remained a failure with nine existing max-lines diagnostics; the later five-stripe run used the original documented GitHub Actions severity policy and passed all nine internal leaves. A cancelled intermediate strict-profile bundle remains incomplete. No rule or source was weakened.The executed post-attach readiness failure is inherited from upstream PR #200038: child-runtime preparation stopped calling
fs.access, while the unchanged two-case fixture still waits at that incidental call. Actual logging fulfills before the stale gate, producingreadiness did not prepare runtime. The relevant fixture and owners are identical in the tested base and merge. Follow-up: gate the original readiness checker preparation boundary, retaining the real implementation and both ready/close assertions.The other executed failure is the fork fixture's long-history setup: it requests 40 identical reads and observes 20 remaining. The existing default repeated-tool guard from PR #199591 stops the twentieth identical call before execution. The fixture, guard, loop and session-policy owners are identical in the candidate, tested base and merge. This is a source-derived attribution matching the observed counter; the raw
tool_repeat_limitterminal receipt was not captured. Follow-up: preserve the repeat guard and the 40-call/history/sender-policy coverage using nonrepeating synthetic work. No production guard or test assertion was changed for these failures.The previous ClawSweeper findings are addressed: the private operation is now
tryDispatchAcpReplyHookCore, and the host no longer imports its capability type from the implementation factory. Required exact published-head CI and a fresh hosted review remain separate landing gates.Executed baseline failures and original reproduction provenance
Two broader checkers retain historical raw failure receipts, with identical results on the complete frozen base
7ecd67ccfd51e2c5aa6673809b69fb318235dd0aand candidate26e88564f23556afbbbdc46882741d1b4a994560. The exclusive counterfactual consumer verified the full base tree and restored the candidate after joined execution. Candidate320c764reported the same findings after the type/export correction:QA_CRON_ONE_SHOT_CHILD_RESULT,QA_CRON_ONE_SHOT_SERVICE_OUTPUT, andQA_CRON_ONE_SHOT_YIELD_OUTPUT. No resolution errors or new findings.These failures are not passing stamps or waived hosted gates. Any required published-head failures still need their normal disposition.
9552a2c84acd4aa87b642823aedd6799b83c460bagainst base618bf31e4e84d5f84c6697f559da4c92689b8cf2. On Darwin arm64, Node 24.22.1 and pinned Bun191755ec115ece3dd642eba3cb0143cecb5e5d7a, each arm passed qaRuntime preparation, the startup/restart context (two files / 86 tests), and the SDK-subpath predecessor followed by the heartbeat target (17 + 1 tests): 104 distinct tests per arm, 208 total. The runner duplicated the heartbeat summary; that duplicate is excluded from these counts. The run finished in 461.833 seconds with strict child joins, no failure-only diagnostic report, and exactb00e62fsource/index restoration. The same two-worker settings and original 15s/90s assertions were retained; three other restart-group files and six earlier heartbeat targets were omitted. This is partial-context macOS evidence, not Linux parity, an inherited-failure certificate, a fix, or a passing hosted-CI result. The original hosted heartbeat and restart failures remain UNKNOWN.The original synthetic RED used frozen C387 plus the diagnostic paths. The repaired old-C GREEN added this repair's 12 production paths and the canonical terminal-flush prerequisite already present in this PR's base from #197510. It is not an identical-input A/B comparison. The earlier SDK-only C overlay omitted that prerequisite and stopped at strict A2 stream equality. The signed
910990fproof above covers the SDK source, unchanged inb84c4c3; the fixture-only correction has separate proof below.This repair does not establish the historical cause of #192560, which is already closed. Retention of an individual lazy inner native graph beyond the observed factory/guard path also remains unproven.
The earlier published
910990fNode shard ended with a 300-second Bun watchdog. A bounded symmetric diagnostic comparison identified the fixture phase-order defect; its baseline arm stalled during Gateway cleanup after an earlier scenario error. The diagnostic included an explicit private-state-directory qualification, and neither it nor the passing focused correction proves the original watchdog’s exact inner cause. No production timeout, authority check, or assertion was weakened.