Skip to content

fix: avoid channel discovery when plugins are disabled - #146689

Merged
steipete merged 2 commits into
mainfrom
codex/perf-disabled-channel-discovery
Sep 13, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/perf-disabled-channel-discovery

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Commands that prepare configured channels do expensive discovery even when plugins are globally disabled and no plugin can be selected.

User Impact

Disabled-plugin command and maintenance flows avoid unnecessary discovery. Enabled-plugin selection, detailed status reporting, registry publication and live requester checks keep their existing behavior. No configuration or migration is required.

Why This Change Was Made

Apply the existing normalized global-disable decision at the canonical ID-only resolver, before collecting channel metadata and state. Full presence-policy reports still collect disabled reasons, and the registry loader still publishes the empty result. This is four production lines, with no added cache or caller-specific shortcut.

The branch also removes one unused local import introduced on main; the independent public re-export remains intact. This repairs the observed TS6133 build failure without changing SecretRef behavior.

Evidence

The same three real requester-window cases passed before and after with the same source base, dependencies, order and worker limits. Instrumented local Node 24.21.0 measurements isolated eight configured-scope queries:

Measured operation Before After
Configured-channel ID resolution, eight calls 57,115.102 ms 1.820 ms
Empty-registry publication, eight calls 12.308 ms 11.830 ms
Three complete case durations 30.732 / 16.976 / 24.941 s 7.046 / 5.372 / 6.260 s

All eight authority preparations and empty publications remained. Every fixed allowed/refused outcome passed; periodic checks ran fewer times because the cases finished sooner. All observed child processes joined and canonical generation verification/cleanup completed. Host load and cache history were not controlled, so these are local attribution measurements, not a promised CI percentage or Blacksmith forecast.

Two regression assertions fail before the change. All 189 policy and registry-owner cases pass, including enabled/default selection, activation-source precedence, the reverse disabled-effective-config result, reason-rich disabled reports and empty registry publication. Scoped gates and independent P2 review passed for the two-file performance change. Measurements remain bound to ba11b302 plus the reviewed patch; the final branch was refreshed without changing those files or their 30 reviewed owner/dependency inputs.

The canonical core typecheck reproduced TS6133 before the import cleanup and passes afterward. Its separate independent P2 review is clean; the public re-export remains. Exact-head CI run 34735249189 passed on 3ecc2234b82ca78fdf72a2f3fad7024e082107d2.

Compatibility review: configuration keys, defaults and public function signatures are unchanged. The existing global-disable policy already returns no eligible owners on main and in v2026.9.4; this change only avoids collecting evidence that cannot affect that result. Enabled/default and both activation-source precedence directions remain covered, full disabled-reason reporting and empty-registry publication remain active, and the SecretRef re-export remains intact. No upgrade action or migration is needed.

@steipete steipete self-assigned this Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 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 size: S maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 03:20
@steipete
steipete requested a review from a team as a code owner September 13, 2026 03:20
@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 Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 12, 2026, 11:42 PM ET / September 13, 2026, 03:42 UTC (Revision 2).

ClawSweeper review

What this changes

The PR skips configured-channel discovery when plugins are globally disabled, preserves detailed disabled-status reporting, adds regression coverage, and removes an unused secret-reference import.

Merge readiness

⛔ Blocked before merge - 1 item remains

The PR remains useful: current main and v2026.9.4 still perform the unnecessary discovery. No actionable defect was found. The updated compatibility explanation matches the source and resolves the previous review concern without requiring a migration or configuration change.

Priority: P2
Reviewed head: 3ecc2234b82ca78fdf72a2f3fad7024e082107d2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-supported optimization with meaningful regression coverage and no remaining correctness or compatibility finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body supplies before/after Node measurements through real requester-window flows exercising configured-channel resolution and registry publication, with preserved allowed/refused results and cleanup. These are reported local observations, not independently rerun benchmarks; focused regressions and verified exact-head CI supplement them.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body supplies before/after Node measurements through real requester-window flows exercising configured-channel resolution and registry publication, with preserved allowed/refused results and cleanup. These are reported local observations, not independently rerun benchmarks; focused regressions and verified exact-head CI supplement them.
Evidence reviewed 9 items Introduced change and merge boundary: The pinned introduction changes only the resolver guard, its regression coverage, and an unused import. Raw test-merge parent records match the supplied base followed by the exact PR head; its comparison against that base contains the same three files.
Current main still needs the optimization: The fetched main resolver calls read-only channel presence discovery before determining the owner IDs; it lacks the proposed early global-disable return.
Shipped disablement contract: v2026.9.4 already rejects every manifest owner when normalized plugins.enabled is false, while its configured-channel resolver still performs discovery. The patch preserves this shipped selection result rather than introducing a stricter default.
Findings None None.
Security None None.

How this fits together

OpenClaw resolves configured channels into plugin IDs before commands and maintenance flows load their plugin registry. This change avoids collecting channel metadata when the existing global-disable policy already guarantees an empty selection.

flowchart TD
  A[Command or maintenance flow] --> B[Configured channel resolver]
  C[Configuration and activation source] --> B
  B --> D{Plugins globally disabled?}
  D -->|Yes| E[Empty plugin selection]
  D -->|No| F[Channel discovery and owner policy]
  F --> G[Registry loader]
  E --> G
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
Agent review details

Security

None.

PR surface

Source +3, Tests +32. Total +35 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 4 1 +3
Tests 1 40 8 +32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 44 9 +35

Review metrics

None.

Technical review

Best possible solution:

Keep the early exit in the canonical ID resolver while preserving detailed presence reports, existing activation precedence, and empty-registry publication.

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

Yes, from source: current main runs channel presence discovery before its existing policy excludes globally disabled owners. The supplied measurements demonstrate the cost; this review did not execute the runtime.

Is this the best way to solve the issue?

Yes. The guard uses the existing normalization and activation-source precedence at the shared owner, with no new configuration, persisted state, public API, or competing cache.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against aac6465ffee3.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured body supplies before/after Node measurements through real requester-window flows exercising configured-channel resolution and registry publication, with preserved allowed/refused results and cleanup. These are reported local observations, not independently rerun benchmarks; focused regressions and verified exact-head CI supplement them.

Label justifications:

  • P2: This removes substantial unnecessary discovery from disabled-plugin command and maintenance flows without changing their selection contract.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body supplies before/after Node measurements through real requester-window flows exercising configured-channel resolution and registry publication, with preserved allowed/refused results and cleanup. These are reported local observations, not independently rerun benchmarks; focused regressions and verified exact-head CI supplement them.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body supplies before/after Node measurements through real requester-window flows exercising configured-channel resolution and registry publication, with preserved allowed/refused results and cleanup. These are reported local observations, not independently rerun benchmarks; focused regressions and verified exact-head CI supplement them.

Evidence

What I checked:

  • Introduced change and merge boundary: The pinned introduction changes only the resolver guard, its regression coverage, and an unused import. Raw test-merge parent records match the supplied base followed by the exact PR head; its comparison against that base contains the same three files. (src/plugins/channel-presence-policy.ts:727, 3ecc2234b82c)
  • Current main still needs the optimization: The fetched main resolver calls read-only channel presence discovery before determining the owner IDs; it lacks the proposed early global-disable return. (src/plugins/channel-presence-policy.ts:719, aac6465ffee3)
  • Shipped disablement contract: v2026.9.4 already rejects every manifest owner when normalized plugins.enabled is false, while its configured-channel resolver still performs discovery. The patch preserves this shipped selection result rather than introducing a stricter default. (src/plugins/manifest-owner-policy.ts:58, 3a9d69db306c)
  • Registry publication remains owned by the caller: The configured-channel scope passes the resolver result into loadOpenClawPlugins even when the result is empty. Existing coverage explicitly preserves onlyPluginIds: []; the PR does not add a caller-level return that would bypass registry publication. (src/plugins/runtime/runtime-registry-loader.ts:150, 3ecc2234b82c)
  • Regression and compatibility coverage: The changed table covers global disablement, both activation-source precedence directions, and skipped presence/manifest discovery. Separate policy coverage retains reason-rich plugins-disabled rows. The fixture resets the discovery spies between cases. (src/plugins/channel-plugin-ids.test.ts:2830, 3ecc2234b82c)
  • Secret-reference export preserved: Only the unused local import is removed; the independent isValidEnvSecretRefId re-export and secret-resolution implementation remain intact. (src/config/types.secrets.ts:19, 3ecc2234b82c)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (1 earlier review cycle)
  • reviewed 2026-09-13T03:26:29.099Z sha 3ecc223 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 13, 2026
@steipete
steipete merged commit 4c47e8a into main Sep 13, 2026
261 checks passed
@steipete
steipete deleted the codex/perf-disabled-channel-discovery branch September 13, 2026 03:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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