Skip to content

fix(doctor): route setup doctor discovery - #69919

Merged
gumadeiras merged 13 commits into
mainfrom
codex/fix-doctor-readonly-routing
Apr 22, 2026
Merged

gumadeiras merged 13 commits into
mainfrom
codex/fix-doctor-readonly-routing

Conversation

@gumadeiras

Copy link
Copy Markdown
Member

Summary

  • Problem: configured channel doctor checks could skip the setup/bundled fallback when read-only discovery returned a plugin without doctor hooks.
  • Why it matters: compatibility, repair, preview, and empty-allowlist doctor hooks can silently stop running for configured channels.
  • What changed: doctor lookup now prefers read-only doctor hooks, falls back to loaded/setup doctors when read-only lacks hooks, and routes cfg/env through the affected doctor discovery paths.
  • What did NOT change (scope boundary): no docs or changelog entry in this PR; no provider-specific plugin behavior moved into core.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause (if applicable)

  • Root cause: the selected-channel doctor lookup treated a read-only plugin id as sufficient even when that read-only candidate did not expose doctor.
  • Missing detection / guardrail: no regression covered read-only plugin discovery returning a plugin without doctor hooks while setup fallback had the doctor adapter.
  • Contributing context (if known): doctor runtime dependency work shifted configured-channel lookup toward read-only/setup surfaces.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/commands/doctor/shared/channel-doctor.test.ts
  • Scenario the test should lock in: read-only plugin without doctor falls back to setup doctor; explicit env and config are routed into read-only discovery.
  • Why this is the smallest reliable guardrail: the bug is in the shared doctor dispatch seam, not a plugin implementation.
  • Existing test that already covers this (if any): N/A
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

Configured channel doctor checks run the owning setup/loaded doctor hooks when read-only discovery finds a plugin that does not expose doctor hooks.

Diagram (if applicable)

Before:
configured channel -> read-only plugin id found -> setup fallback skipped -> doctor hook omitted

After:
configured channel -> read-only plugin has doctor? -> use it
                   -> otherwise loaded/setup fallback -> doctor hook runs

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local Node/pnpm repo runtime
  • Model/provider: N/A
  • Integration/channel (if any): channel doctor dispatch
  • Relevant config (redacted): configured channel with read-only plugin candidate lacking doctor hooks

Steps

  1. Configure a channel id that read-only discovery returns without doctor.
  2. Provide the same channel id via setup/loaded plugin with doctor hooks.
  3. Run doctor compatibility/repair/preview paths.

Expected

  • Setup/loaded doctor hook runs when read-only plugin lacks doctor.

Actual

  • Before this fix, fallback could be skipped.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: focused doctor tests; staged pre-commit pnpm check:changed --staged; full extension gate triggered by public adapter contract change.
  • Edge cases checked: read-only doctor wins; read-only without doctor falls back; setup loading failure remains non-fatal; env/config route through doctor discovery.
  • What you did not verify: live channel doctor run against a packaged install.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: adding optional context fields to the doctor adapter type could reveal type assumptions in plugins.
    • Mitigation: fields are optional and pnpm check:changed --staged ran core and extension type/tests.

Copilot AI review requested due to automatic review settings April 22, 2026 01:27
@aisle-research-bot

aisle-research-bot Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

🔒 Aisle Security Analysis

We found 2 potential security issue(s) in this PR:

# Severity Title
1 🟠 High Doctor preview loads external channel plugins and passes full account objects to plugin hooks (potential secret exfiltration)
2 🟠 High Untrusted plugin code execution via read-only channel plugin discovery in doctor flow
1. 🟠 Doctor preview loads external channel plugins and passes full account objects to plugin hooks (potential secret exfiltration)
Property Value
Severity High
CWE CWE-829
Location src/commands/doctor/shared/channel-doctor.ts:110-218

Description

createChannelDoctorEmptyAllowlistPolicyHooks() resolves and executes read-only channel plugins derived from config/manifest registry, and then calls plugin-provided doctor hooks with a context that includes the raw account object.

