Skip to content

refactor(channels): unify trusted configured-state probes - #130320

Merged
steipete merged 1 commit into
mainfrom
codex/loc-sweep-channel-configured-state-20260826
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/loc-sweep-channel-configured-state-20260826

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Channel setup detection had two implementations of the same package metadata contract: one for bundled package probes and another for trusted installed plugins. This made it easier for credential requirements and safe environment-trigger handling to diverge after the fixes in #114492.

Why This Change Was Made

Use the existing package-state evaluator for both paths after the caller has established plugin trust. Move the existing safe environment-name rule into that evaluator, and remove the configured-state forwarding module. Plugin trust, explicit disablement, complete credential requirements, and module-backed probes remain owned by their existing boundaries.

Production LOC: +31/-77 (net -46). Tests: +56/-21 (net +35). No public Plugin SDK, config, schema, or dependency changes.

User Impact

Channel setup and automatic enablement use the same rules for bundled and trusted installed packages. Incomplete credentials still do not enable a channel, and unrelated process variables such as PATH do not establish configured state.

Evidence

  • Candidate: d97b15ae47e650817f854de5241f1cf2f1204c66.
  • Implementation proof: 423 focused tests covering channel state, auto-enablement, package probes, trust, and provenance.
  • Recovery reran ten relevant suites on the exact candidate using a dependency install matching its package and lockfiles: 327 tests passed, covering package probes, channel configuration, auto-enablement, trusted owner selection, provenance, and official-plugin repair hints.
  • Real package proof: installed published Slack 2026.7.1 and IRC 2026.8.1-beta.3 packages through the CLI; checked trusted installed ownership, partial versus complete credentials, and explicit disablement. This was package-install/configuration proof, not a Slack or IRC message round trip.
  • A fresh structured Codex P1 review and a separate independent source review passed on this candidate.
  • Maintainer-requested, AI-assisted refactor. CI on the published candidate is required before landing.

@clawsweeper

clawsweeper Bot commented Aug 26, 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 size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 19:35
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 3:43 PM ET / 19:43 UTC.

ClawSweeper review

What this changes

The PR deletes a bundled-only configured-state wrapper and routes bundled and trusted installed channel setup checks through the shared package-state evaluator.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. This is a maintainer-owned, focused refactor that is still absent from current main; source review found no patch-introduced defect, but the branch is behind main and relevant exact-head checks are incomplete.

Priority: P2
Reviewed head: d97b15ae47e650817f854de5241f1cf2f1204c66

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a coherent, net-negative consolidation with good source and test coverage; final confidence depends on the current merge result and pending checks.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body additionally records package-install and configured-state evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body additionally records package-install and configured-state evidence.
Evidence reviewed 6 items Shared evaluator preserves safe environment handling: The refactor centralizes safe variable-name filtering, trimming, case normalization, and non-empty checks before declarative configured-state metadata is evaluated.
Trust remains outside the shared evaluator: Installed manifests are filtered by scoped ownership/trust before their exact selected package channel is evaluated, so the refactor does not broaden which plugins may contribute configured state.
Config and auto-enable callers retain ordering: Explicit configuration remains first, bootstrap fallback remains last, and auto-enable still rejects incomplete environment-derived configured state before invoking the general channel check.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw channels status --help

Result: PASS (completed)

$ node scripts/run-node.mjs channels status --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 99.50 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 13.5s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4173ms (slowest: built plugin control-plane loads 3447ms)
│
◇

OpenClaw 2026.8.1 (d97b15a) — All your chats, one OpenClaw.

Usage: openclaw channels status [options]

Show gateway channel status (use status --deep for local)

Options:
  --channel ‹name›  Only show one channel (all)
  -h, --help        Display help for command
  --json            Output JSON (default: false)
  --probe           Probe channel credentials (default: false)
  --timeout ‹ms›    Timeout in ms (default: "10000")
$ node scripts/run-node.mjs channels status --help
│
◇

OpenClaw 2026.8.1 (d97b15a) — All your chats, one OpenClaw.

Usage: openclaw channels status [options]

Show gateway
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

Channel setup detection reads package metadata together with configuration and environment values to decide whether a channel is configured. That decision feeds status and automatic enablement while preserving plugin trust and channel-owned credential rules.

flowchart LR
  A[Channel package metadata] --> C[Package state evaluator]
  B[Configuration and environment] --> C
  D[Trusted plugin policy] --> C
  C --> E[Configured channel decision]
  E --> F[Channel status and setup]
  E --> G[Automatic enablement]
Loading

Before merge

  • Resolve merge risk (P1) - Configured-state evaluation affects existing channel activation; require a current-main merge result and completed channel/config checks before merging because the branch is behind and CI is incomplete.
  • Complete next step (P2) - This protected maintainer refactor has no discrete automated repair task; it needs ordinary current-merge validation.
Agent review details

Security

None.

PR surface

Source -46, Tests +35. Total -11 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 5 31 77 -46
Tests 3 56 21 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 87 98 -11

Review metrics

Metric Value Why it matters
Production versus tests production +31/-77 (net -46); tests +56/-21 (net +35) The forwarding module and duplicate environment policy are removed while focused contract coverage expands.

Merge-risk options

Maintainer options:

  1. Validate the current merge result (recommended)
    Refresh the branch or merge result against current main and require successful exact-head channel and config checks before landing.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Require a current-main merge result and successful exact-head channel and config checks.

Technical review

Best possible solution:

Keep a single metadata-first evaluator after the trust boundary, while retaining explicit-config precedence, complete credential requirements, and bootstrap fallback behavior.

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

Not applicable: this is a behavior-preserving refactor rather than a report of a standalone current failure; source and existing boundary tests define the preserved contract.

Is this the best way to solve the issue?

Yes. Centralizing the evaluator after the existing trust gate removes a forwarding adapter and duplicate environment policy without moving credential ownership out of channel owners.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a normal-priority refactor of channel setup and auto-enable behavior.
  • add merge-risk: 🚨 compatibility: The shared evaluator influences existing configured-state and automatic-activation decisions for bundled and trusted installed channels.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body additionally records package-install and configured-state evidence.

Label justifications:

  • P2: This is a normal-priority refactor of channel setup and auto-enable behavior.
  • merge-risk: 🚨 compatibility: The shared evaluator influences existing configured-state and automatic-activation decisions for bundled and trusted installed channels.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body additionally records package-install and configured-state evidence.

Evidence

What I checked:

  • Shared evaluator preserves safe environment handling: The refactor centralizes safe variable-name filtering, trimming, case normalization, and non-empty checks before declarative configured-state metadata is evaluated. (src/channels/plugins/package-state-probes.ts:84, d97b15ae47e6)
  • Trust remains outside the shared evaluator: Installed manifests are filtered by scoped ownership/trust before their exact selected package channel is evaluated, so the refactor does not broaden which plugins may contribute configured state. (src/plugins/channel-presence-policy.ts:140, d97b15ae47e6)
  • Config and auto-enable callers retain ordering: Explicit configuration remains first, bootstrap fallback remains last, and auto-enable still rejects incomplete environment-derived configured state before invoking the general channel check. (src/config/plugin-auto-enable.shared.ts:296, d97b15ae47e6)
  • Existing tests cover the trusted installed-plugin boundary: Tests cover incomplete versus complete external manifest credentials, namespace-signal bypass prevention, explicit configuration preservation, and module-backed installed Slack credentials. (src/plugins/channel-plugin-ids.test.ts:3398, d97b15ae47e6)
  • Current main has not independently absorbed this refactor: The PR base is the direct parent of current main, and current main makes no changes to the five reviewed owner files after that base; this remains distinct work. (src/channels/plugins/package-state-probes.ts:84, c3d95c2d8071)
  • Related repair provenance: The earlier trusted-plugin activation repair merged before this PR and is the design context; no local release tag contains that merge, so it is newer than the supplied latest stable release. (src/plugins/channel-presence-policy.ts:125, 9b77c06bbde9)

Likely related people:

  • steipete: Authored this refactor and the earlier merged trusted-plugin activation repair; git history shows sustained ownership of the package-state surface. (role: feature owner; confidence: high; commits: d97b15ae47e6, 9b77c06bbde9, 58897de60c07; files: src/channels/plugins/package-state-probes.ts, src/plugins/channel-presence-policy.ts, src/config/plugin-auto-enable.shared.ts)
  • vincentkoc: Feature history and shortlog evidence show recurring work on bundled source overlays and channel configuration behavior adjacent to this evaluator. (role: adjacent channel/plugin contributor; confidence: medium; commits: d62e443, a641c0d; files: src/channels/plugins/package-state-probes.ts, src/plugins/channel-presence-policy.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh against current main as needed and wait for the relevant exact-head checks to complete.

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification for d97b15ae47e650817f854de5241f1cf2f1204c66: the shared package evaluator replaces the duplicated configured-state logic after the unchanged plugin trust boundary. Production -46 lines; tests +35. No new config, SDK, schema, dependency, or credential contract.

Recovery proof passed on matching dependencies:

OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs src/channels/plugins/configured-state.test.ts src/channels/plugins/package-state-probes.test.ts src/channels/config-presence.test.ts src/config/channel-configured.test.ts src/config/plugin-auto-enable.core.test.ts src/config/plugin-auto-enable.channels.test.ts src/plugins/install-provenance.test.ts src/plugins/official-external-install-records.test.ts src/plugins/channel-plugin-ids.test.ts src/plugins/official-external-plugin-repair-hints.test.ts
git diff --name-only -z 4eea0d3e2711419d813fc7bff4fb13501f717e56...HEAD | xargs -0 node scripts/check-changed.mjs --

All 327 tests and the full selected changed gate passed. The implementation's additional registry-install proof covered published Slack and IRC trust/partial/full/disabled configuration, not live message delivery. Independent source review and structured Codex P1 review found no blocking findings.

The latest ClawSweeper rank-up asks for current-main merge validation and completed checks. Exact-head CI is now green: https://github.com/openclaw/openclaw/actions/runs/33005990770 . The current-main merge-tree check is clean; no behavior rebase is needed. Native prepare/merge will repeat the live guards. There is no standalone new bug claim or authenticated message-flow claim in this behavior-preserving refactor.

@steipete
steipete merged commit e668e96 into main Aug 26, 2026
281 checks passed
@steipete
steipete deleted the codex/loc-sweep-channel-configured-state-20260826 branch August 26, 2026 20: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 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

1 participant