Repository navigation
fix: activate context engines with distinct plugin and engine IDs - #146018
roboclaw-bot merged 50 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 real behavior proof before merge. What this changesThis PR connects registered context-engine IDs to their plugin owners across installation, activation, updates, Doctor, and removal. Example: Install vendor-plugin declaring and registering canonical-engine.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open: it repairs a current installer/runtime mismatch with accepted product direction, and the previous casing finding is fixed; no new discrete code defect was established. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherPlugin manifests and operator policy enter metadata planning; the loader admits the selected owner, the registry resolves its engine, and installation records retain ownership for lifecycle cleanup. flowchart LR
A[Plugin manifest] --> B[Ownership metadata]
C[Operator plugin policy] --> D[Activation planning]
B --> D
D --> E[Plugin loader]
E --> F[Context engine registry]
F --> G[Conversation turn]
B --> H[Install and removal lifecycle]
Technical reviewBest possible solution: Complete the accepted ownership repair through the existing plugin metadata, admission, registry, and lifecycle owners. Do we have a high-confidence way to reproduce the issue? Yes, current-main source shows installation persisting the plugin ID while runtime resolves the registered engine ID; this review ran no target code. Is this the best way to solve the issue? The accepted metadata-first approach fixes the owning installation and activation boundaries while preserving explicit selections, canonical policy, and exact runtime identities. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7d636d93b8d4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. 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: 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 (20 earlier review cycles; latest 8 shown)
Reviewed October 16, 2026, 1:52 PM ET / 17:52 UTC (Revision 21). |
ba436fd to
a3d302e
Compare
daee1e4 to
2db50b8
Compare
Installed-package Lossless compatibility proof — PASSTested Final Crabbox run and execution record Core upgrade observationVerified installed baseline/candidate bytes against their respective tarballs rather than trusting identical version strings. Created real baseline conversation history through a foreground Gateway and native agent. Replaced the host package and ran offline Eight additional lanes
All eight lanes passed in the final run. Earlier fixture failures are retained as separate attempts; the final result uses the corrected fixture, and no product-code changes were made for this proof. Six native backup archives were collected and independently hash-verified after download. The owned lease was stopped; separate inspection confirmed Exact proof boundaries
This supplies bounded compatibility evidence, not approval of the new public contract or a merge-readiness verdict. Exact-head CI and review remain separate gates. Artifact identities and execution commands
Receipts, task harness, command logs, actual provider requests/tool outputs, prior failed attempts, and backup bundle are retained by the testing operator. The hashes identify those retained artifacts; they do not imply the backups are publicly downloadable. python3 launch.py
# Inside the already-owned sanitized Crabbox:
python3 /tmp/pr146018-proof/harness/run.py \
--inside-owned-sanitized-crabbox \
--candidate /tmp/pr146018-proof/package/candidate.tgz |
|
@clawsweeper re-review New exact-head installed-package Lossless compatibility evidence for |
Regenerate the config baseline for the retained install ownership schema, restore the selected-engine expectation dropped while resolving the merge, and use the install-record writer mock directly now that main removed the local call-argument helper. Co-authored-by: jalehman <[email protected]>
Current-main / CI findings for maintainer takeoverChecked PR head Goal remains validCurrent main still persists the plugin ID during slot selection, while runtime resolves the registered engine ID. Startup/agent scoping similarly treats the selector as a plugin ID; ownership inferred after registration is too late to cold-load a differently named owner. Main has not superseded the accepted declared-owner contract. The install → activation → runtime → update/removal/Doctor scope remains coherent; no new subsystem is warranted.
Concrete repair itemsFrom CI run 39605440099:
Remaining failures: do not assume they are inherited
Verification and proof gapsAfter the local assertion/loader corrections, a frozen replay passed 143 tests / six files, using Still needed: fresh build/affected checks; selected-owner refusal while migration is pending and admission after Doctor; built cold-load/engine-turn and forbidden-owner controls; retained-state upgrade preserving settings, payload, plugin-created data and conversation history. The prior review requested official 2026.10.4; latest stable is now 2026.10.5. No refreshed stable-upgrade run was performed; 2026.9.9 evidence remains historical. No production state/service change or merge performed. |
Main replaced the manifest JSON5 write helper, statically imports persistPluginInstall, and added a shared stale-config hit helper. Inline the manifest fixture write and remove the shadowing locals so lint stays clean. Co-authored-by: jalehman <[email protected]>
Move selected-engine owner admission into the loader cache context that already owns the normalized plugin policy and activation source. This keeps loader-runtime-core within its line budget after the main merge without changing the admission order or the owner captured for registry closures. Co-authored-by: jalehman <[email protected]>
Cover main's pending-state-migration admission for a selected context engine whose plugin ID differs from its engine ID: the owner is named but never imported before Doctor completes, then registers the selected engine. Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Adopt main's consolidated preload and harness tests; keep the declared-owner regression and the metadata fixture its table cases need. Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Released installers stored the plugin ID as plugins.slots.contextEngine. When that plugin registers a different engine ID the selector never resolves and every turn degrades to legacy. Doctor now selects the plugin's single declared engine when the owner is independently eligible, and otherwise keeps the selector and names the engine to set. Co-authored-by: jalehman <[email protected]>
The runtime resolver lets an explicit equal-ID selection bypass enablement and the allowlist. Doctor never received that selection, so a case-equal declared engine must not widen activation on its own. Co-authored-by: jalehman <[email protected]>
Host compatibility inspected the stale plugin-ID selector and warned that it was not registered in the same run that replaced it. Co-authored-by: jalehman <[email protected]>
Host compatibility loaded the plugin whose ID equals the engine ID, so a plugin with a differently named engine was always reported as not registered. Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Take main's generated config baseline; it is regenerated in the next commit. Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…enclaw#146018) * fix: activate context engines with distinct plugin and engine IDs * test: align context-engine fixtures with typed loader APIs * test: exercise fresh install metadata after startup-plan rebase * test: satisfy scoped lint without reducing lifecycle assertions * fix(plugins): require trust for divergent context engine owners * fix: preserve context owner trust and legacy selection behavior * docs: clarify missing linked-plugin uninstall limitation * fix(plugins): exclude ineligible context engine collision claims * fix(plugins): preserve approved context engine ownership * fix(doctor): preserve declared context engine selections * test: refresh context engine fixtures and config baseline * test: isolate context engine fallback policy coverage * test: preserve context engine selection metadata fixtures * fix: reconcile runtime context engine ownership selection * test: approve context engine fixture owners * test: isolate coherent plugin metadata fixtures * test: refresh generated config baseline and fixture formatting * fix: enforce context engine ownership across registry lifecycles * fix: preserve mixed-case context-engine runtime owners * fix: retain exact context-engine owners across runtime scopes * test: align context-engine ownership fixtures with current readers * test: align copied-registry ownership context fixture * fix: retain mixed-case plugin owners through Doctor upgrades * refactor: isolate Doctor provider alias relevance * test: use retained Doctor registry harness after main refactor * test: repair context engine regressions after main merge Regenerate the config baseline for the retained install ownership schema, restore the selected-engine expectation dropped while resolving the merge, and use the install-record writer mock directly now that main removed the local call-argument helper. Co-authored-by: jalehman <[email protected]> * test: align context engine regressions with main test helpers Main replaced the manifest JSON5 write helper, statically imports persistPluginInstall, and added a shared stale-config hit helper. Inline the manifest fixture write and remove the shadowing locals so lint stays clean. Co-authored-by: jalehman <[email protected]> * refactor(plugins): keep context engine owner admission with load context Move selected-engine owner admission into the loader cache context that already owns the normalized plugin policy and activation source. This keeps loader-runtime-core within its line budget after the main merge without changing the admission order or the owner captured for registry closures. Co-authored-by: jalehman <[email protected]> * test: hold divergent engine owners until Doctor migrates their data Cover main's pending-state-migration admission for a selected context engine whose plugin ID differs from its engine ID: the owner is named but never imported before Doctor completes, then registers the selected engine. Co-authored-by: jalehman <[email protected]> * chore: regenerate config baseline after main merge Co-authored-by: jalehman <[email protected]> * fix(doctor): replace legacy plugin-ID context-engine selectors Released installers stored the plugin ID as plugins.slots.contextEngine. When that plugin registers a different engine ID the selector never resolves and every turn degrades to legacy. Doctor now selects the plugin's single declared engine when the owner is independently eligible, and otherwise keeps the selector and names the engine to set. Co-authored-by: jalehman <[email protected]> * fix(doctor): require independent approval before selector migration The runtime resolver lets an explicit equal-ID selection bypass enablement and the allowlist. Doctor never received that selection, so a case-equal declared engine must not widen activation on its own. Co-authored-by: jalehman <[email protected]> * fix(doctor): repair the engine selector before host compatibility checks Host compatibility inspected the stale plugin-ID selector and warned that it was not registered in the same run that replaced it. Co-authored-by: jalehman <[email protected]> * fix(doctor): inspect the declared owner of the selected context engine Host compatibility loaded the plugin whose ID equals the engine ID, so a plugin with a differently named engine was always reported as not registered. Co-authored-by: jalehman <[email protected]> * test(doctor): sort host-compat fixture imports Co-authored-by: jalehman <[email protected]> * chore: regenerate config baseline after main merge Co-authored-by: jalehman <[email protected]> * test(doctor): preserve real selector-migration exports in repair mocks Co-authored-by: jalehman <[email protected]> * chore: regenerate config baseline after main merge Co-authored-by: jalehman <[email protected]> --------- Co-authored-by: jalehman <[email protected]>
Related: #126972
What Problem This Solves
Fixes context-engine plugins selecting or loading the wrong owner when their plugin and engine IDs differ, including mixed-case runtime IDs. Ownership must remain consistent through install, activation, update, Doctor and removal.
User Impact
A plugin's declared engine can be selected without rewriting explicit custom selections or
none. Deny, disable and independent trust requirements remain enforced; ambiguous approved owners fail before runtime import. Existing plugin settings and installation metadata remain under their original owner.Older hosts do not implement this declared-owner activation contract. Downgrade requires compatible config/install state and, when necessary, a matching verified backup. Automatic failed-update rollback is not claimed. Human maintainer review of configuration compatibility is still required before merge.
Upgrade migration: released hosts stored the plugin ID (for example
upgrade-proof-plugin) inplugins.slots.contextEnginewhen a context-engine plugin was installed. With declared engine IDs that selector no longer resolves, so turns would silently uselegacy.openclaw doctornow warns about it, andopenclaw doctor --fixreplaces it with the plugin's single declared engine (replaced plugin ID "upgrade-proof-plugin" with its declared engine "MiXeD-upgrade-proof"). It only rewrites when that plugin is independently enabled or allowlisted and no other eligible plugin declares the same engine; plugins with several engines, unapproved owners and collisions get a warning naming the exact value to set, and config is left unchanged. Engine-ID,legacyandnoneselectors are never touched.Why This Change Was Made
plugins.slots.contextEngineremains an exact engine ID, not a plugin ID. Optional manifestcontextEngineIdsresolves its eligible plugin owner; existing installation records retain ownership metadata for lifecycle cleanup, without a new table, dependency or sidecar store. Runtime owners remain exact while allow/deny/config-entry policy remains canonical.Josh's documented contract acceptance covers selector semantics, manifest metadata, persistence and recovery. This repair preserves contributor history and main's loader, custody and consent owners. It also fixes Doctor's canonical-key/exact-owner join, preserving authored settings paths and matching deferred migration receipts to their actual owner.
Doctor owns the upgrade repair (
src/commands/doctor/shared/context-engine-plugin-id-selector.ts), run before the host-compatibility check, which now inspects the selected engine's declared owner instead of treating the engine ID as a plugin ID.Evidence
Final head 6856951: main
ca2ae0accb74merged (main had inlinedresolveExplicitPluginSelectionShared; the same owner-ID check is re-applied to the inlined branch) and the config baseline regenerated. Since the clean autoreview onae37b75, only mechanical deltas landed: that conflict re-application, the regenerated baseline, and two test-only fixes. The upgrade matrix ran onee56eaf. All runs were secretless Crabbox boxes: public network, Tailscale off, fresh PR checkout pinned to the SHA, no hydration. No production state or services changed.Upgrade matrix, all 4 cells pass (published npm baseline → candidate built from
ee56eaf, real CLI, scripted loopback model provider):2026.10.6,2026.10.4,2026.9.33→ plugin-id-selector: the baseline CLI installs a context-engine plugin and stores its plugin IDupgrade-proof-plugininplugins.slots.contextEngine; a baseline turn runs onlegacy. After the package switch,doctor --fix --non-interactiveexits 0, replaces the selector with the declared engineMiXeD-upgrade-proofand reports the change; a rerun is idempotent; the plugin entry/settings, models and gateway port are unchanged. With the selector restored,doctorwithout--fixwarns and leaves config unchanged, and--fixrepairs it again. The installed plugin payload and plugin-created data are unchanged after Doctor and after the candidate turn, which runs the engine's assembly and carries the retained baseline history.2026.10.6→ retained-legacy: an explicitlegacyselector is left untouched by Doctor; data and history are retained, and selecting the engine afterwards runs it.Checks on
6856951(box treeac3f7faematches the commit; scoped to this PR's 94 changed TS files vs mainca2ae0a):config:docs:check, oxfmt, oxlint, core and core-test type checks and the fullcheck:baseline-ratchetssuite pass; all 39 changed test files, all 114 Doctor test files (src/commands/doctor,doctor-config-flow),repair-sequencing.test.ts(27 tests) and every test file that exercises plugin activation pass. On the prior head the mock-exports ratchet caught the selector-migration mock; it now spreads the real module.Repository lint has one error outside this PR:
ui/src/pages/config/view.tsxis 704 lines against the 700max-lineslimit. That file is byte-identical to maineabadc4.Two UI browser tests,
multi-select.browser.test.ts("does not commit a disabled choice…") andprovider-picker.browser.test.ts("focuses the selected provider…"), failed in a broader run. Both are byte-identical to main and this PR changes noui/orpackages/files. In 6 alternating runs on the same box, unmodified maineabadc4failed 5/6 (both tests) andee56eaffailed 6/6 (provider-picker) and 1/6 (multi-select). They are main's own instability, not from this PR.Hosted CI on the superseded head
c5e1c46failedcheck-test-types-core-1insrc/hooks/loader.cache-invalidation.test.ts, which main broke in9cc4450and fixed in82c4654, and 1 of 467 UI e2e tests (session-progress-live-placement). This PR changes nosrc/hooksorui/files; both shards passed onee56eaf, and the current head includes main's fix.Earlier broad run (head
a606850, ~1,350 test files): two failing files,bundled-plugin-iconsandmarketplace.download.native, also fail on unmodified main (twice each); not from this PR.Scope: Crabbox proof of this PR's contract, not a substitute for full hosted CI. Upgrade proof is external package replacement, not in-process self-update, rollback or production service recovery.
Earlier evidence (heads 92d38ce / a47cd40, before the Doctor migration)
Final source a47cd40, integrated with pinned main 02f671c. Build and runtime/upgrade proof are bound to 92d38ce; the sole later change is two test-helper references in one test file. All production and other files are byte-identical. No production state or services changed.
92d38ce: full build exit 0;dist/index.jsSHA-256947a4571202710cf225172dd2fbe301aa88d903f15de62d8a9f2b046ceb97771. Final-source focused regressions: 293 tests / 16 files passed. This is explicit production-equivalent proof reuse, not a claim of rebuilding the test-only commit.92d38ce: production types, changed-file lint/format and other guards passed; it exited 1 for one test-harness naming defect (now corrected), three UI max-lines suppressions and six unique dead exports. All suppression/export findings were reproduced on exact unmodified pinned main using the same dependency snapshot; the base has twelve unique export findings. The first base scan lacked its UI module link and was discarded, then rerun correctly. No scan was skipped or baseline weakened. Final-source validation passed all 29 selected test-type graphs and targeted test lint; 293 focused tests across 16 files passed.nonepreserves independently approved unrelated capabilities. Scripted loopback Responses provider, not an external LLM.upgrade-proof-plugin; engine isMiXeD-upgrade-proof. Baseline explicitly useslegacywith a no-degradation guard.e448c2850f74b06e795d5a15eda6db1470cee55478b1c5511cb92212776bb525before replacement, after Doctor and after the candidate turn. Both hosts observed the retained public plugin setting; candidate execution was tied to the unchanged installed payload bytes. Candidate cannot seed or repair the baseline sentinel. Baseline user/assistant history retained its exact session key.6a9a4cb661cf62b222f75af834acf5921b06882518a74af1a229461e07046691, installed through normal Socket/age safeguards with scripts disabled. This proves external package replacement, not in-process self-update, rollback, production service recovery or Discord.Proof corrections and limits: published 9.9 does expose
registerContextEngine; an earlier claim that it did not was wrong. Original fixture omitted required startup activation. A corrected mixed-case-owner baseline attempted registration but could not read its configured setting and degraded to legacy; that failed run is preserved and is not counted as upgrade success. The successful working-legacy-owner scenario is complementary; candidate mixed-case-owner behavior and Doctor preservation have their own runtime/regression coverage.Independent native Astra source/integration, exact test-only repair, and scoped runtime/upgrade evidence acceptance passed. Earlier AutoReview CLI failed HTTP 401 and is not counted as review coverage. Exact-head hosted CI/review, current-main reconciliation and human compatibility acceptance remain separate; this is not a maintainer-ready or merge claim.
Owner acceptance
One ownership contract spans installation, runtime and lifecycle cleanup; separating those consumers would leave the original behavior inconsistent. The existing contribution plus its necessary casing/Doctor regressions is 98 files (+3,642/-184) against current main, predominantly tests. No unrelated main-failure cleanup or new dependencies. Strongest evidence is exact-built runtime admission plus real retained-state package-transition proof. Rollback is the prior branch/config together with a matching verified backup, not a promise of transparent downgrade.
AI-assisted implementation and independent review; no merge/release/deployment requested.
Structured execution observations and reproduction notes
These are sanitized excerpts of the recorded results, not operator config or model prompts. Both proofs used Node 26.11.1, built candidate 2026.10.4 and a loopback scripted Responses provider; only synthetic state and credentials.
{ "finalSourceSHA": "a47cd40760e3bb8bf0e03a8ffc7d3b6bbbd82061", "builtAndRuntimeSHA": "92d38ce3ada57a9403a72b17bb8c150b136cdce9", "productionEquivalent": "only later change: two references in one test file", "distIndexSha256": "947a4571202710cf225172dd2fbe301aa88d903f15de62d8a9f2b046ceb97771", "gateway": { "terminalExitCode": 0, "cases": [ { "scenario": "declared-owner", "outcome": "pass", "declaredOwnerEvents": [ "import", "register", "service-start", "factory", "assemble", "commit" ], "legacyOwnerEvents": [], "modelAssemblyMarker": true, "stateRemoved": true }, { "scenario": "approved-collision", "outcome": "pass", "declaredOwnerEvents": [], "legacyOwnerEvents": [], "modelAssemblyMarker": false, "stateRemoved": true }, { "scenario": "denied-legacy", "outcome": "pass", "declaredOwnerEvents": [ "import", "register", "service-start", "factory", "assemble", "commit" ], "legacyOwnerEvents": [], "modelAssemblyMarker": true, "stateRemoved": true }, { "scenario": "noncolliding-none", "outcome": "pass", "declaredOwnerEvents": [ "import", "register", "service-start" ], "legacyOwnerEvents": [ "import", "register", "service-start" ], "modelAssemblyMarker": false, "stateRemoved": true } ], "providerListeningAfter": false }, "upgrade": { "terminalExitCode": 0, "status": "pass", "baselineVersion": "2026.9.9", "pluginOwner": "upgrade-proof-plugin", "engineSelector": "MiXeD-upgrade-proof", "baselineSelection": "legacy, no degradation/register failure", "modelAssemblyMarkerBefore": false, "modelAssemblyMarkerAfter": true, "settingObservedBefore": true, "settingObservedAfter": true, "pluginDataBeforeSha256": "e448c2850f74b06e795d5a15eda6db1470cee55478b1c5511cb92212776bb525", "pluginDataAfterDoctorSha256": "e448c2850f74b06e795d5a15eda6db1470cee55478b1c5511cb92212776bb525", "pluginDataAfterTurnSha256": "e448c2850f74b06e795d5a15eda6db1470cee55478b1c5511cb92212776bb525", "retainedHistorySameKeyAndRoles": true, "candidateHistoryRoles": [ "user", "assistant" ], "providerListeningAfter": false } }Reproduction setup:
[email protected]npm prefix; retain its real lock and normal package-age/security guards. Use fresh isolated HOME/state, free loopback ports, no production credentials, no service/LaunchAgent installation, and external service-repair policy.api.pluginConfig.proofSetting, registers a startup service that creates its own sentinel only in the baseline phase, and registersMiXeD-upgrade-proofwith an assembly hook addingUPGRADE_PROOF_ENGINE_ASSEMBLED. It records registration/service/factory/assembly/commit and a self-file hash so captured execution is tied to installed bytes. No install ledger or plugin data is seeded by the harness.proofSettingtoretained-setting-v1and explicitly selectlegacy. Complete a baseline Gateway model turn and read user/assistant history; reject any registration failure or degraded engine. Verify baseline service execution and its own data before switching.backup create --verify, and externally switch the active package to the exact built candidate. Rundoctor --fix --non-interactive; compare the full plugin entry, source/path/payload, model/provider settings, Gateway port, prior selector and sentinel bytes.config set plugins.slots.contextEngine MiXeD-upgrade-proof. Start the owned candidate Gateway, read the same baseline history, complete another turn, and require the engine's assembly marker in the provider request plus candidate user/assistant history. Compare the sentinel again; candidate cannot create it. Close both owned Gateway/provider processes and verify ports/process cleanup; preserve the isolated upgrade state and backup for inspection.{ "id": "upgrade-proof-plugin", "kind": "context-engine", "contextEngineIds": ["MiXeD-upgrade-proof"], "activation": { "onStartup": true }, "configSchema": { "type": "object", "additionalProperties": false, "properties": { "proofSetting": { "type": "string" } } } }The separate four-scenario fixture selects
synthetic-engineowned byMiXeD-distinct-owner: test the unique declared owner, both independently approved colliding owners, a denied equal-ID legacy owner, and selectionnonewith independently approved unrelated services. Record import markers before checking selected-engine factory/assembly/commit. The structured observations above show what actually ran and what was refused.Relevant executable source regressions include
src/plugins/context-engine-install-lifecycle.test.ts,src/plugins/context-engine-owner-precedence.test.ts,src/plugins/context-engine-owner-lifecycle.test.ts,src/plugins/gateway-startup-plugin-plan.standalone-file.test.ts,src/agents/harness/runtime-plugin.test.ts, and the three Doctor/config migration suites in this diff.