Skip to content

feat(crestodian): run CLI harnesses on the agent loop via a ring-zero MCP server#100029

Merged
steipete merged 1 commit into
mainfrom
claude/zealous-colden-0558cc
Jul 5, 2026
Merged

feat(crestodian): run CLI harnesses on the agent loop via a ring-zero MCP server#100029
steipete merged 1 commit into
mainfrom
claude/zealous-colden-0558cc

Conversation

@steipete

@steipete steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Related: #99935

What Problem This Solves

Crestodian's conversational onboarding runs the real embedded agent loop with a single ring-zero crestodian tool, but CLI harnesses (Claude Code, Gemini CLI) reject OpenClaw's restricted toolsAllow and fail closed. On machines whose only usable model is a local CLI (the most common fresh-machine case: Claude Code installed, no API keys), Crestodian silently degraded to the bounded single-turn planner: no tool calls, no multi-turn memory, no in-loop config repair.

Why This Change Was Made

CLI harnesses cannot enforce an OpenClaw tool allow-list, but they can be handed a restricted MCP surface. The openclaw-tools-serve stdio MCP entry now serves the ring-zero crestodian tool on request (OPENCLAW_TOOLS_MCP_TOOLS=crestodian), and Crestodian CLI runs inject it as the run's exclusive MCP config: no loopback server, no plugin or user MCP servers, applied with --strict-mcp-config for Claude Code. The server keeps the openclaw name so existing per-backend tool pre-approvals apply unchanged. The gate is a typed crestodianTool run parameter set only by the Crestodian agent runner, so normal agent runs can never see the tool. Native CLI tools remain under the harness's own permission policy; the trust model is documented in docs/cli/crestodian.md. Embedded runtimes and the Codex app-server harness keep the hard toolsAllow enforcement.

This PR includes the five commits from #99935 (claude/wizardly-ishizaka-7410c7) rebased onto current main; identical patches drop automatically if that PR lands first.

User Impact

Crestodian conversations on Claude Code or Gemini CLI models (configured or auto-detected) now run the full agent loop: real tool calls with approval-gated, audited config mutations, post-write validation fed back into the loop, and genuine multi-turn memory with native CLI session resume. The single-turn planner remains as fallback when no loop-capable backend works, and deterministic typed commands still work with no model at all.

Evidence

  • Live Codex leg (real inference, full loop): drove CrestodianChatEngine with the Codex app-server fallback on this machine. The loop invoked the ring-zero tool (start:crestodian / result:crestodian agent events), replied with grounded status facts ("gateway ws://127.0.0.1:18789 unreachable"), and the second turn answered a memory question from the persistent session in 3.3s.
  • Live Claude leg (wiring): real Claude Code 2.1.198 spawned by the CLI runner loaded the generated exclusive MCP config (--strict-mcp-config, init event lists the openclaw server; argv captured in run logs). Model inference itself was blocked on this host because the standalone claude CLI is logged out - the already-shipped planner path fails identically there, confirming an environment issue rather than a regression.
  • MCP protocol probe against the built dist/mcp/openclaw-tools-serve.js (the exact transport CLI harnesses use): tools/list returns exactly ["crestodian"], crestodian(status) executes and returns real status output, and an unapproved gateway_restart is refused with needs-approval, proving the approval gate holds over MCP.
  • Focused suites: chat-engine (16), prepare (61, includes a new ring-zero test proving no loopback + crestodian-only MCP config), bundle-mcp (17), openclaw-tools-serve (7), plus crestodian tool/assistant/operations suites - all green after rebase onto main.
  • pnpm tsgo, pnpm check:test-types, oxlint, pnpm check:import-cycles, and pnpm build (no ineffective-dynamic-import findings) all pass; Codex autoreview (gpt-5.5) exited clean with no actionable findings.
  • The crestodian Docker planner lane is unaffected: one-shot --message mode never enters the chat engine, so the new loop cannot intercept its planner flow.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes commands Command implementations agents Agent runtime and tooling extensions: codex size: XL maintainer Maintainer-authored PR labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed July 4, 2026, 7:22 PM ET / 23:22 UTC.