Impact:

  • resolveReadOnlyChannelPluginsForConfig() may load external plugins (via the plugin loader/manifest registry) beyond already-loaded/bundled plugins.
  • Doctor hooks are invoked during doctor preview / empty-allowlist scans.
  • Hook context includes account: Record<string, unknown> and parent: Record<string, unknown>; in many channel configs these records can contain secrets (API tokens, credentials).
  • A malicious/untrusted third-party plugin can exfiltrate those secrets when doctor is run.

Vulnerable flow:

  • Input: account objects originating from user config (OpenClawConfig.channels.*)
  • Execution: plugin discovery/loading in safeListReadOnlyChannelPlugins()
  • Sink: call to entry.doctor.collectEmptyAllowlistExtraWarnings?.(pluginParams) / shouldSkipDefaultEmptyGroupAllowlistWarning?.(pluginParams)

Recommendation

Treat doctor hooks as untrusted and avoid passing secrets.

Options (can be combined):

  1. Redact/sanitize account objects before invoking plugin doctor hooks (pass only non-sensitive fields).
  2. Provide plugins a minimal typed view (e.g., derived allowlist info only), not the full account record.
  3. Avoid auto-loading external/read-only plugins during doctor preview unless explicitly enabled (e.g., --include-external-plugins).

Example: sanitize before calling plugin hooks:

function sanitizeAccountRecord(account: Record<string, unknown>): Record<string, unknown> {
  const { token, accessToken, refreshToken, password, apiKey, secret, ...rest } = account as any;
  return rest;
}

function toPluginEmptyAllowlistContext(params: ChannelDoctorEmptyAllowlistLookupParams) {
  const { cfg: _cfg, account, parent, ...rest } = params;
  return {
    ...rest,
    account: sanitizeAccountRecord(account),
    parent: parent ? sanitizeAccountRecord(parent) : undefined,
  };
}

(Use your actual secret key conventions; ideally leverage existing secret-ref/secret-target metadata rather than ad-hoc field lists.)

2. 🟠 Untrusted plugin code execution via read-only channel plugin discovery in doctor flow
Property Value
Severity High
CWE CWE-94
Location src/commands/doctor/shared/channel-doctor.ts:110-116

Description

channel-doctor.ts now discovers and merges read-only channel plugins via resolveReadOnlyChannelPluginsForConfig(...) and then executes their doctor hooks (e.g., cleanStaleConfig, repairConfig, runConfigSequence).

This is dangerous because resolveReadOnlyChannelPluginsForConfig can load external (non-bundled) plugins based on config/workspace/env and it uses loadOpenClawPlugins(...) which loads plugin modules (executing their top-level code) even with activate:false.

Impact:

  • If an attacker can influence the workspace (e.g., a cloned repo containing .openclaw/extensions/plugin manifests) and convince a user to run openclaw doctor or openclaw plugins install, attacker-controlled plugin code can be imported and executed under the user's privileges.
  • This execution occurs during diagnostic/repair flows and during plugin install snapshot processing, which are not typically expected to run third-party code.

Vulnerable code (entry point):

return resolveReadOnlyChannelPluginsForConfig(context.cfg, {
  ...(context.env ? { env: context.env } : {}),
  includePersistedAuthState: false,
}).plugins;

(Downstream, this resolution may call loadOpenClawPlugins({ activate:false, ... }) to load external setup-only channel plugins.)

Recommendation

Treat read-only plugin discovery as untrusted unless the user explicitly opts in.

Options to mitigate:

  1. Do not load external plugin modules during doctor/install-time discovery:

    • Add a loadModules:false (or equivalent) mode to resolveReadOnlyChannelPluginsForConfig so it only reads manifests/metadata, not importing code.
  2. Require explicit trust/allowlist before resolving external plugins from workspace/global extension roots (especially workspace-local .openclaw/extensions).

  3. If plugin code must be loaded, sandbox it (separate process with reduced permissions) and/or display a clear warning and prompt before execution.

Example direction (conceptual):

​// resolveReadOnlyChannelPluginsForConfig(..., { loadModules: false })
​// so doctor only uses bundled + already-loaded plugins unless explicitly allowed

Analyzed PR: #69919 at commit 90c7067

Last updated on: 2026-04-22T03:42:41Z

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes commands Command implementations size: M maintainer Maintainer-authored PR labels Apr 22, 2026
@greptile-apps

greptile-apps Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the doctor discovery fallback for configured channels: when resolveReadOnlyChannelPluginsForConfig returns a plugin without doctor hooks, the lookup now correctly falls through to the loaded/bundled setup plugin instead of silently skipping doctor execution. The env and cfg context is consistently threaded through all five doctor dispatch paths (compatibility, stale, repair, preview, empty-allowlist).

Confidence Score: 5/5

Safe to merge — the fallback logic is correct and well-covered by the new tests.

All remaining findings are P2 style/clarity nits. The core logic (read-only-first, fallback to setup, deduplication via Map, env/cfg threading) is correct and the new test suite covers the primary bug scenario plus edge cases (non-fatal failures, env routing, empty-allowlist path).

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/commands/doctor/shared/channel-doctor.ts
Line: 73-86

Comment:
**Read-only no-doctor plugin still occupies entry slot**

When a read-only plugin exists for a channel but lacks `doctor`, it is added to the `plugins` array (line 74 via `...readOnlyPlugins`) even though it will be silently skipped by the `if (!plugin.doctor) continue` guard. The loaded/bundled fallback is then also added to `plugins` for the same id. The deduplication map correctly picks up the fallback doctor, so the _result_ is right. However, having the no-doctor read-only entry travel through the loop is unnecessary and could confuse future readers who see an id appear twice in `plugins`.

Consider filtering `readOnlyPlugins` before spreading it so only entries that either have `doctor` or will not be supplemented by a fallback remain:

```typescript
const plugins = [
  ...readOnlyPlugins.filter((p) => p.doctor),
  ...channelIds.flatMap((id) => {
    if (readOnlyDoctorPluginIds.has(id)) return [];
    ...
  }),
];
```

This is a style/clarity nit — correctness is unaffected.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/commands/doctor/shared/channel-doctor.test.ts
Line: 138-160

Comment:
**Non-fatal test exercises catch path but not the no-doctor fallback path**

The "non-fatal" scenario throws from `resolveReadOnlyChannelPluginsForConfig`, which causes `safeListReadOnlyChannelPlugins` to return `[]`. That means `readOnlyDoctorPluginIds` is empty and the code falls straight through to the loaded/bundled path — it never exercises the distinct "read-only returns a plugin without `doctor`, _then_ falls back" code path that the PR description calls out as the root-cause scenario.

The PR has a separate test for the fallback path (`"falls back to setup doctor adapters"`), so coverage is technically present. But having the non-fatal test share the same channel name (`discord`) for both the throw and the undefined-return path makes it harder to distinguish what's under test. A minor clarity improvement would be to mock `getLoadedChannelPlugin` to return `undefined` explicitly here (it already does via `beforeEach`, so no code change needed — just a comment in the test) so the intent is self-documenting.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(doctor): route setup doctor discover..." | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes configured-channel doctor dispatch so it doesn’t stop at a read-only discovered plugin when that plugin doesn’t expose doctor hooks, ensuring setup/loaded doctor adapters still run (and that cfg/env are routed through the affected discovery paths).

Changes:

  • Prefer read-only channel plugin discovery for doctor adapters, but fall back to loaded + bundled-setup plugins when the read-only candidate lacks doctor.
  • Thread env through doctor preview/repair flows and empty-allowlist scans so discovery uses the intended environment.
  • Extend empty-allowlist warning context to carry cfg/env, plus add regression coverage for the fallback and env plumbing.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/commands/doctor/shared/preview-warnings.ts Adds optional env parameter and consistently uses it for preview-time scans/imports.
src/commands/doctor/shared/empty-allowlist-scan.ts Threads cfg/env into empty-allowlist scanning and extra-warning callbacks.
src/commands/doctor/shared/empty-allowlist-policy.ts Passes cfg/env into the channel-doctor skip hook for accurate adapter discovery.
src/commands/doctor/shared/channel-doctor.ts Implements read-only-first doctor lookup with fallback to loaded/setup adapters; plumbs env into read-only discovery.
src/commands/doctor/shared/channel-doctor.test.ts Adds tests covering read-only preference, fallback when hooks are missing, explicit env routing, and non-fatal setup loading.
src/commands/doctor/repair-sequencing.ts Adds optional env and routes it into repair-time scans/mutations.
src/commands/doctor-config-flow.ts Routes process.env into the updated doctor discovery/mutation paths.
src/cli/plugins-install-command.ts Routes process.env into stale channel doctor mutation collection for install-time config recovery.
src/channels/plugins/types.adapters.ts Extends empty-allowlist doctor context with optional cfg/env for plugin hook implementations.

@gumadeiras gumadeiras self-assigned this Apr 22, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c6e90518e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gumadeiras
gumadeiras force-pushed the codex/fix-doctor-readonly-routing branch from 9c6e905 to da6193b Compare April 22, 2026 01:57
@gumadeiras

Copy link
Copy Markdown
Member Author

Check triage done.

  • Codex P1: valid; fixed by making configured-channel doctor lookup doctor-adapter based and preserving full bundled doctor as the final fallback.
  • Greptile P2 / no-doctor read-only entry: valid style/clarity nit; fixed by filtering read-only candidates to doctor adapters before merging fallback candidates.
  • Greptile P2 / test coverage: addressed with explicit runtime-only bundled doctor fallback coverage.
  • Aisle security item 1 / read-only plugin code execution: rejected as a security finding. SECURITY.md defines installed/enabled plugins as trusted computing base and calls malicious trusted-installed plugin behavior out of scope without a boundary bypass. No auth/policy/sandbox bypass was demonstrated.
  • Aisle security item 2 / terminal escape injection: accepted as defense-in-depth hardening, not a security-boundary vulnerability under the trusted-plugin model. Fixed centrally by sanitizing doctor note emission.

Validation run after fixes:

  • pnpm test src/commands/doctor/emit-notes.test.ts src/commands/doctor/shared/channel-doctor.test.ts
  • pnpm check
  • staged check:changed via scripts/committer

Full pnpm test remains intentionally skipped per maintainer request.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0645415928

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/commands/doctor/emit-notes.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70b30dfee2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gumadeiras
gumadeiras force-pushed the codex/fix-doctor-readonly-routing branch 3 times, most recently from 2435218 to dfc3ac9 Compare April 22, 2026 02:20
@gumadeiras
gumadeiras force-pushed the codex/fix-doctor-readonly-routing branch 2 times, most recently from e2c06e0 to 3949be9 Compare April 22, 2026 03:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3949be9e11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@gumadeiras
gumadeiras force-pushed the codex/fix-doctor-readonly-routing branch from e700c7e to cc38ae4 Compare April 22, 2026 03:30
@gumadeiras
gumadeiras force-pushed the codex/fix-doctor-readonly-routing branch from cc38ae4 to 90c7067 Compare April 22, 2026 03:39
@gumadeiras
gumadeiras merged commit a197b54 into main Apr 22, 2026
8 checks passed
@gumadeiras
gumadeiras deleted the codex/fix-doctor-readonly-routing branch April 22, 2026 03:40
@gumadeiras

Copy link
Copy Markdown
Member Author

Merged via squash.

Thanks @gumadeiras!

medikoo pushed a commit to medikoo/openclaw that referenced this pull request Apr 24, 2026
Merged via squash.

Prepared head SHA: 90c7067
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
Merged via squash.

Prepared head SHA: 90c7067
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
zhonghe0615 pushed a commit to zhonghe0615/openclaw that referenced this pull request May 7, 2026
Merged via squash.

Prepared head SHA: 90c7067
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
Merged via squash.

Prepared head SHA: 90c7067
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Merged via squash.

Prepared head SHA: 90c7067
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Merged via squash.

Prepared head SHA: 90c7067
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Merged via squash.

Prepared head SHA: 90c7067
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
Merged via squash.

Prepared head SHA: 90c7067
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
Heetisk pushed a commit to Heetisk/openclaw that referenced this pull request Sep 28, 2026
Merged via squash.

Prepared head SHA: 90c7067
Co-authored-by: gumadeiras <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
steipete added a commit that referenced this pull request Oct 15, 2026
* refactor: consolidate command and cron preparation paths

Keep one sub-CLI metadata/registration catalog, common cron payload updates,
canonical agent migration visitors, and shared account-state projection.
Trust typed internal adapters while retaining external validation, effect
authority, cancellation settlement, supported migrations and path containment.

Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files).
Branch-only handoff for the coordinator's bundle; no standalone PR.

Best-effort tradeoffs accepted:
- Cron mid-setup reload recovery (#146582): synthetic retirement, no human
  incident. Setup may fail; the next invocation refreshes the cache.
- Recursive shared preparation retry (#102494/#138337): synthetic concurrent
  callers; production serializes same-job work. Duplicate direct callers may
  share cancellation. Failed-owner eviction preserves the next sequential run.
- Progress publication generation (#143621): synthetic held update/reset.
  Presentation dedupe may briefly be stale until a subsequent render/reset.
- Doctor adapter schema mirror (#69919): malformed synthetic hooks. Invalid
  executable adapters fail visibly; missing-hook fallbacks and config checks stay.
- Setup adapter schema mirror (#165492): typed internal union. Invalid internal
  adapters fail when used; both supported wizard forms remain.
- Injected process schema mirror (#84381): malformed injection was not human
  SIGTERM report #71710. Invalid adapters fail registration; cancellation stays.
- Loaded registry row revalidation/copy (#114942/#158830/#114476): rows already
  admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays.
- Custom compatibility duplicate check (#14223): all callers parse/type it.
  Hand-crafted invalid JS uses the default branch; external flags still reject it.
- Log probe identity matching (#88159, superseded by #168587): abort now joins
  the sole probe, so replacement cannot race its result. Recovery/settlement stay.
- Whole-config deep copy (#71218): no detached-copy incident. Structural copy
  updates agents/defaults; unrelated future mutation must respect config ownership.
- Repeated plugin-root probes (#70012): no disappearing-root incident. Resolve
  roots once; root replacement can fail discovery. Symlink containment stays.
- Second payload getter read (#135319): synthetic review/corpus, not a human
  report. Ordinary decoded records are read once; stateful accessors may differ.

Proof: fresh independent review clean; core types, targeted lint/format, runtime
and static cycles, assertion/line-cap ratchets, and suppression suite passed.
Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup
and cold-import checks passed. Cron and commands cohorts were interrupted after
partial results; complete owner tests, payload merging, test-graph types, broad
check-changed and build/smoke remain unproved at commit preparation.

Unattributed local 120-second timeouts retained: two root-command-descriptions
catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout,
retry, skip or kept-behavior expectation changes. Env-name budget mismatch
(455 vs 454) also exists at original HEAD and pinned main 7dccff5.
All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched.

* refactor: consolidate cron payload and lazy CLI paths

Share daemon and cron method forwarding through the existing lazy binder,
remove the cron CLI reexport shim, and consolidate normalization and merge
handling without changing public fields, explicit clears, or effect authority.
Remove the obsolete bundled discovery reentry mechanism and impossible Doctor
issue helper. The full lane now removes 475 net production lines.

Best-effort tradeoffs accepted:
- Unknown Doctor issue variants supplied by hand-crafted JavaScript return the
  invalid value rather than a custom error. Typed local producers and exhaustive
  switches remain; reporting feature #95979 cites no human unknown-kind incident.
- Synchronous bundled-module self-discovery may fail through the existing loader
  diagnostic instead of returning empty inventory. Commit 65f18d6 only pins
  injected Jiti reentry, not a human incident; ordinary caches remain.
- Cron defaults trust staggerMs normalized earlier in the same synchronous call.
  No await or mutation boundary intervenes; externally supplied invalid values
  remain rejected by the normalizer.

* fix(channels): retain replacement preview deduplication

Withdraw the progress compositor generation removal after the Mattermost
retiring-publication case failed CI and bounded serial head/base replays
remained inconclusive under load. Restore that file exactly to the branch
base and keep all Mattermost tests unchanged, following the campaign fallback.

Prune the single obsolete mock-export allowance left by the removed bundled
discovery reentry fixture. The local mock ratchet passes with 9586 factories.
The remaining lane reduction is 471 net production lines across 25 paths.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…#173036)

* refactor: consolidate command and cron preparation paths

Keep one sub-CLI metadata/registration catalog, common cron payload updates,
canonical agent migration visitors, and shared account-state projection.
Trust typed internal adapters while retaining external validation, effect
authority, cancellation settlement, supported migrations and path containment.

Wave-5 y10: BELOW-500, 353 net production lines removed (+440/-793 in 19 files).
Branch-only handoff for the coordinator's bundle; no standalone PR.

Best-effort tradeoffs accepted:
- Cron mid-setup reload recovery (openclaw#146582): synthetic retirement, no human
  incident. Setup may fail; the next invocation refreshes the cache.
- Recursive shared preparation retry (openclaw#102494/openclaw#138337): synthetic concurrent
  callers; production serializes same-job work. Duplicate direct callers may
  share cancellation. Failed-owner eviction preserves the next sequential run.
- Progress publication generation (openclaw#143621): synthetic held update/reset.
  Presentation dedupe may briefly be stale until a subsequent render/reset.
- Doctor adapter schema mirror (openclaw#69919): malformed synthetic hooks. Invalid
  executable adapters fail visibly; missing-hook fallbacks and config checks stay.
- Setup adapter schema mirror (openclaw#165492): typed internal union. Invalid internal
  adapters fail when used; both supported wizard forms remain.
- Injected process schema mirror (openclaw#84381): malformed injection was not human
  SIGTERM report openclaw#71710. Invalid adapters fail registration; cancellation stays.
- Loaded registry row revalidation/copy (openclaw#114942/openclaw#158830/openclaw#114476): rows already
  admitted/normalized. Corrupt trusted rows can fail; first-wins authority stays.
- Custom compatibility duplicate check (openclaw#14223): all callers parse/type it.
  Hand-crafted invalid JS uses the default branch; external flags still reject it.
- Log probe identity matching (openclaw#88159, superseded by openclaw#168587): abort now joins
  the sole probe, so replacement cannot race its result. Recovery/settlement stay.
- Whole-config deep copy (openclaw#71218): no detached-copy incident. Structural copy
  updates agents/defaults; unrelated future mutation must respect config ownership.
- Repeated plugin-root probes (openclaw#70012): no disappearing-root incident. Resolve
  roots once; root replacement can fail discovery. Symlink containment stays.
- Second payload getter read (openclaw#135319): synthetic review/corpus, not a human
  report. Ordinary decoded records are read once; stateful accessors may differ.

Proof: fresh independent review clean; core types, targeted lint/format, runtime
and static cycles, assertion/line-cap ratchets, and suppression suite passed.
Focused CLI cohort: 8 files / 41 tests passed. Earlier unchanged account/setup
and cold-import checks passed. Cron and commands cohorts were interrupted after
partial results; complete owner tests, payload merging, test-graph types, broad
check-changed and build/smoke remain unproved at commit preparation.

Unattributed local 120-second timeouts retained: two root-command-descriptions
catalog cases and agent-via-gateway's Gateway attempt-budget case. No timeout,
retry, skip or kept-behavior expectation changes. Env-name budget mismatch
(455 vs 454) also exists at original HEAD and pinned main 89f8219.
All runtime proof used isolated HOME/OpenClaw/XDG state; Phase E untouched.

* refactor: consolidate cron payload and lazy CLI paths

Share daemon and cron method forwarding through the existing lazy binder,
remove the cron CLI reexport shim, and consolidate normalization and merge
handling without changing public fields, explicit clears, or effect authority.
Remove the obsolete bundled discovery reentry mechanism and impossible Doctor
issue helper. The full lane now removes 475 net production lines.

Best-effort tradeoffs accepted:
- Unknown Doctor issue variants supplied by hand-crafted JavaScript return the
  invalid value rather than a custom error. Typed local producers and exhaustive
  switches remain; reporting feature openclaw#95979 cites no human unknown-kind incident.
- Synchronous bundled-module self-discovery may fail through the existing loader
  diagnostic instead of returning empty inventory. Commit ca10460 only pins
  injected Jiti reentry, not a human incident; ordinary caches remain.
- Cron defaults trust staggerMs normalized earlier in the same synchronous call.
  No await or mutation boundary intervenes; externally supplied invalid values
  remain rejected by the normalizer.

* fix(channels): retain replacement preview deduplication

Withdraw the progress compositor generation removal after the Mattermost
retiring-publication case failed CI and bounded serial head/base replays
remained inconclusive under load. Restore that file exactly to the branch
base and keep all Mattermost tests unchanged, following the campaign fallback.

Prune the single obsolete mock-export allowance left by the removed bundled
discovery reentry fixture. The local mock ratchet passes with 9586 factories.
The remaining lane reduction is 471 net production lines across 25 paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants