Skip to content

feat(onboarding): auto-install missing provider and channel plugins - #70012

Merged
vincentkoc merged 10 commits into
mainfrom
feat/onboarding-plugin-auto-install
Apr 23, 2026
Merged

vincentkoc merged 10 commits into
mainfrom
feat/onboarding-plugin-auto-install

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

summary

  • add a shared onboarding plugin installer for npm/local/skip flows
  • reuse that installer in channel setup instead of duplicating install logic
  • add a provider install catalog so provider auth choices can appear before runtime loads
  • auto-install missing provider plugins during onboarding, reload discovery, and retry provider resolution
  • document that manifest metadata controls what onboarding shows, while package.json#openclaw.install controls how onboarding fetches the plugin

validation

  • pnpm test src/plugins/provider-install-catalog.test.ts src/flows/provider-flow.test.ts src/commands/auth-choice.apply.plugin-provider.test.ts src/flows/channel-setup.test.ts src/commands/channels.add.test.ts src/cli/channel-auth.test.ts
  • pnpm test src/plugins/provider-install-catalog.test.ts src/flows/provider-flow.test.ts src/commands/auth-choice.apply.plugin-provider.test.ts
  • pnpm format:check
  • pnpm check:changed
    • core production typecheck passed
    • core test typecheck is currently blocked by unrelated missing-module baseline errors in:
      • src/docs/clawhub-plugin-docs.test.ts
      • src/gateway/reconnect-gating.test.ts
      • src/i18n/registry.test.ts
      • src/ui-app-settings.agents-files-refresh.test.ts

notes

  • this keeps install metadata out of runtime registry code and out of openclaw.plugin.json
  • the new seam is generic enough for future external registry backing without changing the onboarding call sites

@vincentkoc vincentkoc self-assigned this Apr 22, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: XL maintainer Maintainer-authored PR labels Apr 22, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review April 22, 2026 06:14
@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 Integrity pinning bypass when npm resolution lacks integrity despite expectedIntegrity
2 🟡 Medium Spoofable git-workspace trust check enables local plugin loading in non-git directories
1. 🟠 Integrity pinning bypass when npm resolution lacks `integrity` despite `expectedIntegrity`
Property Value
Severity High
CWE CWE-345
Location src/infra/npm-integrity.ts:38-42

Description

Integrity verification is skipped when either expectedIntegrity or the resolved artifact integrity is missing/empty.

  • Input: expectedIntegrity is provided via plugin manifest (openclaw.install.expectedIntegrity) and passed into npm install flows.
  • Source of actualIntegrity: resolution.integrity derived from npm pack --json output (packNpmSpecToArchive -> NpmSpecResolution.integrity).
  • Logic issue: resolveNpmIntegrityDrift returns { proceed: true } when resolution.integrity is falsy, even if an expectedIntegrity pin was supplied.
  • Impact: if npm pack output parsing fails, npm omits integrity, or a tooling/registry edge-case produces an empty integrity field, the install proceeds without enforcing the expected hash, undermining the supply-chain protection goal (“fail closed”).

Vulnerable code:

const expectedIntegrity = normalizeIntegrity(params.expectedIntegrity);
const actualIntegrity = normalizeIntegrity(params.resolution.integrity);
if (!expectedIntegrity || !actualIntegrity) {
  return { proceed: true };
}

Recommendation

Fail closed when an integrity pin is configured but the resolved artifact integrity is missing.

Suggested fix:

  • If expectedIntegrity is present and resolution.integrity is missing/empty, treat as an error (or set proceed: false) so callers abort installation.

Example:

const expectedIntegrity = normalizeIntegrity(params.expectedIntegrity);
const actualIntegrity = normalizeIntegrity(params.resolution.integrity);

​// If caller pinned integrity, require actual integrity to be present.
if (expectedIntegrity && !actualIntegrity) {
  const payload = params.createPayload({
    spec: params.spec,
    expectedIntegrity,
    actualIntegrity: "(missing)",
    resolution: params.resolution,
  });
  params.warn?.(payload);
  return { proceed: false, payload };
}

if (!expectedIntegrity || !actualIntegrity) return { proceed: true };
if (expectedIntegrity === actualIntegrity) return { proceed: true };
​// ... drift handling as before

Also consider adding a unit test that asserts install aborts when expectedIntegrity is set but resolution.integrity is absent.

2. 🟡 Spoofable git-workspace trust check enables local plugin loading in non-git directories
Property Value
Severity Medium
CWE CWE-345
Location src/commands/onboarding-plugin-install.ts:47-94

Description

ensureOnboardingPluginInstalled() gates the ability to use install.localPath (local plugin loading) on hasGitWorkspace().

However, hasTrustedGitWorkspace() considers a directory “trusted” if any ancestor contains a .git marker that is either:

  • a directory, or
  • a file containing gitdir: <path> where <path> merely resolves to an existing directory.

This does not validate that the referenced gitdir is an actual git repository/worktree (e.g., has HEAD, objects/, refs/, or passes git rev-parse). An attacker (or malicious project) can drop a .git file pointing to any existing directory to make the check succeed, even outside a real git repo.