Summary
The PR routes Crestodian CLI-harness onboarding through an exclusive ring-zero MCP server and includes broader Crestodian onboarding, gateway, macOS, docs, and test changes rebased from the related onboarding PR.

Reproducibility: yes. The PR defects are source-reproducible by tracing the ring-zero tool approval path, macOS chat host, plugin install parser/executor, channel setup hook path, CLI inference detection, setup flag dispatch, and tool schema mapping.

Review metrics: 2 noteworthy metrics.

  • Public setup surfaces: 1 default route changed, 1 CLI flag added, 1 gateway RPC added, 2 MCP env selectors added. These setup and operator surfaces affect fresh installs, upgrades, and copied automation snippets before merge.
  • Ring-zero mutation surface: 1 model-visible built-in tool with persistent actions added. The new tool can mutate local config/setup state, so approval, audit, and supply-chain boundaries matter beyond green tests.

Stored data model
Persistent data-model change detected: migration/backfill/repair: src/agents/tools/crestodian-tool.ts, migration/backfill/repair: src/cli/program/register.onboard.ts, serialized state: apps/macos/Tests/OpenClawIPCTests/OnboardingWizardStepViewTests.swift, serialized state: src/agents/cli-runner/bundle-mcp.test.ts, serialized state: src/agents/cli-runner/prepare.test.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦞 diamond lobster
Patch quality: 🧂 unranked krab
Result: blocked by patch quality or review findings.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

Mantis proof suggestion
A real macOS onboarding recording would materially prove the visible Crestodian chat, sensitive-input handling, paused local mode, and setup completion gating after fixes. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: record macOS onboarding Crestodian chat through sensitive setup, paused local mode, setup completion gating, and timeout recovery after fixes.

Risk before merge

  • [P1] Merging as-is can let model-supplied tool arguments authorize privileged Crestodian mutations instead of requiring host-side proof of user approval.
  • [P1] The macOS onboarding chat can expose setup secrets in visible chat history, and approved plugin installs can still accept npm-prefixed local or URL specs through an intended restricted path.
  • [P1] The branch changes default onboarding, public setup flag routing, provider detection, gateway admin RPCs, and MCP environment selectors, so fresh-install and upgrade behavior need explicit compatibility proof.
  • [P1] CLI harness native tools remain under Claude/Gemini policy rather than OpenClaw toolsAllow; that trust model still needs explicit maintainer acceptance after source blockers are fixed.
  • [P1] The PR overlaps heavily with feat(crestodian): conversational agent-loop onboarding across CLI, web install, and macOS app #99935 and is currently merge-conflicting, so merge order and branch ownership are unresolved.

Maintainer options:

  1. Fix blockers and refresh proof (recommended)
    Repair the approval, sensitive-input, plugin-spec, setup-routing, channel-finalization, paused-mode, setup-gating, logged-out CLI, create_agent, and timeout issues, then rerun focused macOS onboarding and MCP protocol proof.
  2. Split after the broader onboarding PR
    Land or close the broader Crestodian onboarding PR first, then carry only the CLI-harness MCP bridge in a smaller follow-up if maintainers want lower blast radius.
  3. Accept the harness trust model explicitly
    After source blockers are fixed, maintainers may intentionally accept that Claude/Gemini native tools stay under their own policy while OpenClaw exposes only the Crestodian MCP tool.

Next step before merge

  • [P2] Protected-label, merge-conflicted, security-sensitive onboarding work needs author fixes plus maintainer review of the ring-zero MCP trust model and related-PR overlap.

Security
Needs attention: The diff still has concrete security-sensitive defects in ring-zero approval handling, setup secret display, and approved plugin-install spec validation.

Review findings

  • [P1] Enforce approvals outside model-supplied tool args — src/agents/tools/crestodian-tool.ts:191-203
  • [P1] Do not echo sensitive wizard replies — apps/macos/Sources/OpenClaw/OnboardingCrestodianChat.swift:49
  • [P1] Reject npm-prefixed local plugin specs — src/crestodian/operations.ts:371-373
Review details

Best possible solution:

Fix the source blockers, resolve the merge conflict, refresh macOS/MCP/setup proof, and have maintainers either accept the ring-zero MCP trust model or split the CLI-harness bridge after #99935 lands.

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

Yes. The PR defects are source-reproducible by tracing the ring-zero tool approval path, macOS chat host, plugin install parser/executor, channel setup hook path, CLI inference detection, setup flag dispatch, and tool schema mapping.

Is this the best way to solve the issue?

No. The exclusive MCP approach is plausible, but this branch is not the best mergeable solution until the security, compatibility, provider-selection, channel-finalization, paused-mode, setup-gating, timeout, and related-PR overlap issues are resolved.

Full review comments:

  • [P1] Enforce approvals outside model-supplied tool args — src/agents/tools/crestodian-tool.ts:191-203
    The ring-zero MCP tool trusts the model-provided approved argument. A model can emit approved: true for mutating actions and bypass the chat engine's deterministic pending-approval flow, so approval proof must come from host-side state or an unforgeable token.
    Confidence: 0.94
  • [P1] Do not echo sensitive wizard replies — apps/macos/Sources/OpenClaw/OnboardingCrestodianChat.swift:49
    Hosted setup can ask for sensitive text, but this appends the raw input to visible chat history before the gateway can identify the step as sensitive. Current onboarding uses SecureField for sensitive steps, so tokens or passwords can remain visible in the transcript.
    Confidence: 0.94
  • [P1] Reject npm-prefixed local plugin specs — src/crestodian/operations.ts:371-373
    This guard rejects raw file and URL specs, but the existing installer strips an npm: prefix before install handling. Values like npm:file:../pkg or npm:https://example.invalid/pkg bypass the intended Crestodian no-local/no-URL boundary.
    Confidence: 0.95
  • [P2] Run channel post-write hooks after chat setup — src/crestodian/chat-engine.ts:94-103
    setupChannels can register afterConfigWritten hooks, and the normal channel add path drains them after committing config. The chat path passes no collector and writes directly, so setup flows that need post-write finalization silently skip it.
    Confidence: 0.89
  • [P2] Respect paused local mode before starting Crestodian — apps/macos/Sources/OpenClaw/OnboardingView+CrestodianSetup.swift:43
    The old macOS wizard presented a paused state instead of proceeding with local setup work. This page starts the Crestodian RPC as soon as the page is reached and the CLI is installed, so onboarding can reactivate local gateway work while OpenClaw is paused.
    Confidence: 0.86
  • [P2] Ignore logged-out CLI detections during setup — src/crestodian/operations.ts:511-513
    detectInferenceBackends marks definitively logged-out CLIs with credentials: false, but setup still chooses the first non-existing-model candidate. A user with only an installed but logged-out CLI can be configured with an unusable default model.
    Confidence: 0.88
  • [P2] Map the advertised create_agent action — src/agents/tools/crestodian-tool.ts:39
    The tool schema advertises create_agent, but operationForAction has no matching case for it, so model calls hit the default unknown-action error instead of the existing create-agent operation executor.
    Confidence: 0.9
  • [P2] Route all setup flags through classic onboarding — src/commands/onboard.ts:32-39
    This predicate keeps only a small subset of explicit setup flags on the classic wizard path. Interactive flags such as --gateway-port, --gateway-bind, --install-daemon, --skip-bootstrap, or --skip-channels fall through to conversational onboarding, which only forwards workspace and can silently ignore the requested setup contract.
    Confidence: 0.91
  • [P2] Require Crestodian setup before advancing — apps/macos/Sources/OpenClaw/Onboarding.swift:173-174
    The setup page is still part of the local onboarding order, but canAdvance only checks the CLI gate. A first-run user can click through without saying yes, and finish() can mark onboarding complete before config, workspace, and gateway defaults exist.
    Confidence: 0.88
  • [P2] Keep the app timeout above the server deadline — apps/macos/Sources/OpenClaw/OnboardingCrestodianChat.swift:70-73
    The app request times out at 120s, while the gateway chat engine can keep an agent-loop turn alive longer. A slow valid setup turn can leave the app showing an error while the gateway continues and drops the useful reply from the UI path.
    Confidence: 0.83

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P0: The PR targets first-run onboarding and auth/provider setup, where a non-technical user can otherwise be blocked before first useful run.
  • merge-risk: 🚨 compatibility: The diff changes default onboarding behavior, setup flag routing, gateway RPC shape, CLI flags, and MCP environment selectors across install and upgrade paths.
  • merge-risk: 🚨 auth-provider: Crestodian model detection and CLI-harness routing affect auth/provider setup and can currently select a definitively logged-out CLI as the configured model.
  • merge-risk: 🚨 security-boundary: The PR adds a ring-zero MCP setup tool and still has concrete approval, sensitive-data, and plugin-install boundary defects.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦞 diamond lobster and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body includes after-fix live Codex loop output, Claude CLI wiring output, MCP protocol probe output, and focused suite results; proof intake is sufficient but should be refreshed after source blockers are fixed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix live Codex loop output, Claude CLI wiring output, MCP protocol probe output, and focused suite results; proof intake is sufficient but should be refreshed after source blockers are fixed.
Evidence reviewed

Security concerns:

  • [high] Model-supplied approval can authorize persistent mutations — src/agents/tools/crestodian-tool.ts:191
    The ring-zero tool accepts approved from model arguments and passes approved persistent operations to executeCrestodianOperation, so approval is not anchored in host-side user confirmation.
    Confidence: 0.94
  • [high] Sensitive wizard replies are stored in chat history — apps/macos/Sources/OpenClaw/OnboardingCrestodianChat.swift:49
    The macOS chat appends raw user input to visible message history before hosted setup can mark a prompt sensitive, regressing the existing no-echo handling for setup secrets.
    Confidence: 0.94
  • [high] npm-prefixed local and URL plugin specs bypass the guard — src/crestodian/operations.ts:371
    Crestodian rejects raw local or URL specs, but npm-prefixed forms can reach the existing installer after prefix stripping, allowing approved package specs the new boundary meant to block.
    Confidence: 0.95

What I checked:

  • AGENTS policy applied: Root plus scoped AGENTS.md files for agents, agent tools, gateway, gateway server methods, docs, and extensions were read; the applicable policy treats setup, provider routing, gateway RPCs, MCP, config/defaults, and security-boundary changes as compatibility-sensitive review surfaces. (AGENTS.md:25, 1c9e998d98f8)
  • Live PR state: Live GitHub reports this PR open, not draft, head 896139f, mergeStateStatus DIRTY, protected maintainer label, proof sufficient label, and merge-risk labels already present. (896139fafab1)
  • Prior review continuity: The current head is only one i18n inventory commit ahead of the previous reviewed SHA, so the source findings from the prior review cycle remain present unless fixed in files outside that compare, which they were not. (apps/.i18n/native-source.json, 896139fafab1)
  • Approval bypass source: The Crestodian tool exposes approved as a model-supplied parameter and treats params.approved === true as authorization for persistent operations before passing approved: persistent to the operation executor. (src/agents/tools/crestodian-tool.ts:59, 896139fafab1)
  • Sensitive input echo source: The macOS chat host appends every user reply into visible message history before the gateway can identify whether the active hosted setup step is sensitive. (apps/macos/Sources/OpenClaw/OnboardingCrestodianChat.swift:49, 896139fafab1)
  • Current secure-field behavior: Current main's wizard uses SecureField when a step is marked sensitive, so the chat replacement weakens an existing setup-secret behavior contract. (apps/macos/Sources/OpenClaw/OnboardingWizard.swift:304, 1c9e998d98f8)

Likely related people:

  • steipete: Live PR metadata plus current-main path history show recent work on macOS onboarding, CLI onboarding docs, and Codex dynamic tools around the same setup surface. (role: feature owner and recent area contributor; confidence: high; commits: 6a7b62889e8c, 3d6a2216ea77, d3cabb0fc6bb; files: apps/macos/Sources/OpenClaw/OnboardingWizard.swift, extensions/codex/src/app-server/dynamic-tool-build.ts, src/commands/onboard.ts)
  • vincentkoc: Recent current-main commits touch onboarding command reexports, exec policy layering, and agent helper cleanup, making this a likely review route for setup and agent-runtime contract changes. (role: recent adjacent owner; confidence: medium; commits: 12eeb5cb63c9, b60f63150f51, eb9318e9535a; files: src/commands/onboard.ts, src/agents/agent-tools.ts)
  • joshavant: Recent current-main work scoped OpenClaw MCP tools to caller identity, adjacent to this PR's new exclusive MCP tool surface. (role: adjacent MCP owner; confidence: medium; commits: cee2aca40912; files: src/mcp/openclaw-tools-serve.ts)
  • hxy91819: Recent current-main channel setup hardening touched the same setup/import boundary that the chat-hosted channel setup now bypasses for post-write hooks. (role: recent channel setup hardening contributor; confidence: medium; commits: 004835f4c7f4; files: src/commands/channels/add.ts, src/commands/onboard-channels.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (8 earlier review cycles)
  • reviewed 2026-07-04T17:20:43.294Z sha 7340ace :: found issues before merge. :: [P1] Do not echo sensitive wizard replies | [P1] Reject npm-prefixed local plugin specs | [P2] Run channel post-write hooks after chat setup | [P2] Respect paused local mode before starting Crestodian
  • reviewed 2026-07-04T17:28:45.548Z sha 7340ace :: found issues before merge. :: [P1] Do not echo sensitive wizard replies | [P1] Reject npm-prefixed local plugin specs | [P2] Run channel post-write hooks after chat setup | [P2] Respect paused local mode before starting Crestodian | [P2] Ignore logged-out CLI detections during setup | [P2] Map the advertised create_agent action
  • reviewed 2026-07-04T17:34:51.600Z sha 25fd978 :: found issues before merge. :: [P1] Do not echo sensitive wizard replies | [P1] Reject npm-prefixed local plugin specs | [P2] Run channel post-write hooks after chat setup | [P2] Respect paused local mode before starting Crestodian | [P2] Ignore logged-out CLI detections during setup | [P2] Map the advertised create_agent action
  • reviewed 2026-07-04T19:00:56.420Z sha 8479155 :: found issues before merge. :: [P1] Do not echo sensitive wizard replies | [P1] Reject npm-prefixed local plugin specs | [P2] Run channel post-write hooks after chat setup | [P2] Respect paused local mode before starting Crestodian | [P2] Ignore logged-out CLI detections during setup | [P2] Map the advertised create_agent action
  • reviewed 2026-07-04T19:09:15.123Z sha 8479155 :: found issues before merge. :: [P1] Do not echo sensitive wizard replies | [P1] Reject npm-prefixed local plugin specs | [P2] Run channel post-write hooks after chat setup | [P2] Respect paused local mode before starting Crestodian | [P2] Ignore logged-out CLI detections during setup | [P2] Map the advertised create_agent action
  • reviewed 2026-07-04T22:47:03.353Z sha 9071127 :: found issues before merge. :: [P1] Do not echo sensitive wizard replies | [P1] Reject npm-prefixed local plugin specs | [P2] Run channel post-write hooks after chat setup | [P2] Respect paused local mode before starting Crestodian | [P2] Ignore logged-out CLI detections during setup | [P2] Map the advertised create_agent action
  • reviewed 2026-07-04T22:54:15.288Z sha 9071127 :: found issues before merge. :: [P1] Do not echo sensitive wizard replies | [P1] Reject npm-prefixed local plugin specs | [P2] Run channel post-write hooks after chat setup | [P2] Respect paused local mode before starting Crestodian | [P2] Ignore logged-out CLI detections during setup | [P2] Map the advertised create_agent action
  • reviewed 2026-07-04T23:15:43.262Z sha 896139f :: found issues before merge. :: [P1] Enforce approvals outside model-supplied tool args | [P1] Do not echo sensitive wizard replies | [P1] Reject npm-prefixed local plugin specs | [P2] Run channel post-write hooks after chat setup | [P2] Respect paused local mode before starting Crestodian | [P2] Ignore logged-out CLI detections during setup

@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: 7340aceccf

ℹ️ 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 +511 to +513
const detected: InferenceBackendCandidate | undefined = candidates.find(
(candidate) => candidate.kind !== "existing-model",
);

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 Ignore logged-out CLI detections during setup

When the only detected inference backend is an installed-but-logged-out CLI, detectInferenceBackends() returns it with credentials: false, but this selection still accepts it and setup writes that model as the default. On Linux/non-macOS machines with claude or codex installed but no stored login or API key, first-run onboarding will claim it can reuse that backend and leave the user configured with an unusable default model instead of reporting that no usable model was found or asking them to log in.

Useful? React with 👍 / 👎.

"set_default_model",
"config_set",
"config_set_ref",
"create_agent",

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 Map the advertised create_agent action

When the model follows the tool schema/system prompt and calls create_agent, operationForAction() has no matching case for this advertised action, so the call falls into the default branch and returns crestodian: unknown action "create_agent" instead of reaching the existing create-agent executor in operations.ts. This breaks agent creation specifically in the new ring-zero tool path; either map the action to { kind: "create-agent", ... } or stop advertising it.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 4, 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: 25fd978229

ℹ️ 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/onboard.ts Outdated
Comment on lines +34 to +38
opts.classic === true ||
opts.flow !== undefined ||
opts.mode === "remote" ||
opts.importFrom !== undefined ||
opts.authChoice !== undefined

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 Route all setup flags through classic onboarding

When an interactive user passes setup-affecting flags outside this small list, such as --gateway-port, --gateway-bind, --skip-bootstrap, --install-daemon, or --skip-channels, this predicate returns false and setupWizardCommand falls through to the new conversational path; runConversationalOnboarding only forwards workspace, so those public CLI options are silently ignored and quickstart defaults are written instead. Please either route all explicit setup flags to the classic wizard or reject/handle them in the Crestodian bootstrap path.

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: 9071127150

ℹ️ 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 +173 to +174
var canAdvance: Bool {
!self.isCLIBlocking && !self.isWizardBlocking
!self.isCLIBlocking

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 Require Crestodian setup before advancing

In local onboarding, pageOrder still puts the Crestodian setup page before permissions/finish, but canAdvance now only checks the CLI gate, so the Next button is enabled on the setup page as soon as the CLI is installed. A first-run user can click through without saying yes, and finish() will mark onboarding complete even though applyCrestodianSetup never created the config/workspace/gateway defaults; the removed wizard blocking state prevented exactly that path.

Useful? React with 👍 / 👎.

Comment on lines +70 to +73
let data = try await GatewayConnection.shared.request(
method: "crestodian.chat",
params: params,
timeoutMs: 120_000)

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 Keep the app timeout above Crestodian's server deadline

This macOS request timeout is shorter than the server-side Crestodian agent-turn deadline (AGENT_TURN_DEADLINE_MS = 180_000), so any valid slow CLI/tool turn that finishes between 120s and 180s will surface as an onboarding error in the app while the gateway may still complete the operation and send a reply the UI has already dropped. Align the client timeout with the server deadline, or lower the server deadline, so long turns do not leave onboarding out of sync.

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: 896139fafa

ℹ️ 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/agents/tools/crestodian-tool.ts Outdated
const params = (args ?? {}) as Record<string, unknown>;
const operation = operationForAction(params);
const persistent = isPersistentCrestodianOperation(operation);
if (persistent && params.approved !== 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 Enforce approvals outside model-supplied tool args

When Crestodian is running through the new MCP tool path, this approval gate trusts approved from the tool arguments, which are generated by the model. In any agent-loop turn where the model emits approved: true without a prior explicit user confirmation, mutating actions such as setup, config_set, doctor_fix, or gateway restarts are passed to executeCrestodianOperation as approved and can change local state, bypassing the chat engine's deterministic pending-approval flow. The approval proof needs to come from host-side conversation state or a nonce/token the model cannot mint by itself.

Useful? React with 👍 / 👎.

… MCP server

CLI harnesses (claude-cli, gemini-cli) cannot enforce runtime toolsAllow, so
Crestodian previously fell back to the single-turn planner for them. The
openclaw-tools stdio MCP entry can now serve the ring-zero crestodian tool
(OPENCLAW_TOOLS_MCP_TOOLS=crestodian), and Crestodian CLI runs inject it as the
run's exclusive MCP surface: no loopback server, no plugin/user MCP servers,
with the server kept under the "openclaw" name so existing tool pre-approvals
apply. agent-turn routes configured or detected CLI-harness models through
runCliAgent with native session resume across turns, keeps embedded toolsAllow
enforcement for API-key models and the Codex app-server fallback, and still
degrades to the planner when no loop backend works.

The host-verified approval contract survives the process boundary: per-turn
arming and the pending exact-operation hash travel to the stdio server via the
generated MCP config env, and the host mirrors proposal transitions back from
harness tool events (denial registers the hash, mismatch voids it, execution
consumes it) so a generic yes can never authorize a different mutation. The
trust model (the CLI owns its native tools) is documented in
docs/cli/crestodian.md.
@steipete
steipete force-pushed the claude/zealous-colden-0558cc branch from 896139f to 79ca424 Compare July 5, 2026 08:59
@steipete
steipete merged commit 3957ccb into main Jul 5, 2026
24 of 25 checks passed
@steipete
steipete deleted the claude/zealous-colden-0558cc branch July 5, 2026 08:59
@openclaw-barnacle openclaw-barnacle Bot removed app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime labels Jul 5, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: L and removed cli CLI command changes commands Command implementations extensions: codex size: XL labels Jul 5, 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: 79ca424c2a

ℹ️ 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 +180 to +186
const args =
typeof evt.data.args === "object" && evt.data.args !== null
? (evt.data.args as Record<string, unknown>)
: {};
const transition = resolveCrestodianProposalTransition({
args,
resultText: extractToolResultText(evt.data.result) ?? "",

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 Preserve CLI tool args before mirroring approvals

When Crestodian runs through the CLI MCP path, the CLI event stream only includes tool arguments on the start event, while the result event has toolCallId, name, isError, and result but no args (checked src/agents/cli-runner/execute.ts:945-985). This result-only mirror therefore passes {} into resolveCrestodianProposalTransition, so the host never records the needs-approval proposal hash from the subprocess; on the user's next yes, the new subprocess starts without OPENCLAW_TOOLS_MCP_CRESTODIAN_PROPOSAL and every approved mutating action mismatches instead of executing. Store args by toolCallId from the start event or include them on the result event before resolving the transition.

Useful? React with 👍 / 👎.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 6, 2026
… MCP server (openclaw#100029)

CLI harnesses (claude-cli, gemini-cli) cannot enforce runtime toolsAllow, so
Crestodian previously fell back to the single-turn planner for them. The
openclaw-tools stdio MCP entry can now serve the ring-zero crestodian tool
(OPENCLAW_TOOLS_MCP_TOOLS=crestodian), and Crestodian CLI runs inject it as the
run's exclusive MCP surface: no loopback server, no plugin/user MCP servers,
with the server kept under the "openclaw" name so existing tool pre-approvals
apply. agent-turn routes configured or detected CLI-harness models through
runCliAgent with native session resume across turns, keeps embedded toolsAllow
enforcement for API-key models and the Codex app-server fallback, and still
degrades to the planner when no loop backend works.

The host-verified approval contract survives the process boundary: per-turn
arming and the pending exact-operation hash travel to the stdio server via the
generated MCP config env, and the host mirrors proposal transitions back from
harness tool events (denial registers the hash, mismatch voids it, execution
consumes it) so a generic yes can never authorize a different mutation. The
trust model (the CLI owns its native tools) is documented in
docs/cli/crestodian.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant