Skip to content

fix(plugins): keep development runs on checkout plugins - #132201

Merged
steipete merged 3 commits into
mainfrom
steipete/dev-mode-trusted-error-f572f4
Aug 29, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/dev-mode-trusted-error-f572f4

Conversation

@steipete

@steipete steipete commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #132171

What Problem This Solves

Fixes an issue where developers running OpenClaw from a checkout could hit openSyncKeyedStore is only available for trusted plugins because a tracked global plugin copy won over the checkout's compiled plugin. Aliasing the exact same bundled entry through a configured path could also discard its provenance. The isolated live reproduction produced the reported Codex/global-origin error in the Control UI.

Why This Change Was Made

Development selection belongs to the loader, not a capability bypass. The source runner now supplies the existing checkout selector; the shared host-root containment check covers source, dist/extensions, and dist-runtime/extensions; physical aliases retain independently established bundled provenance while preserving explicit path priority. Cache identity and persisted-index validation account for the selector. Manifest selection is the single duplicate-precedence owner; the redundant runtime ranking is deleted.

The runtime state trust gate is unchanged. No new config or environment option, dependency, SQLite schema/format, or protocol surface is added. Arbitrary links, local archives, npm-pack: artifacts, official-looking names, and allowlists do not gain trusted capabilities. Explicit overrides to different code retain their existing priority and trust policy; active metadata remains immutable until its existing reload boundary.

User Impact

Checkout development uses the intended local plugin build without requiring an npm publication or weakening production trust. Built output stays preferred, source-only plugins remain available, and the docs now describe the actual development and override behavior.

Release-note context: repair development plugin provenance so local Codex chat and other guarded plugin-state consumers are not accidentally routed through an untrusted global shadow. Reported and directed by @steipete; AI-assisted implementation and independent Codex review.

Evidence

Live before/after, real Gateway and provider: fresh isolated home/config/state and a non-operator port; a separate physical copied Codex package recorded through the canonical install-record owner created the tracked global shadow. The frozen pre-fix runtime reproduced the exact state-access denial. The repaired runner's plugins inspect codex --json selected <checkout>/dist/extensions/codex/index.js with origin: bundled. A real API-backed openai/gpt-5.6-luna chat returned DEV_TRUST_OK, created one durable native binding, and after Gateway restart returned the distinct DEV_TRUST_RESTART_OK on the same native thread. No operator Gateway or state was changed.

The live Gateway ran through the documented built entry with OPENCLAW_DEV_SOURCE_ROOT after the source runner's selection was verified separately. This separated build from execution after two source-backed proof commands raced to rebuild the dirty checkout; that setup failure was corrected before the successful recording. No provider/channel mock, fabricated response, state-trust override, or test-only bundle-root bypass was used in the live flow.

Focused verification:

node scripts/run-vitest.mjs src/plugins/discovery-checkout.test.ts src/plugins/plugin-registry-snapshot.test.ts src/plugin-state/plugin-state-store.runtime.test.ts

Independent final rerun: 51 passed. Broader owner/sibling runs passed: launcher/discovery/manifest/bundled roots (341), snapshot/control-plane/lifecycle (80), loader/SDK/state/hooks/ingress/metadata (374; one existing Windows-only skip). Counts overlap and are not a unique total. The initial unmodified-production regression run failed five boundary cases; the source-runner default-selector regression also failed before repair. Explicit override order and stale snapshot cases caught intermediate errors and pass on the final implementation.

node scripts/check-changed.mjs

Passed core, core-test and script typechecking; lint/format; plugin and metadata boundaries; database-first/schema guards; and runtime import cycles (zero). An initial test fixture type annotation and two test-only lint findings were corrected before the successful final gate.

OPENCLAW_BUILD_CACHE=0 pnpm build

Full uncached build passed, including all 147 SDK exports and the Control UI (11m 6.8s). The exact repository-pinned pnpm 11.22.0 entrypoint was invoked directly because the host's pnpm shim pointed at a missing file. No ineffective dynamic import warning. Both changed MDX pages parsed; 6,965 internal links checked with zero broken links. git diff --check and fresh structured Codex autoreview passed; no accepted/actionable findings.

Size: production +68/−144, net −76; tests/test support +316/−61; docs +20/−0. The additions preserve explicit selection independently of provenance, fence physical root escapes, and make cached selection reflect the existing process selector. Removing the duplicate ranking more than offsets them.

Provenance: the source-only development preference was introduced by direct commit ae800e160d065f4922706a036911d2ffa2c04908 (2026-05-30 UTC, author and committer @shakkernerd); it omitted the already-supported compiled layouts. This is an incomplete existing selection flow, not a new Codex authentication restriction. The screenshot alone does not establish its original instance's undisclosed source path; the isolated reproduction establishes the defects repaired here.

Known adjacent observation: the first recovered reply left the earlier historical error banner visible in the already-open chat; a reload/restart cleared it and the next turn remained healthy. This separate UI error-state lifecycle was handed to the ongoing composer investigation, not hidden or claimed fixed by this loader change. The recording preserves that intermediate state. General declarative/self-hosted plugin trust (#92516) remains outside this repair.

Rebase and CI follow-up: rebased onto a49da4208bc85b6af5b82e87cf495f38de9a042b to resolve the actual base conflict. The only conflict was docs/plugins/architecture.md; the landed correction from #132181, including the source-snapshot trust paragraph, is preserved with our additional alias/runner paragraph. The corrected manifest page is unchanged from that base. The original 17 modified code/test files remain byte-identical to the reviewed and live-tested implementation. Incoming base changes to native cleanup/public-surface loading were inspected separately and passed 126 focused tests (one existing Windows-only skip). The rebased runner/discovery/snapshot/state rerun passed 134 tests; both changed MDX pages, formatting, 6,970 internal links, and git diff --check passed.

The first exact-head CI run exposed an existing Linux node integration fixture that symlinked its plugin outside its temporary bundled root. The approved physical-containment check rejected that fixture. The test-only follow-up copies the real plugin inside a temporary checkout directory, where normal workspace dependencies remain resolvable; all command, capability, and pairing assertions are retained. The original test failed locally, the corrected test passes, and scoped lint/format plus fresh Codex autoreview pass. Production code is unchanged; no trust bypass, timeout increase, or assertion weakening was added. The corrected fixture passed CI on that head. No full-build repeat was needed for docs reconciliation and a test fixture correction.

Gateway-watch follow-up: the latest ClawSweeper finding and Rank-up move exposed a missing handoff of the existing OPENCLAW_DEV_SOURCE_ROOT. Commit c56a438869bd3111efb8fe88725a4a33d2969bf2 adds it to the existing tmux clear-then-assign environment list, preserving an explicit caller selection and clearing stale server/session selection when omitted. Both extended command tests failed before the change. All 229 targeted watch/run-node and discovery/manifest tests now pass. Real-shell and isolated real-tmux runs of the generated command failed both cases before and passed both afterward, including both child stages. The harmless recorder child never invoked a Gateway or operator service; the isolated tmux server was cleaned up.

Fresh isolated Codex autoreview is clean at the configured P0 threshold. Scoped lint/format, script erasability, script typechecking, all core-test typecheck shards, wrapper-shadowing and command-boundary checks passed. The local aggregate changed-file gate hit a pre-existing UI shard-size failure (724 roots against 720), independently present in the rebased base; #132193 already fixes it on main by splitting the shard without changing the limit. The remaining local checks were run directly and passed. No new runtime seam, configuration, trust exception, build artifact or unrelated shard change was added. Exact-head CI and the required gate passed for c56a438869bd3111efb8fe88725a4a33d2969bf2; the repository watcher completed GREEN with no pending checks. The original provider/restart proof remains applicable because runtime code is unchanged.

Visual proof

Before: the actual global-origin trust denial in the isolated live chat.

Before: Codex state access denied for the selected global copy

After: two real Codex replies, including successful native-thread resumption after Gateway restart with the same state and global shadow still present.

After: live Codex chat and native binding survive Gateway restart

Recording: pre-fix failure → first recovered reply (with the historical UI-banner observation above) → healthy restart/resume.

dev-trust-recovery-and-restart.mp4

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: L maintainer Maintainer-authored PR labels Aug 28, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 9:10 PM ET / August 29, 2026, 01:10 UTC.

ClawSweeper review

What this changes

The branch makes checkout development runners prefer the checkout’s bundled plugin over a tracked global duplicate, retains bundled provenance for aliases of the same physical plugin, and carries the selector through Gateway watch.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for explicit maintainer handling. The current main snapshot still has the pre-fix candidate de-duplication and lacks the runner and tmux selector propagation; the PR supplies a focused, net-negative owner-boundary repair with no blocking code findings.

Priority: P2
Reviewed head: c56a438869bd3111efb8fe88725a4a33d2969bf2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, net-negative repair with broad owner-boundary coverage and no blocking review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable to the external-contributor gate because this is member-authored; the supplied body nevertheless maps the changed runner and selection path to an isolated Gateway before/after chat and restart result.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable to the external-contributor gate because this is member-authored; the supplied body nevertheless maps the changed runner and selection path to an isolated Gateway before/after chat and restart result.
Evidence reviewed 6 items Current-main gap: The fetched main snapshot retains first-seen physical-alias de-duplication, does not invalidate a persisted registry for the development selector, and does not set or forward that selector from the development runners.
Canonical selection owner: The patch keeps duplicate precedence in the manifest registry, where a bundled candidate representing a configured physical alias retains its provenance while preserving explicit-path precedence.
Trust-boundary containment: The shared containment helper canonicalizes both paths and accepts only source or compiled plugin trees physically inside the validated package root; discovery also rejects an escaped bundled-directory symlink.
Findings None None.
Security None None.

How this fits together

Plugin discovery collects bundled, configured, and installed plugin candidates, then manifest selection chooses the active source before the runtime applies its existing trust gate. Development runners provide the checkout selector so local development resolves the intended bundled plugin.

flowchart LR
  A[Development runner] --> B[Checkout selector]
  B --> C[Plugin discovery]
  D[Bundled and global plugins] --> C
  C --> E[Manifest selection]
  E --> F[Runtime plugin loader]
  F --> G[Existing trust gate]
Loading

Decision needed

Question Recommendation
Should the maintainer approve the scoped development duplicate-selection and bundled-provenance contract before merge? Accept the scoped contract: Merge with the documented rule that only an independently discovered, physically contained bundled entry retains bundled provenance.

Why: The patch deliberately changes which plugin source wins and therefore affects an existing trust-sensitive compatibility boundary, even though the trust gate itself is unchanged.

Before merge

  • Resolve merge risk (P1) - This changes duplicate-source selection for development checkouts with tracked global copies or configured physical aliases, so maintainers should intentionally accept that compatibility contract.
  • Resolve merge risk (P1) - Bundled provenance controls access to guarded plugin state APIs; the physical-containment invariant must remain the sole basis for the added priority.
Agent review details

Security

None.

PR surface

Source -78, Tests +254, Docs +20, Other +3. Total +199 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 11 66 144 -78
Tests 7 315 61 +254
Docs 2 20 0 +20
Config 0 0 0 0
Generated 0 0 0 0
Other 2 3 0 +3
Total 22 404 205 +199

Review metrics

Metric Value Why it matters
Production versus test delta production +68/-144 (net -76); tests/support +316/-61; docs +20/-0 The repair removes the duplicate runtime ranking while adding focused coverage for the selection, cache, alias, and tmux-boundary invariants.

Merge-risk options

Maintainer options:

  1. Accept the checkout-only compatibility change (recommended)
    Merge after confirming that compiled checkout trees should outrank tracked globals while configured paths to different physical code remain untrusted.
  2. Pause for broader plugin trust design
    Do not expand this patch into general local-plugin trust; that separate policy remains tracked by Containerized/self-hosted deploys can't use externalized channel plugins: openKeyedStore is gated to trusted plugins, with no supported way to trust a self-hosted channel #92516.

Technical review

Best possible solution:

Land the scoped manifest-first selection repair while retaining physical-root containment and the existing untrusted behavior for different local copies.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: the fetched main code lacks compiled-tree recognition, selector-aware snapshot invalidation, and runner propagation; the added focused tests encode those concrete cases.

Is this the best way to solve the issue?

Yes. Moving precedence into manifest selection and making runtime loading consume only manifest winners removes the duplicated ranking rather than adding a trust bypass.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 831e2de0a367.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: The defect affects development checkout plugin selection and can block guarded plugin state access, but its established blast radius is limited.
  • merge-risk: 🚨 compatibility: The PR intentionally changes precedence between a checkout bundled plugin, tracked global duplicate, and configured physical alias.
  • merge-risk: 🚨 security-boundary: Bundled provenance remains the input to guarded plugin-state access, and the patch changes how that provenance is retained.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable to the external-contributor gate because this is member-authored; the supplied body nevertheless maps the changed runner and selection path to an isolated Gateway before/after chat and restart result.

Evidence

What I checked:

  • Current-main gap: The fetched main snapshot retains first-seen physical-alias de-duplication, does not invalidate a persisted registry for the development selector, and does not set or forward that selector from the development runners. (src/plugins/discovery.ts:1203, 831e2de0a367)
  • Canonical selection owner: The patch keeps duplicate precedence in the manifest registry, where a bundled candidate representing a configured physical alias retains its provenance while preserving explicit-path precedence. (src/plugins/manifest-registry.ts:795, c56a438869bd)
  • Trust-boundary containment: The shared containment helper canonicalizes both paths and accepts only source or compiled plugin trees physically inside the validated package root; discovery also rejects an escaped bundled-directory symlink. (src/plugins/bundled-dir.ts:147, c56a438869bd)
  • Regression coverage: Focused tests cover all three development plugin trees, configured aliases, unrelated global plugins, persisted/current registry snapshots, and the tmux clear-then-assign path. (src/plugins/manifest-registry.test.ts:852, c56a438869bd)
  • Feature history: The earlier development-source preference appears to date to commit ae800e1; the current plugin-discovery structure was most recently refactored in 70c44ce. (src/plugins/manifest-registry.ts:799, ae800e160d06)
  • Submitted behavior proof: The PR body provides isolated before/after Gateway evidence with a tracked global shadow, bundled selection inspection, real chat, and post-restart native-thread resumption; external-proof gating is not required for this member-authored PR. (c56a438869bd)

Likely related people:

  • shakkernerd: The PR’s documented provenance identifies this author for the original source-only development preference, which the new compiled-tree coverage extends. (role: introduced development-selection behavior; confidence: high; commits: ae800e160d06; files: src/plugins/manifest-registry.ts, src/plugins/dev-source-root.ts)
  • quangtran88: The current candidate de-duplication structure immediately preceding this PR dates to this contributor’s recent discovery refactor. (role: recent plugin-discovery contributor; confidence: high; commits: 70c44ce84dae; files: src/plugins/discovery.ts, src/plugins/manifest-registry.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-28T23:38:56.762Z sha eac4f8fc1aa9668102bdab1bef0baff2aed455ea :: needs maintainer review before merge. :: none
  • reviewed 2026-08-28T23:54:57.350Z sha a52c1cf :: needs maintainer review before merge. :: none
  • reviewed 2026-08-29T00:10:59.767Z sha e48eea3 :: needs changes before merge. :: [P2] Forward the explicit selector through Gateway watch
  • reviewed 2026-08-29T01:02:34.415Z sha c56a438 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/dev-mode-trusted-error-f572f4 branch from eac4f8f to a52c1cf Compare August 28, 2026 23:47
@steipete
steipete marked this pull request as ready for review August 28, 2026 23:47
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. labels Aug 29, 2026
@steipete

steipete commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the Gateway-watch finding and its Rank-up move in c56a438. The existing OPENCLAW_DEV_SOURCE_ROOT now participates in the canonical tmux clear-then-assign list, so an explicit checkout survives the handoff and an omitted selector cannot inherit stale server/session state.

Both extended command tests failed before the fix; all 229 watch/run-node and discovery/manifest tests pass afterward. The generated command was also executed through a real shell and a dedicated real tmux socket with stale server/session values. Both child stages reproduced the wrong value before, then received the explicit checkout or an unset selector after. Only a harmless recorder child ran; no Gateway or operator service was touched, and the owned tmux server was removed.

Scoped lint/format, script erasability/types, all core-test typecheck shards, wrapper checks and fresh isolated Codex autoreview (configured P0 threshold) passed. The aggregate local gate exposed the existing 724/720 UI shard count on the rebased base, already corrected by #132193; no limit or assertion was weakened. The previous Linux-fixture correction and #132181 docs correction are retained. Production is +68/-144 (net -76), tests/support +316/-61, docs +20/-0.

CI for this exact head and the required gate completed successfully; the repository watcher reports GREEN with no pending checks. The PR body retains the original real provider/restart evidence and all proof-media URLs. No redundant re-review request is needed for this requested finding fix.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 29, 2026
@steipete
steipete merged commit dd16853 into main Aug 29, 2026
257 checks passed
@steipete
steipete deleted the steipete/dev-mode-trusted-error-f572f4 branch August 29, 2026 01:16
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
)

* fix(plugins): keep development runs on checkout plugins

* test(node-host): contain the bundled Linux plugin fixture

* fix(dev): preserve checkout selector through tmux watch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR 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. P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Dev plugin builds and source aliases lose bundled provenance

1 participant