Impact:

  • The onboarding flow may incorrectly treat an arbitrary folder as a trusted git workspace.
  • This can cause the UI to offer/select the local install path, leading to loading and executing plugin code from local disk when the product intended to only do so in trusted repo contexts.
  • While this often requires user interaction (choosing “local”) and a malicious localPath-targeted plugin directory being present, it materially increases the social-engineering attack surface around local plugin execution.

Vulnerable code:

function resolveGitDirectoryMarker(dir: string): string | null {
  ...
  const match = /^gitdir:\s*(.+)$/i.exec(content);
  ...
  return resolveRealDirectory(path.isAbsolute(gitDir) ? gitDir : path.resolve(dir, gitDir));
}

function hasTrustedGitWorkspace(root: string): boolean {
  ...
  for (let dir = realRoot; ; dir = path.dirname(dir)) {
    if (resolveGitDirectoryMarker(dir)) {
      return true;
    }
    ...
  }
}

Recommendation

Tighten the trust decision so it cannot be satisfied by an arbitrary .git file pointing at any directory.

Recommended approaches (pick one):

  1. Use git itself to validate the workspace:
import { execFileSync } from "node:child_process";

function isRealGitWorktree(dir: string): boolean {
  try {
    const out = execFileSync("git", ["-C", dir, "rev-parse", "--is-inside-work-tree"], {
      stdio: ["ignore", "pipe", "ignore"],
      encoding: "utf8",
    });
    return out.trim() === "true";
  } catch {
    return false;
  }
}
  1. If you must avoid invoking git, validate gitdir structure strictly:
  • require HEAD to exist and be a file
  • require objects/ and refs/ directories to exist
  • optionally validate permissions and that gitdir is not a symlink chain to unexpected locations

Also consider limiting the search to the provided root directory itself (not arbitrary ancestors), depending on the intended UX security boundary.

Finally, consider defaulting to npm install unless the local path is a bundled source or explicitly approved by the user with a stronger warning when outside a confirmed git worktree.


Analyzed PR: #70012 at commit f24193c

Last updated on: 2026-04-23T05:04:11Z

@greptile-apps

greptile-apps Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a shared ensureOnboardingPluginInstalled helper that consolidates the previously duplicated install logic from channel-setup/plugin-install.ts, and adds a new provider-install-catalog layer that lets provider auth choices appear in onboarding before runtime plugin loading. The auto-install-and-retry flow in applyAuthChoiceLoadedPluginProvider and the origin-priority dedup logic in the catalog are well-structured, and the config state management (tracking nextConfig vs enabledConfig across the enable/install/retry steps) is correct.

Confidence Score: 5/5

Safe to merge; all findings are minor style or coverage suggestions with no correctness impact.

No P0 or P1 issues found. The includeUntrustedWorkspacePlugins drop in resolvePreferredInstallsByPluginId is a correctness non-issue because the filtering is applied by resolveManifestProviderAuthChoices. The removed model-picker docs tests are a test-coverage gap but the underlying function is unchanged.

No files require special attention.

Comments Outside Diff (1)

  1. src/flows/provider-flow.test.ts, line 778-780 (link)

    P2 Coverage for resolveProviderModelPickerFlowContributions docs-lookup removed

    The two tests that exercised the docs-path for resolveProviderSetupFlowContributions and resolveProviderModelPickerFlowContributions were dropped in this PR (replaced with install-catalog tests). resolveProviderModelPickerFlowContributions itself was not changed and is still consumed by model-picker.runtime.ts, but its resolveProviderDocsById integration is now untested in this file. Worth adding back at least one case that asserts docs are still attached to runtime contributions.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/flows/provider-flow.test.ts
    Line: 778-780
    
    Comment:
    **Coverage for `resolveProviderModelPickerFlowContributions` docs-lookup removed**
    
    The two tests that exercised the docs-path for `resolveProviderSetupFlowContributions` and `resolveProviderModelPickerFlowContributions` were dropped in this PR (replaced with install-catalog tests). `resolveProviderModelPickerFlowContributions` itself was not changed and is still consumed by `model-picker.runtime.ts`, but its `resolveProviderDocsById` integration is now untested in this file. Worth adding back at least one case that asserts docs are still attached to runtime contributions.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/plugins/provider-install-catalog.ts
Line: 82-88

Comment:
**`includeUntrustedWorkspacePlugins` not forwarded to discovery**

`resolvePreferredInstallsByPluginId` only `Pick`s `workspaceDir` and `env` from `ProviderInstallCatalogParams`, so `includeUntrustedWorkspacePlugins` is silently dropped when building the install-metadata map. The filtering still happens at the `resolveManifestProviderAuthChoices` layer (line 118), so the final catalog result is correct — untrusted workspace choices are excluded — but the install-metadata scan still reads manifests for all discovered plugins including untrusted workspace ones. This is a minor inefficiency, and the parameter name on the type is misleading for future callers who expect it to gate discovery as well.

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/flows/provider-flow.test.ts
Line: 778-780

Comment:
**Coverage for `resolveProviderModelPickerFlowContributions` docs-lookup removed**

The two tests that exercised the docs-path for `resolveProviderSetupFlowContributions` and `resolveProviderModelPickerFlowContributions` were dropped in this PR (replaced with install-catalog tests). `resolveProviderModelPickerFlowContributions` itself was not changed and is still consumed by `model-picker.runtime.ts`, but its `resolveProviderDocsById` integration is now untested in this file. Worth adding back at least one case that asserts docs are still attached to runtime contributions.

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

Reviews (1): Last reviewed commit: "Merge branch 'main' into feat/onboarding..." | Re-trigger Greptile

Comment thread src/plugins/provider-install-catalog.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: 376d7fb6b6

ℹ️ 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/flows/provider-flow.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: c726add2be

ℹ️ 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".

@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: a4612a057f

ℹ️ 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/flows/provider-flow.ts Resolved
@vincentkoc

Copy link
Copy Markdown
Member Author

This also supersedes #70176.

#70176 explored the same install-on-demand direction through a separate channel-only extensions/manifest.json registry path. The work in this PR is the more general seam we want to keep:

  • shared onboarding installer
  • channel onboarding reuses it
  • provider onboarding also supports install-on-demand
  • the future external registry can plug into the same onboarding/catalog seam instead of introducing a parallel manifest stack

I reviewed #70176, closed it, and do not think we should bring its implementation across as-is.

@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: e89755d656

ℹ️ 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".

if (!installResult.installed) {
return { config: nextConfig };
}
nextConfig = installResult.cfg;

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.

P2 Badge Return updated config when post-install provider match fails

After a successful ensureOnboardingPluginInstalled call, this path updates nextConfig, but if provider resolution still fails afterward (for example, the installed plugin does not expose the selected auth choice at runtime), the function later returns null. The caller treats that as an unmatched choice and falls back to the original config, dropping the install/enable updates even though the plugin was already installed on disk.

Useful? React with 👍 / 👎.

Comment thread src/flows/provider-flow.ts Outdated
Comment on lines +74 to +78
return resolveProviderInstallCatalogEntries({
...params,
includeUntrustedWorkspacePlugins: false,
})
.filter((entry) => includesProviderFlowScope(entry.onboardingScopes, scope))

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.

P2 Badge Filter install-catalog choices that cannot be enabled

This contribution builder only filters by scope and untrusted workspace state, so it can still expose install-catalog provider choices that are blocked by global plugin disablement or denylist policy. Those selections are dead ends because applyAuthChoiceLoadedPluginProvider immediately exits when enablePluginInConfig reports the plugin cannot be enabled, so onboarding presents options that can never complete.

Useful? React with 👍 / 👎.

@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: c68302b510

ℹ️ 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".

workspaceDir,
});
if (!installResult.installed) {
return { config: installResult.cfg, retrySelection: true };

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.

P1 Badge Handle retrySelection in setup wizard auth loop

applyAuthChoiceLoadedPluginProvider now returns { retrySelection: true } when install-on-demand is skipped or fails, but src/wizard/setup.ts still treats any applyAuthChoice(...) result as final and continues onboarding instead of re-prompting for auth. This means users who pick an install-catalog provider and then decline/install-fail are pushed forward with no provider configured and no chance to choose an alternative in the same setup run (unlike configure.gateway-auth and agents.commands.add, which were updated to loop on retrySelection).

Useful? React with 👍 / 👎.

@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: c4d51bed44

ℹ️ 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 on lines +66 to +68
function isWithinBaseDirectory(baseDir: string, targetPath: string): boolean {
const relative = path.relative(baseDir, targetPath);
return relative === "" || (!relative.startsWith(`..${path.sep}`) && relative !== "..");

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.

P1 Badge Reject cross-drive targets in base-directory check

isWithinBaseDirectory treats a target as inside the trusted root whenever path.relative does not start with .., but on Windows path.relative('C:\\repo', 'D:\\evil') returns an absolute-like D:\\evil string that passes this check. In that case a manifest localPath on another drive is incorrectly accepted as trusted, so onboarding can offer and enable a local plugin path outside the intended workspace/cwd boundary.

Useful? React with 👍 / 👎.

@vincentkoc
vincentkoc merged commit f67e48e into main Apr 23, 2026
125 of 129 checks passed
@vincentkoc
vincentkoc deleted the feat/onboarding-plugin-auto-install branch April 23, 2026 05:05

@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: f24193ce81

ℹ️ 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/wizard/setup.ts
Comment on lines +573 to +577
if (authResult.retrySelection) {
if (authChoiceFromPrompt) {
continue;
}
break;

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.

P2 Badge Abort fixed-choice setup when auth install asks for retry

When setup is launched with an explicit authChoice (so authChoiceFromPrompt is false), a provider install failure/skip now returns retrySelection: true, but this branch just breaks and continues the wizard instead of failing or re-prompting. In practice, openclaw setup --auth-choice <install-catalog choice> can silently finish without configuring auth if install-on-demand is declined or fails, which is a regression from the expected semantics of an explicit auth selection.

Useful? React with 👍 / 👎.

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

commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant