Repository navigation
fix(agents): plugin completions fail after another plugin reloads - #168916
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 makes new model completions select the committed plugin inventory instead of inheriting a retired generation. Example: A retained lossless-claw context engine requests a summary after the knowledge plugin reloads.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: current main still supports the reported retired-inventory failure, and the focused shared-owner repair has no actionable introduced defect. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe shared completion owner receives model-selection requests from plugins, SDK callers, TTS, and approval helpers, then acquires model, credential, and transport facts for provider execution. flowchart LR
A[Retained plugin context] --> B[New completion admission]
B --> C[Committed plugin inventory]
C --> D[Prepared model lease]
D --> E[Caller and model authorization]
E --> F[Provider request]
F --> G[Completion result]
Technical reviewBest possible solution: Admit new completions against the committed inventory while preserving prepared leases, caller authority, cancellation, and retirement safeguards. Do we have a high-confidence way to reproduce the issue? Current main supports the retained-context → immutable old metadata → retired-cache rejection path, matching the linked failure/control probe; this read-only review ran no target code. Is this the best way to solve the issue? The patch repairs fresh admission in the existing shared owner and preserves the prior generation-pinning and selected-model contracts, avoiding separate fixes in each consumer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b77568da4848. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +21, Tests +157, Docs 0, Other -2. Total +176 across 6 files. Added test files: 1. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 11, 2026, 1:51 AM ET / 05:51 UTC. |
First-parent upstream 75df19c..5ed6a30 (23 commits, including openclaw#169005 infrastructure SQLite work and runtime-write offload, openclaw#169062, openclaw#136677, openclaw#169070, openclaw#168857 plugin-sdk SQLite runtime writes into workers, openclaw#169038, openclaw#168916, openclaw#169053, openclaw#169052 closed-turn transcript work in workers, openclaw#168974, openclaw#168811, openclaw#169082, openclaw#169084, openclaw#166581 worker heap limits). Conflicts: - openclaw-state-worker-runtime.ts: upstream routes more update-run mutations to the worker; our continuation custody dispatch stays ahead of that branch. - worker-access inventory: regenerated (632 files, 2429 calls). server-restart-sentinel.ts auto-merged: upstream's awaited update-run writes; our continuation restart delivery is unaffected. Refs #1475 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #156026
What Problem This Solves
Fixes: an unchanged plugin's
api.runtime.llm.completefails withPlugin inventory has retired; begin a new plugin operation.after the Gateway hot-replaces a different plugin.User Impact
Context engines such as lossless-claw keep summarizing after an unrelated plugin reload instead of failing until the Gateway restarts. No configuration or operator action is required.
Why This Change Was Made
Replacement keeps unchanged plugin instances and their original
api;api.runtime.llmis not bound to an inventory. The failure comes from the ambient async context. A context engine restores theAsyncLocalStoragesnapshot captured when its factory resources were created, which carries the earlier turn's plugin runtime generation. A new completion started from that context resolved metadata from the retired inventory, andretainPluginCacherejected it before reaching the provider.Simple-completion acquisition now starts each new completion outside the inherited generation scope, the same boundary that #151232 applied to compaction admission. Caller authority, invocation scope, cancellation, drainage, and retirement checks are unchanged. Already-prepared completions keep their own lease. Because the fix is in the shared acquisition owner, it also covers the plugin SDK
prepareSimpleCompletionModelForAgent, exec auto-review, TTS summaries, and approval intent.This is a smaller replacement for #161908, which has gone stale against main. The docs now state that retained instances are not registered again and that plugin-wide runtime capabilities select the committed inventory per call.
Evidence
Plugin replacement applied: knowledgeat 08:44:41, then lossless-claw background compaction failed at 08:45:35 with the retired-inventory error fromretainPluginCache.src/plugins/runtime/runtime-llm.retained-generation.test.tsloads a provider plugin through the real loader and publishes a Gateway inventory. It createsContextEngineFactoryResourcesunder an admitted turn generation, then publishes a replacement inventory and retires the old cache. Finally it calls the realcreateRuntimeLlm().complete()from the retained engine context against a loopback SSE provider.Plugin inventory has retiredatretainPluginCache←prepareWorkspaceBuildGroup←buildSnapshotBatch, the same stack as the live failure.pnpm test <file> --maxWorkers=1takes 35.8 s wall time, mostly transform. Expect a few CI seconds.simple-completion-runtime{,.generation,.plugin-scope,.selected-model,.selection},runtime-llm.{runtime,prepared-owner,oauth-model.integration,operator-model-policy},exec-auto-reviewer*,approval-intent*,tts-summary*,tts-core.summary-agent,plugins/commands, andcompact.delegate-resources.pnpm check:changedpassed every ratchet. The first-party mock-export baseline shrank by two exact entries because the touched mocks now document their isolation.typecheck coreandtsgo:core:testreport only the inherited main errorsrc/cli/gateway-cli/run-loop-startup.test-support.ts(380,13)from fix: restore channel startup after stopped Tailscale failures #162266; this branch adds no new type errors.format:docs:checkandlint:docspass.--mode branch --base origin/main --max-priority P2) is scoped-clean.server-plugin-reload.tsitself.