Skip to content

fix: activate context engines with distinct plugin and engine IDs - #146018

Merged
roboclaw-bot merged 50 commits into
openclaw:mainfrom
PollyBot13:fix/context-engine-install-selection
Oct 23, 2026
Merged

roboclaw-bot merged 50 commits into
openclaw:mainfrom
PollyBot13:fix/context-engine-install-selection

Conversation

@PollyBot13

@PollyBot13 PollyBot13 commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

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) in plugins.slots.contextEngine when a context-engine plugin was installed. With declared engine IDs that selector no longer resolves, so turns would silently use legacy. openclaw doctor now warns about it, and openclaw doctor --fix replaces 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, legacy and none selectors are never touched.

Why This Change Was Made

plugins.slots.contextEngine remains an exact engine ID, not a plugin ID. Optional manifest contextEngineIds resolves 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 ca2ae0accb74 merged (main had inlined resolveExplicitPluginSelectionShared; the same owner-ID check is re-applied to the inlined branch) and the config baseline regenerated. Since the clean autoreview on ae37b75, only mechanical deltas landed: that conflict re-application, the regenerated baseline, and two test-only fixes. The upgrade matrix ran on ee56eaf. 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 ID upgrade-proof-plugin in plugins.slots.contextEngine; a baseline turn runs on legacy. After the package switch, doctor --fix --non-interactive exits 0, replaces the selector with the declared engine MiXeD-upgrade-proof and reports the change; a rerun is idempotent; the plugin entry/settings, models and gateway port are unchanged. With the selector restored, doctor without --fix warns and leaves config unchanged, and --fix repairs 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 explicit legacy selector is left untouched by Doctor; data and history are retained, and selecting the engine afterwards runs it.
    • Doctor output after the fix includes main's existing informational notice that offline host-compatibility inspection is unavailable for the runtime-registered engine; the earlier "could not inspect … not registered" warning now appears only in the preview, while the selector still names the plugin.
  • Checks on 6856951 (box tree ac3f7fae matches the commit; scoped to this PR's 94 changed TS files vs main ca2ae0a): config:docs:check, oxfmt, oxlint, core and core-test type checks and the full check:baseline-ratchets suite 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.tsx is 704 lines against the 700 max-lines limit. That file is byte-identical to main eabadc4.

  • Two UI browser tests, multi-select.browser.test.ts ("does not commit a disabled choice…") and provider-picker.browser.test.ts ("focuses the selected provider…"), failed in a broader run. Both are byte-identical to main and this PR changes no ui/ or packages/ files. In 6 alternating runs on the same box, unmodified main eabadc4 failed 5/6 (both tests) and ee56eaf failed 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 c5e1c46 failed check-test-types-core-1 in src/hooks/loader.cache-invalidation.test.ts, which main broke in 9cc4450 and fixed in 82c4654, and 1 of 467 UI e2e tests (session-progress-live-placement). This PR changes no src/hooks or ui/ files; both shards passed on ee56eaf, and the current head includes main's fix.

  • Earlier broad run (head a606850, ~1,350 test files): two failing files, bundled-plugin-icons and marketplace.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.

  • Built production at 92d38ce: full build exit 0; dist/index.js SHA-256 947a4571202710cf225172dd2fbe301aa88d903f15de62d8a9f2b046ceb97771. 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.
  • Broad changed-file lane completed at 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.
  • Four built-Gateway cases passed with direct helper exit 0: distinct engine with mixed-case owner executes assembly/commit; independently approved owner collision rejects before either import; denied legacy owner is not imported; selecting none preserves independently approved unrelated capabilities. Scripted loopback Responses provider, not an external LLM.
  • Published stable 2026.9.9 → candidate upgrade passed: real CLI plugin installation and execution, a baseline conversation, verified backup, stopped owned foreground Gateway, external package switch, full Doctor, retained settings/install record/payload/plugin-created data/history, then public CLI selection and an actual turn using the distinct mixed-case engine. Baseline owner is upgrade-proof-plugin; engine is MiXeD-upgrade-proof. Baseline explicitly uses legacy with a no-degradation guard.
  • Plugin-created data SHA-256 was e448c2850f74b06e795d5a15eda6db1470cee55478b1c5511cb92212776bb525 before 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.
  • Baseline is the official integrity-verified npm package, frozen lock SHA-256 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:

  1. Build the pinned production commit using its frozen dependencies and pinned pnpm 12.10.1. Use a separate verified official [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.
  2. Through the baseline CLI, onboard and install a local plugin with the manifest below. Runtime registration reads api.pluginConfig.proofSetting, registers a startup service that creates its own sentinel only in the baseline phase, and registers MiXeD-upgrade-proof with an assembly hook adding UPGRADE_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.
  3. Configure the synthetic model provider, set proofSetting to retained-setting-v1 and explicitly select legacy. 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.
  4. Stop the owned Gateway, run backup create --verify, and externally switch the active package to the exact built candidate. Run doctor --fix --non-interactive; compare the full plugin entry, source/path/payload, model/provider settings, Gateway port, prior selector and sentinel bytes.
  5. Run 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-engine owned by MiXeD-distinct-owner: test the unique declared owner, both independently approved colliding owners, a denied equal-ID legacy owner, and selection none with 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.

@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes agents Agent runtime and tooling size: XL labels Sep 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This 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.

  • Before: Installation selects vendor-plugin, but runtime searches for an engine registered under that name and falls back to legacy.
  • After: Installation selects canonical-engine and activates its independently approved owner, vendor-plugin.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, accepted repair with substantial production-path evidence and no established new code defect; compatibility coverage and exact-head CI attribution remain incomplete.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Installing a plugin whose engine ID differs from its plugin ID can select an unavailable engine and silently use legacy context handling.
Reason: The defect remains in owned source, and the recorded owner decision accepts the manifest, selection, persistence, and recovery contract.

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
Reviewed head: a47cd40760e3bb8bf0e03a8ffc7d3b6bbbd82061

Before merge

  • Add real behavior proof - The full body supplies built-Gateway execution observations for the changed owner and forbidden-owner cases, plus a retained-state 2026.9.9 package transition; the required latest-stable upgrade cell is absent. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Complete next step - Obtain the four failed Node-shard diagnostics and compare their failures with the pinned base; repair only failures attributable to this PR.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a retained-state upgrade transcript from official 2026.10.4 through Doctor and an actual selected-engine turn, with credentials, IPs, and non-public endpoints redacted.
Agent review details

How this fits together

Plugin 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]
Loading

Technical review

Best 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

  • Disabled-engine selection and fallback keeps the original intent (bedec37: Prevent disabled or denied selections from producing degradation and quarantine while retaining their slot preference.)
  • Canonical policy versus exact runtime identity keeps the original intent (4cdbab7: Resolve policy through canonical lowercase keys while preserving case-sensitive manifest and package identities.)
  • Implicit slot defaults keeps the original intent (3b6fc03: Keep default slot owners implicit rather than unnecessarily persisting default selections.)
  • Plugin capability consent keeps the original intent (0dbd5c8: Bind capability acceptance to the reviewed artifact and recheck after interactive consent yields.)
  • Deferred plugin migrations keeps the original intent (dac3cb6: Keep unavailable-owner work pending without blocking recovery or overwriting protected configuration.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main retains the central mismatch: Current-main slot selection passes plugin.id to applyExclusiveSlotSelection, which persists selectedId; registration separately uses the supplied engine ID. The divergent-ID installation defect remains. (src/plugins/slot-selection.ts:51, 7d636d93b8d4)
  • Previous exact-owner finding repaired: Eligibility checks canonicalize policy identities while returning exact manifest IDs; the loader now records plugin:MiXeD-demo rather than its lowercase policy key. New loader, startup, runtime-selection, and Doctor regressions cover this separation. (src/plugins/loader-runtime-core.ts:348, a47cd40760e3)
  • Recorded contract acceptance: Josh Lehman's recorded acceptance covers engine-ID selectors, optional manifest declarations, retained install metadata, independent approval, collision handling, and backup-based downgrade recovery: fix: activate context engines with distinct plugin and engine IDs #146018 (comment). The current repair preserves those semantics; final merge approval is separate.
  • Production-equivalent proof reuse verified: The recorded built-Gateway observations exercise mixed-case declared ownership through assembly and commit, reject approved collisions before imports, exclude a denied legacy owner, and preserve unrelated capabilities with none selected. The final commit changes only two test-helper references relative to the built revision. (src/plugins/doctor-contract-registry.selection.test.ts:390, a47cd40760e3)
  • Upgrade evidence has an older baseline: The full PR body records an official 2026.9.9 package transition preserving settings, installed payload, plugin-created data, and conversation history. GitHub identifies v2026.10.4 as the latest stable release. Historical Lossless compatibility evidence from jalehman remains credited but covers an earlier candidate and baseline.
  • Exact-head CI failures remain unclassified: Failed checks report unprepared runtime configuration in tools-invoke-http and incognito session controls, retained callback capture in runtime retirement, and another failed Node shard without a diagnostic annotation. No matching base failure or head-versus-revert comparison established attribution. Job logs redirected to a blocked storage host, so these are not asserted to be patch-caused defects. (a47cd40760e3)

Likely related people:

  • Josh Lehman: Raw commit bedec37 adds src/context-engine/registry-selection.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bedec37a2939; files: src/context-engine/registry-selection.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Public metadata additions 1 optional manifest field and 1 retained install-record field contextEngineIds enables cold owner discovery; contextEngineIdsByPlugin supports lifecycle cleanup when runtime files are unavailable.

Root-cause cluster

Relationship: same_root_cause
Canonical: #126972
Summary: The canonical issue reports the installer-to-runtime identifier mismatch that this PR repairs; the merged neighboring fixes address distinct policy and casing failures.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The mismatch affects plugins with divergent engine and plugin IDs; legacy fallback limits runtime availability impact.
  • merge-risk: 🚨 compatibility: The patch extends the public manifest and persisted installation contract; the recorded owner decision explicitly accepts its downgrade and recovery limitations.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (20 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-18T01:03:09.137Z sha cc087cfaf457294c5c9eed0034b6f1c9e11fbe2c :: blocked before merge. :: none
  • reviewed 2026-09-23T20:56:00.188Z sha cc087cfaf457294c5c9eed0034b6f1c9e11fbe2c :: needs real behavior proof before merge. :: [P1] Reject approved legacy and declared engine collisions before import
  • reviewed 2026-09-24T23:41:37.859Z sha 10e9fa3 :: needs real behavior proof before merge. :: [P1] Reject equal-ID owner collisions before plugin import
  • reviewed 2026-09-30T21:49:50.483Z sha ea1fe3a :: needs real behavior proof before merge. :: [P1] Reject equal-ID owner collisions before module import
  • reviewed 2026-10-07T20:17:17.456Z sha 7e8ca29 :: blocked before merge. :: none
  • reviewed 2026-10-07T21:05:27.732Z sha f45bd2a6ad6b7b7fc8eb2bf374ce95df2fe5529f :: blocked before merge. :: none
  • reviewed 2026-10-07T21:26:46.055Z sha f45bd2a6ad6b7b7fc8eb2bf374ce95df2fe5529f :: blocked before merge. :: none
  • reviewed 2026-10-10T17:34:49.151Z sha 34f8938 :: blocked before merge. :: [P1] Preserve exact runtime casing for selected engine owners

Reviewed October 16, 2026, 1:52 PM ET / 17:52 UTC (Revision 21).

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Sep 12, 2026
@PollyBot13
PollyBot13 force-pushed the fix/context-engine-install-selection branch from ba436fd to a3d302e Compare September 12, 2026 15:10
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Sep 12, 2026
@PollyBot13
PollyBot13 force-pushed the fix/context-engine-install-selection branch from daee1e4 to 2db50b8 Compare September 14, 2026 09:05
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Sep 14, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 14, 2026
@jalehman jalehman self-assigned this Sep 16, 2026
@jalehman

Copy link
Copy Markdown
Contributor

Installed-package Lossless compatibility proof — PASS

Tested 17343ce69fbee21a081e183d6257ea16c6c1ba4b, still the PR head at publication preflight, on an isolated AWS Crabbox Linux host. Baseline: published OpenClaw 2026.9.4. Plugin: published @martian-engineering/[email protected].

Final Crabbox run and execution record

Core upgrade observation

Verified 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 doctor --fix --non-interactive; without reinstalling Lossless, the unchanged published plugin retrieved the original pre-upgrade user-message hit using real lcm_grep. Doctor preserved the independent LCM database bytes.

Eight additional lanes

Lane Observed result
Metadata-only adoption Reinstalling a fixture that adds only contextEngineIds preserved explicit selection and historical lcm_grep recall.
Explicit none Selection survived reinstall and a real agent turn; this does not assert that every plugin tool disappears.
Explicit disablement enabled: false survived reinstall; Gateway health excluded Lossless and an agent turn completed.
Custom engine Actual synthetic custom-engine projection reached the provider before and after the Lossless metadata-fixture reinstall.
Explicit trust denial After normal installation consent, explicit deny excluded the synthetic owner without registering it; incumbent Lossless recall still worked.
Owner collision A distinct admitted synthetic owner attempting the core-reserved legacy ID produced the owner-rejection diagnostic; real legacy execution completed without invoking its factory.
Older-reader refusal Byte-verified baseline host refused naturally migrated candidate state with an explicit newer-schema diagnostic.
Cold-backup recovery Matching baseline host plus byte-verified pre-upgrade full-HOME backup restored actual historical Lossless user-message recall.

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 released / cleanup complete.

Exact proof boundaries

  • Actual packages, Gateway, native agent runtime, plugin, database, and tool execution; model Responses replies were scripted locally, not a live model-provider test.
  • Package replacement plus explicit offline Doctor migration, not the public updater driver or automatic rollback.
  • Metadata adoption used an isolated modified copy of published Lossless, not a newly published plugin release.
  • Custom-engine fixture is stateless, consumes host-fenced messages, and implements a side-effect-free idempotent commit; selection/projection proof, not persistent-engine durability proof.
  • Trust coverage is explicit deny after consent, not package-signature/provenance validation. Collision coverage is the core-reserved ID, not arbitrary third-party collisions/discovery ordering.
  • Recovery uses the matching host plus cold full-HOME backup, not the native backup-restore driver. Linux only.

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
  • Candidate tarball SHA-256: 439cfd3c89f72375b76a995493997090e078212c6d8601834e6ab39a21d45aad
  • Final evidence archive SHA-256: a0aa97fbf410d823bc1da727b2a90e3492df035fbc1a8489574329be752092fe
  • Native backup bundle SHA-256: be25272c1165e61814d132f61fcc1e56723ab12d37388e837898e4b07ff841d1

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

@jalehman

jalehman commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

New exact-head installed-package Lossless compatibility evidence for 17343ce69fbee21a081e183d6257ea16c6c1ba4b: #146018 (comment) . Core upgrade plus eight variants passed; proof boundaries are explicitly recorded. Please reassess the compatibility/proof bookkeeping against this evidence. Update: Josh Lehman has explicitly accepted the documented contract and authorized recording it at #146018 (comment) . Please include that decision in the reassessment. Exact-head CI/review remain required; merging is not authorized.

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]>
@PollyBot13

Copy link
Copy Markdown
Contributor Author

Current-main / CI findings for maintainer takeover

Checked PR head 6ffdb5fb56b258f141bb6a8dc44f970f7ad90f42 against main b394c808166c34025161660fdc5ed6449433a14d on October 21. I have stopped branch work for the maintainer takeover. The local corrections below have not been committed or pushed.

Goal remains valid

Current 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.

6ffdb5f already integrates main ed9d49310490; the preview against checked main was conflict-free. Main's new async migration admission is material: old 92d38ce build/runtime evidence does not cover this integration.

Concrete repair items

From CI run 39605440099:

  1. Syntax: effective-plugin-ids.test.ts:91 ends toEqual([ without "lossless-claw", and closing ]);. All five test-type stripes report this same syntax error; several guard failures are collateral, not separate type defects.
  2. Loader line cap: loader-runtime-core.ts has 732 counted lines against 700. My local correction moves the existing ownership admission/selection block into the existing applyContextEngineOwnership load-context method and returns its selected owner. This preserves rejection before imports, without suppression or another owner abstraction.
  3. Formatting/generated docs: format src/config/io.deferred-plugin-migrations.test.ts, then run pnpm config:docs:gen. Local generation changed aggregate/core hashes; counts and channel/plugin hashes stayed unchanged.

Remaining failures: do not assume they are inherited

  • Gateway/Doctor failures reject agents.defaults.heartbeat. Upstream ec5d369a6f664c46e8faf5199b5d85c2cca3e6f6 (feat(automations): migrate heartbeat jobs through Doctor #179387) intentionally removed the schema key, while fixtures including models-list.worker-recovery.integration.test.ts and doctor-lint.plugin-path-inspection.test.ts still author it. This is upstream source evidence, not completed baseline runtime reproduction: my main replay stopped before collection on a missing quickjs-wasi dependency link. Do not resurrect the retired schema key to accommodate stale fixtures.
  • models.prepared.test.ts:146: 650 policy calls versus limit 10. subagent-registry-lifecycle.test.ts:1060: one remaining timer versus zero. Both remain unattributed; unchanged paths alone do not prove base failures.
  • UI performance and max-lines/baseline findings also remain unclassified for this head. No blanket “remaining reds are main” conclusion.

Verification and proof gaps

After the local assertion/loader corrections, a frozen replay passed 143 tests / six files, using node scripts/run-vitest.mjs <files> --maxWorkers=1: effective-plugin-ids, config-state, context-engine-owner-precedence, context-engine-owner-lifecycle, context-engine-install-lifecycle, and agents/harness/runtime-plugin. This is corrected-local-tree evidence, not published-head success. The earlier run was invalidated by a concurrent lockfile restoration and discarded.

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.

roboclaw-bot and others added 16 commits October 21, 2026 13:32
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]>
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]>
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]>
Take main's generated config baseline; it is regenerated in the next commit.

Co-authored-by: jalehman <[email protected]>
@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) October 23, 2026 16:50
@roboclaw-bot
roboclaw-bot disabled auto-merge October 23, 2026 17:08
@roboclaw-bot
roboclaw-bot merged commit 53fb615 into openclaw:main Oct 23, 2026
165 of 168 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 24, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants