Repository navigation
fix(agents): keep retained plugin completions working after reload - #161908
roboclaw-bot wants to merge 2 commits into
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. Reviewed September 30, 2026, 2:26 PM ET / 18:26 UTC (Revision 7). ClawSweeper reviewWhat this changesThe branch moves new plugin and text-to-speech completion selection into the admitted runtime generation and checks the selected model against policy before provider use. Merge readiness✅ Ready for maintainer review The reported failure remains possible on current main, and the earlier fix PR closed without merging. This branch remains a viable fix candidate. The previous SQLite concern no longer applies to its introduced or test-merge changes. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway supplies plugins with model completion capabilities. A completion selects a model from the current plugin runtime, prepares its credentials and transport, then sends a request to the provider. flowchart LR
A[Plugin completion request] --> B[Current runtime admission]
B --> C[Model selection]
C --> D[Caller and model policy]
D --> E[Model and credential preparation]
E --> F[Provider request]
F --> G[Completion result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -25, Tests +496. Total +471 across 15 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Use one host-owned admission path for new completions after reload, preserve already prepared work, and enforce current caller and model policy at provider dispatch. Do we have a high-confidence way to reproduce the issue? Yes. Current main retains the pre-admission selection path, and the linked report records a retained-generation failure and fresh-admission control. I did not execute that reproduction in this read-only review. Is this the best way to solve the issue? Yes. Selection now occurs in the lease owner's post-replacement admission, and the admitted target is checked before provider dispatch. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a83c49bf6374. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
Real Gateway reload proof — passedVerified on
Contract clarification: the earlier plan called this This supplies the same-session Gateway trace requested by the two proof items and Rank-up move in the current ClawSweeper review. Named follow-ups retained in the public evidence: reload emitted an 11-exit-listener warning (shutdown still completed); build emitted a largest-JS gzip diagnostic (217.1 vs 215.0 KiB). Attribution is uninvestigated; neither is claimed repaired or caused by this PR. No merge or auto-merge enabled; old PR untouched. |
A fresh direct completion running inside a retained context-engine scope inherits that scope's plugin generation. After a plugin operation publishes a replacement inventory and retires the predecessor cache, a new completion in the retained scope selected the retired snapshot and failed in retainPluginCache before reaching the provider. Admit the completion against the committed inventory instead: select metadata and prepare the generation outside the inherited frame, then re-enter the admitted generation explicitly for model materialization. Caller authority, cancellation, drainage, and the retirement guards are unchanged. Because plugin generation replacement can also remap the requested model, the plugin LLM caller now validates the model it actually admitted against the host and operator completion policies, and against the override policies when the caller requested a model, before provider I/O instead of only validating the target it saw when the request started. Fixes #156026 Co-authored-by: jalehman <[email protected]>
Replay the reviewed completion repair on main d4ecb67. Preserve the admitted selection/config recipe, selected metadata projection, canonical-target policy, TTS responding-agent routing, and separate provider-stream transport. Retain the completion bytes from c22802f, 6655e8b, 0d0c5ba, and e97b0b7; all fifteen remaining paths match prior head 83e4fc9 exactly. The original contributor patch is the preceding human-authored commit; its alternate 4915264 form was reconciled in that replay. Drop the incidental SQLite commit 83e4fc9. Current main already owns unavailable-cwd launch behavior through 8e30378. No SQLite or archive-fixture delta remains. Original contribution: wangmiao0668000666 (PR #156053). Co-authored-by: jalehman <[email protected]>
83e4fc9 to
51aa2cd
Compare
What Problem This Solves
Fixes: context engines and other retained plugins lose new model completions after another plugin reloads, or select stale model metadata while a reload is completing.
Closes #156026. Replaces #156053, which its contributor closed; that PR and its fork branch remain untouched.
User Impact
Retained plugin consumers can request new completions after reload. The admitted model must still satisfy host and operator policy before provider dispatch. No configuration, schema, migration, or operator action is required.
Why This Change Was Made
The existing prepared-runtime lease now derives each new completion's selection after pending replacement finishes. Selection and admitted config stay together; execution receives the selected metadata view, not the entire planning inventory. Existing prepared completions retain their original ownership. Caller authority, cancellation, drainage, and retirement guards are preserved.
Direct completion policy checks the admitted canonical target before model/auth preparation and before dispatch, without applying aliases twice. Current provider normalization and isolated-runtime behavior remain supported. Main integration preserves TTS responding-agent routing and the separate provider-stream transport path.
The requested rebase adopts current main’s SQLite launch owner unchanged, including Peter’s upstream fix
8e303782bb5677edbb27c77c222b568fb692dbbf. All incidental SQLite production and test changes have been removed from this PR. The separate updater PR #161916 remains untouched; this PR makes no independent cwd fallback, canonical-auth, update, or storage decision.Original implementation and contributor credit: @wangmiao0668000666. Reproduction, follow-up repair, and this maintainer-owned replacement were requested by @jalehman. The original human-authored completion patch is replayed with its author preserved; the reviewed maintainer repairs embedded in earlier merge commits are retained in a separate completion-repair commit. The former head remains recoverable.
Work sessions
Evidence
51aa2cd2eaf71b8a98bc063f5c57e86e8173e790; treef49117cab5188d1a4955e922424d7eadc911c8c2, pinned maind4ecb67706fa64d6eb1a8b94196f4526c7ed6e34. All 15 remaining completion source/test blobs are byte-identical to prior head83e4fc9aab02b6a217cde7762e26c2cb170b581a; all SQLite paths and the archive fixture match pinned main exactly. No merge or auto-merge is requested or enabled.pnpm buildpassed in 9m37s, including runtime and SDK declarations. Bootstrap verified the public/no-IAM boundary (IMDS 404), exact source SHA/tree and pinned toolchain in fresh HOME; no contributor code ran on the host. New-head CI run attached automatically and is in progress; no current-head green CI is claimed. Proof leasecbx_edbc69a60d5fis released; broker readback reports cleanup complete,provisioningResourceMayExist:false, and no owned resources in provider inventory.83e4fc9aab02b6a217cde7762e26c2cb170b581a. It is not new-head CI. The initial updater failure and the former branch’s SQLite experiments are historical evidence only; that authored repair and its regression were dropped in favor of current main. Upstream8e303782records its own 492 passing tests and an inherited Windows SIGINT failure; neither that failure nor its proof is relabeled as this PR’s result.60b0421: scoped-clean at P0–P2, exit 0. Reused for this patch-identical completion rebase: stable patch ID036bd4df56dd678c496e6df007d1e3d11536950f, all 15 source/test blobs equal, and base-input review confirms completion owners, generation scope, caller authority, provider transport, and dependency pins unchanged. The current maintainer workflow does not require another review for a patch-identical rebase. Earlier rejected private-helper/shorthand findings were checked against actual callers and admitted selection ordering, not silently counted as clean.60b0421: 162 cases across 11 affected-sibling files passed (123.36s summed shard wall), including real TTS responding-agent selection, worker transport construction exactly once, scoped metadata, retirement, alias remapping, and runtime policy. All selected changed gates, production types and all 27 test-type graphs passed on the same tree; formatting/lint reported zero errors and import-cycle scan found zero cycles. The requested post-CI real Gateway reload proof is now attached below. No merge is requested or enabled.SQLite review reconciliation: the prior review’s four overlapping owner/upgrade items and optional Rank-up move concerned this PR’s now-removed SQLite delta. Current main supplies the canonical behavior unchanged; no third fallback or copy of #161916 is introduced. A new published-updater × candidate cell is not claimed or added solely for removed changes. The remaining plugin contract is new completion admission during an already-running Gateway reload, not installation, stored-state migration, or the installed updater; its unchanged real Gateway proof and new-base focused completion/alias/TTS validation cover that contract.
Prior-head real Gateway reload proof — passed. Built the
83e4fc9aab02bdist-backed Gateway, ran an ordinary agent turn, changed another plugin and called actualplugins.reload, then ran a second turn in the same session. Observed 2 primary + 2 post-turn summary HTTP requests, expected model, unchanged context-engine registration UUID/session ID/Gateway PID, committed generation 3, andrestartRequired:false. Both turns have no fallback/reroute; logs contain no context-engine degradation, quarantine, or retired-inventory error. The linked comment includes the public broker artifact manifest, actual commands, replies, logs, reload receipt and cleanup receipt (broker artifact links expire October 7, 2026). Synthetic loopback SSE inference is not live vendor-authentication proof.Lifecycle clarification: ordinary durable Gateway turns in the prior-head proof use documented
commitTurn+maintain, not the earlier plan’safterTurncompatibility hook. The fixture follows that current contract and calls the host-suppliedruntimeContext.llm.completeafter each accepted turn. No direct retirement/generation helper or manually invoked host hook substitutes for the real flow. Harness-only corrections are recorded in the evidence; that proof’s product source and green CI head did not change. The subsequent rebase preserves all completion blobs, but this trace remains explicitly prior-head evidence. AWS leasecbx_c359814f0bedis released, cleanup complete, no resources remain; Gateway/provider stopped.Named proof follow-ups: an 11-process-exit-listener warning appeared during reload, followed by clean shutdown; build’s UI-size diagnostic reported largest JS gzip 217.1 vs 215.0 KiB. The rebased full build also emitted the existing nonfatal UI-size diagnostic (largest JS gzip 216.6 vs 215.0 KiB and startup CSS advisory); no UI files are in this PR. These diagnostics remain visible in the evidence, with attribution uninvestigated. No unrelated source changes were made.
Session: https://team.openclaw.ai/chat/roboclaw/dashboard/bcef8911-1685-40e7-8c68-67e3e928150b