Skip to content

fix: target Control UI repairs at the detected checkout - #137354

Merged
steipete merged 1 commit into
mainfrom
task294/maintenance-guidance-20260903
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
task294/maintenance-guidance-20260903

Conversation

@steipete

@steipete steipete commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #137345.

Additional instructions

Maintainers can edit this repository-owned branch.

What Problem This Solves

Fixes an issue where users following Doctor's Control UI repair instructions could run an unrelated project's build script when their terminal was outside the detected OpenClaw checkout. Doctor knew which checkout needed repair, but its manual pnpm ui:build instruction discarded that information. The asset owner's build/development log had the same omission, and the Gateway's unresolved-root fallback suggested a source build without identifying a checkout.

Why This Change Was Made

Manual source commands now carry the already-discovered root through one shared pnpm --dir <checkout> formatter. The change reuses POSIX quoting and factors the existing PowerShell literal handling into a shared primitive. It does not change the automatic builder, which already runs the absolute UI script with the correct working directory.

Packaged installations without UI sources still receive reinstall guidance. When the Gateway cannot resolve its assets after a build, it points to Doctor/reinstallation rather than an unqualified source build. No configuration, dependency, protocol, storage, or service-lifecycle behavior changes.

User Impact

Operators can copy the complete displayed build command from another directory without accidentally running that directory's project script. Source-root paths containing spaces and apostrophes remain usable. Commands use POSIX quoting on Unix and PowerShell quoting on Windows; existing installation-target handoffs retain their behavior.

Evidence

Reviewed and built head: 6359b13f04f1a3c19290217ccf66169569f86718.

Actual built CLI before/after: with fresh private HOME, config, state, workspace, logs, and a foreign working directory outside any pnpm workspace, the unchanged build returned a healthy result, then the expected missing-assets warning. Its displayed command exited zero but wrote the unrelated project's marker and left OpenClaw's index missing. Restoring the original index restored the healthy control. On the final build, the displayed root-bound command rebuilt OpenClaw's actual UI assets in 7.1 seconds, left the unrelated project untouched, and the next diagnostic returned ok:true with no findings. Config bytes stayed unchanged, no state database was created, and every process group drained.

Regression and sibling proof: four regressions were observed before production edits. The final seven suites pass 107/107, zero failures or skips, covering missing/stale guidance, automatic source builds, packaged recovery, Gateway root lifecycle, and the existing triage/update-triage quoting callers. Fourteen additional real-shell command executions passed across Bash, Zsh, Fish, and PowerShell on macOS, including straight and typographic apostrophes in source paths. PowerShell execution exercised Windows presentation syntax; this is not a native-Windows OS proof claim.

The following source-relative commands were run through an isolated environment wrapper with Node 24.15.0 and pnpm 12.1.0. JSON-report output destinations are omitted here.

node scripts/run-vitest.mjs src/commands/doctor-ui.test.ts src/commands/doctor-ui.repair.test.ts src/infra/control-ui-assets.test.ts src/gateway/server-control-ui-root.resolve.test.ts src/cli/quote-cli-arg.test.ts src/commands/triage.test.ts src/infra/update-triage.test.ts --reporter=json
node scripts/check-changed.mjs -- docs/cli/doctor.md src/cli/installation-target-format.ts src/cli/quote-cli-arg.ts src/commands/doctor-ui.test.ts src/commands/doctor-ui.ts src/gateway/server-control-ui-root.resolve.test.ts src/gateway/server-control-ui-root.ts src/infra/control-ui-assets.test.ts src/infra/control-ui-assets.ts
pnpm build:ci-artifacts

The complete changed-file gate passed. The final artifact build passed with no ineffective-dynamic-import warning; existing dependency eval/plugin-timing diagnostics were retained. Fresh independent Codex autoreview of the final nine-file patch was scoped-clean at P0, with no findings.

Validation notes: the new worktree initially lacked local tool binaries, so its locked dependencies were installed without manifest/version changes. That exposed a separate Vitest 4.1.11 cache-invalidation ordering defect after the installed-lock identity changed. The failure and cache evidence were preserved, Vitest's own cache-clear operation was limited to task-owned caches, and the original test order then passed. The upstream cache lifecycle is a named follow-up, not a fix claimed by this PR. Two CLI fixture setup attempts also exposed inherited pnpm workspace discovery; the successful proofs use non-repository temporary directories. No cache policy, timeout, or dependency patch was changed to make this repair pass.

Production: +24/-9 (net +15). Tests: +68/-4 (net +64). Docs: +12. Production growth provides shared source-root-bound commands for two existing owners and reuses the existing shell-literal contract instead of adding another escaping implementation.

This is CLI/log guidance, not a rendered UI layout change. Exact-head CI and native review-artifact validation passed. Native preparation and merge follow.

Maintainer review disposition

The latest ClawSweeper review found no patch or security defect and identified this as the best owner-boundary fix. Its two remaining prompts are addressed as follows:

  • Production growth: accepted as the concrete capability needed to make the displayed command target its already-discovered source root. The implementation has one root-bound renderer shared by Doctor and the asset owner, and it factors the existing PowerShell literal contract rather than creating a second escaping path. Automatic execution is unchanged. A prose-only directory prerequisite would leave copy-pasted commands unsafe from another project; using the installation-state formatter would add unrelated state selectors. The final production delta remains +24/-9 (net +15), with no further rendering path added.
  • Data-model compatibility proof: not applicable. The two flagged files change only command/message projection and its import. No schema, migration, backfill, database access, stored representation, retention, or recovery policy changes. The automatic repair call and Gateway state transitions remain unchanged. The built CLI proof additionally verified unchanged config bytes and no state database creation. No migration was run or is required for this patch.

Exact-head CI run 33768095321 completed successfully on 6359b13f04f1a3c19290217ccf66169569f86718, attempt 1, with no unsuccessful or pending jobs. These are evidence/disposition updates only; the reviewed source head has not changed.

Bind Doctor and asset-owner manual build/development instructions to the
already-discovered checkout with pnpm --dir. Reuse POSIX and PowerShell
literal quoting without changing automatic builds or packaged recovery.
When the Gateway cannot resolve its assets, recommend Doctor/reinstall
instead of a source build with no known working directory.

Closes #137345.

Validated with 107 focused tests, the complete changed-file gate, real
shell command execution, and independent scoped review. The built
pre-fix CLI reproduces the wrong-directory execution with private state.
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review September 3, 2026 14:38
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes commands Command implementations size: S maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 10:46 AM ET / 14:46 UTC.

ClawSweeper review

What this changes

This PR makes manual Control UI build and development guidance run in the detected OpenClaw source checkout, with shared POSIX and PowerShell-safe quoting.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open. Current main still emits unqualified Control UI build commands, while this focused branch binds both Doctor and asset-owner guidance to the detected checkout without changing automatic builds or packaged-install recovery; no blocking patch defect was found.

Priority: P2
Reviewed head: 6359b13f04f1a3c19290217ccf66169569f86718

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with a real-shell regression test and no supported correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This repository-member PR is exempt from the external contributor proof gate; its submitted evidence nevertheless describes an after-fix built-CLI run from a foreign directory that rebuilt the detected checkout and left the unrelated project untouched.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This repository-member PR is exempt from the external contributor proof gate; its submitted evidence nevertheless describes an after-fix built-CLI run from a foreign directory that rebuilt the detected checkout and left the unrelated project untouched.
Evidence reviewed 6 items Current main remains affected: Current main still renders pnpm ui:build for both stale and missing source-install assets, even though the diagnostic already has the detected root.
Owner-bound repair: The new formatter quotes the detected root per shell and returns pnpm --dir &lt;root> ui:&lt;action>; Doctor uses it for missing and stale asset guidance, while automatic building continues to execute the absolute script with that root as its working directory.
Boundary regression coverage: The added test creates an unrelated project, extracts each displayed command, executes it from that foreign directory, and verifies only the detected root receives the build marker for both missing and stale paths.
Findings None None.
Security None None.

How this fits together

Doctor detects missing or stale Control UI assets and emits a repair command for the checkout that owns those assets. Gateway startup and the asset builder consume the same assets and must direct operators to a repair path that can identify the correct installation.

flowchart LR
  A[Doctor asset check] --> B[Detected source checkout]
  B --> C[Shared command formatter]
  C --> D[Operator shell]
  D --> E[Control UI asset build]
  E --> F[Gateway asset startup]
Loading

Before merge

  • Resolve merge risk (P1) - This bug fix adds 15 net production lines; the increase is contained to a shared formatter and affected guidance owners, so it should not expand into a second command-rendering path.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +15, Tests +64, Docs +12. Total +91 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 24 9 +15
Tests 3 68 4 +64
Docs 1 12 0 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 104 13 +91

Review metrics

Metric Value Why it matters
Production versus test delta production +24/-9 (net +15); tests +68/-4 (net +64); docs +12 The production growth is limited to a shared command renderer and its existing guidance call sites; tests add an executed wrong-directory regression boundary.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-ui.ts, migration/backfill/repair: src/gateway/server-control-ui-root.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #137345
Summary: This PR is the focused candidate repair for the linked wrong-directory Doctor guidance defect.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land one root-bound command renderer for Doctor and asset-owner messages, preserve automatic root-bound execution, and keep unresolved Gateway cases on the safe Doctor-or-reinstall recovery path.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land one root-bound command renderer for Doctor and asset-owner messages, preserve automatic root-bound execution, and keep unresolved Gateway cases on the safe Doctor-or-reinstall recovery path.

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

Yes. The linked report records a built-CLI foreign-directory reproduction, and current main still contains the same unqualified Doctor, asset-owner, and unresolved-Gateway guidance; the added regression test directly models the wrong-directory execution.

Is this the best way to solve the issue?

Yes. Reusing the already-discovered root in one shell-aware formatter repairs the producer of the misleading command, while direct automatic builds and packaged-install reinstall guidance retain their existing owners.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The PR repairs a bounded source-install operator workflow where the displayed command can repair the wrong project.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This repository-member PR is exempt from the external contributor proof gate; its submitted evidence nevertheless describes an after-fix built-CLI run from a foreign directory that rebuilt the detected checkout and left the unrelated project untouched.

Label justifications:

  • P2: The PR repairs a bounded source-install operator workflow where the displayed command can repair the wrong project.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This repository-member PR is exempt from the external contributor proof gate; its submitted evidence nevertheless describes an after-fix built-CLI run from a foreign directory that rebuilt the detected checkout and left the unrelated project untouched.

Evidence

What I checked:

  • Current main remains affected: Current main still renders pnpm ui:build for both stale and missing source-install assets, even though the diagnostic already has the detected root. (src/commands/doctor-ui.ts:128, f9a43c083c7d)
  • Owner-bound repair: The new formatter quotes the detected root per shell and returns pnpm --dir &lt;root> ui:&lt;action>; Doctor uses it for missing and stale asset guidance, while automatic building continues to execute the absolute script with that root as its working directory. (src/infra/control-ui-assets.ts:12, 6359b13f04f1)
  • Boundary regression coverage: The added test creates an unrelated project, extracts each displayed command, executes it from that foreign directory, and verifies only the detected root receives the build marker for both missing and stale paths. (src/commands/doctor-ui.test.ts:88, 6359b13f04f1)
  • Shell-quoting compatibility: The installation-target formatter’s PowerShell literal expression was extracted unchanged into the shared helper; existing Windows triage coverage continues to exercise quoted paths and codex exec only as a displayed shell command, not a Codex runtime dependency. (src/cli/installation-target-format.ts:12, 6359b13f04f1)
  • Feature-history routing: The Control UI freshness repair surface was substantially maintained by the earlier packaged/full-protocol repair commit. (src/commands/doctor-ui.ts:33, 9e626c38370e)
  • Introduced-change ownership: The verified test merge changes exactly the nine supplied Doctor, formatter, Gateway, test, and documentation paths relative to its main parent; current main is the first parent and does not contain this head. (src/commands/doctor-ui.ts:128, 4e08734e4c25)

Likely related people:

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

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer disposition for the current ClawSweeper review: the requested single root-bound renderer is already the implementation being landed. I accept the +15 production-line increase for carrying the detected checkout into executable guidance while sharing the existing shell-literal contract. There is no second automatic-build or command-rendering flow.

The data-model compatibility prompt is not applicable: the flagged Doctor/Gateway changes are message projection and an import, not schemas, migrations, backfills, storage access, or persisted-state semantics. Automatic repair execution and Gateway state transitions are unchanged. No migration was performed or is required. Both dispositions are recorded in the PR body.

Exact-head CI33768095321 passed on 6359b13f04f1a3c19290217ccf66169569f86718, attempt1. Local proof includes 107 passing tests, the complete changed gate, final artifact build, fresh scoped-clean P0 autoreview, 14 real-shell executions, and built-CLI before/after proof. The final displayed command rebuilt the intended checkout from a foreign cwd, left the foreign project untouched, and produced a clean follow-up diagnostic; config bytes stayed unchanged and no state DB was created.

The native main baseline was inspected: the 20 reviewed source/context files and additional runtime/lint/normalization contracts are unchanged from the tested base. The only inspected package drift removes an unrelated root Slack development dependency. Commands, proof boundaries, setup failures and named follow-ups are retained in the PR body. Native Windows execution is not claimed; PowerShell syntax was exercised on macOS. No rendered layout change is present.

@steipete
steipete merged commit 18a439f into main Sep 3, 2026
259 of 262 checks passed
@steipete
steipete deleted the task294/maintenance-guidance-20260903 branch September 3, 2026 15:57
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 3, 2026
* refs/remotes/origin/main:
  fix(plugins): reject unverifiable pinned npm installs (#136725)
  improve(ui): lift sidebar section headers on hover and mark online owners (#136985)
  test(cron): reuse isolated run suite hooks (#137341)
  test(channels): reuse shared indexed call guards (#137350)
  fix(ui): sidebar header controls read misaligned after the + button lost its border (#137317)
  fix(qa-channel): preserve conversation kind for implicit actions (#137343)
  fix: target the source checkout in Control UI repair commands (#137354)
  chore: reduce CI job count and database test overhead (#137352)
  fix(ios): preserve chat live edge across keyboard transitions (#136660)
  refactor(control-ui): consolidate mention inbox requests (#137375)
  fix(openai): preserve ChatGPT HTTP status for retry pacing (#137146)
  fix(mcp): hide policy-denied plugin tools from ACP sessions [AI] (#136546)
  test(queue): reuse shared deferred fixtures (#137338)
  fix(gateway): repair the Gateway E2E shard (browser suite project, skill resource argv, Codex diagnostic) (#137358)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…aw#137354)

Bind Doctor and asset-owner manual build/development instructions to the
already-discovered checkout with pnpm --dir. Reuse POSIX and PowerShell
literal quoting without changing automatic builds or packaged recovery.
When the Gateway cannot resolve its assets, recommend Doctor/reinstall
instead of a source build with no known working directory.

Closes openclaw#137345.

Validated with 107 focused tests, the complete changed-file gate, real
shell command execution, and independent scoped review. The built
pre-fix CLI reproduces the wrong-directory execution with private state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Doctor Control UI repair commands use the calling directory

1 participant