Skip to content

fix(cli): honor profile selection before cached help - #133148

Merged
steipete merged 1 commit into
mainfrom
codex/qa-20260830-launcher-profile-help
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-20260830-launcher-profile-help

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #133145

What Problem This Solves

Fixes an issue where users requesting help with a leading --profile or --dev selector would see cached commands from the wrong profile. For example, openclaw --profile work nodes --help advertised Canvas even when that profile disabled it, while the same selector after the command worked. Invalid or conflicting leading selectors also returned successful cached help instead of their normal errors.

Why This Change Was Made

Profile validation and environment projection remain owned by the runtime entry. The launcher now delegates profile-bearing help to that existing flow before choosing cached output. Its help recognizer uses one leading-option scan and one help-only tail check, removing the parallel command/help state without changing the shared Gmail option parser.

User Impact

Help reflects the selected profile's plugin availability, and malformed profile selections retain their normal diagnostics and exit status. Bare help, version, and passive root-option fast paths remain available. No configuration, dependency, persistent-state, protocol, or plugin SDK contract changes are introduced.

Evidence

  • Baseline package from 3f1c84c706bf1e4c8bc7b2ab106ab96ff1fe6ddb built with the repository packer and installed with npm in a clean isolated Linux Testbox prefix/home. Eight cases reproduced stale plugin help or swallowed selector errors. Distinct custom config/state overrides and default/trailing-selector controls were checked separately.

  • New launcher boundary regression: all eight cases failed before the repair because cached text bypassed the runtime entry.

  • Final launcher and version files: 64 tests passed; one existing Bun-specific test was unavailable/skipped. Command: node scripts/run-vitest.mjs test/openclaw-launcher.e2e.test.ts test/openclaw-launcher-version.e2e.test.ts.

  • Full check:changed passed all 24 stages on the exact committed head, including all production/test type checks, full lint, repository guards, and zero runtime import cycles. Targeted lint, formatting, JavaScript syntax, and whitespace checks also passed. Fresh autoreview reported scoped-clean; independent source review confirmed the canonical ownership boundary and unchanged sibling grammar.

  • Production delta: +14/-22, net -8 lines. Test delta: +38/-1.

  • Final clean committed-ref package proof passed on Blacksmith Testbox: run 33298420827. The repository packer built and validated the tarball, npm installed it into a fresh prefix/home, and all 17 assertions passed: default/root help, named/default/dev selection, trailing selection, inherited canonical paths, distinct custom config/state overrides, static help, invalid/conflicting selectors, and version. Source HEAD and packaged build commit both equal bf7364077f48366c3008b6634af2c3b3afd8c318; source and installed launcher hashes match. Tarball SHA-256: 4c26f3304bddcf804aa7cc8f514b7a7b2c4dd8f18241f7c33faabbfe16948520. The owned testbox was stopped after evidence collection.

Provenance: the defect is reachable in stable tag v2026.7.1-2; its introducing commit is unknown because available history is shallow. A separately observed environment-only OPENCLAW_PROFILE projection mismatch is outside this repair; this PR does not claim to fix it.

Hosted integration CI is now green; native landing gates remain. The original CI run failed on an unrelated missing Code Mode metadata export in main. A subsequent draft-to-ready run reused that old merge tree, as verified from its actual preflight checkout; cancellation was requested for that obsolete run. The mechanical refresh is now ad92a490ce2a9b2b17978608e4f7ca86b329c803, directly based on the canonical repair be5e79ca4713c33a11ccd56b2d728c19f0779f3d. The source/test patch ID and both file blobs match the package-tested commit; the relevant entry/profile/config-owner files are also unchanged. Fresh exact-commit autoreview is clean. New integration CI actually checked out merge 03290e3a3659a2b7bdc3438b4c9896d6618a2894, whose parents include this refreshed head, so the repaired ancestry is verified. The full check watcher completed successfully with zero pending or failing checks. Native review, prepare, and merge gates remain before landing.

Suggested release note: CLI: honor profile and development selection before cached command help so plugin availability and selector errors match the normal runtime.

Latest ClawSweeper disposition: the exact-head review found no code or security findings and accepted the installed-package proof. Its incomplete-CI item is resolved by the green integration run; the linked issue remains open until this PR lands.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 07:09
@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 Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 4:10 AM ET / 08:10 UTC.

ClawSweeper review

What this changes

The branch delegates cached command help with leading --profile or --dev selectors to the CLI runtime and adds launcher boundary regression coverage.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

The focused repair is correct: it keeps selector-bearing help on the existing runtime-owned validation path, while selector-free static help remains cached. This active maintainer-labeled PR should remain open for normal landing review.

Priority: P2
Reviewed head: ad92a490ce2a9b2b17978608e4f7ca86b329c803

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, net-negative launcher repair with real installed-package proof and no supported correctness or security finding.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The changed production owner is the launcher fast path; the PR’s linked clean-package Testbox evidence exercises that entrypoint with selected, invalid, conflicting, and control selector forms and records 17 passing post-fix assertions.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The changed production owner is the launcher fast path; the PR’s linked clean-package Testbox evidence exercises that entrypoint with selected, invalid, conflicting, and control selector forms and records 17 passing post-fix assertions.
Evidence reviewed 7 items Current-main failure path: Current main consumes a leading root option before recognizing the command, so --profile can be skipped and cached help returned without runtime profile validation.
Runtime owns the required behavior: The normal entry point parses profile selectors, reports malformed/conflicting selections, applies profile environment projection, then runs its help paths.
Introduced repair: The branch rejects --dev and --profile from the launcher fast path before metadata is read, preserving the runtime as the single owner of selector handling.
Findings None None.
Security None None.

How this fits together

The launcher may print precomputed command help before loading the CLI runtime. Profile and development selectors change the runtime configuration context, so those invocations must reach the runtime before help is rendered.

flowchart LR
  A[CLI arguments] --> B[Launcher help recognizer]
  B -->|Static selector-free help| C[Precomputed help]
  B -->|Profile or development selector| D[CLI runtime]
  D --> E[Profile validation and configuration]
  E --> F[Profile-aware help or diagnostics]
Loading

Before merge

  • Complete next step (P2) - No repair work is needed: this active maintainer-labeled PR already contains the appropriate implementation and proof.
Agent review details

Security

None.

PR surface

Tests +37, Other -8. Total +29 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 38 1 +37
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 14 22 -8
Total 2 52 23 +29

Review metrics

Metric Value Why it matters
Production versus test LOC production +14/-22 (net -8); tests +38/-1 (net +37) The bug fix reduces launcher production code while adding focused boundary coverage.

Technical review

Best possible solution:

Land the launcher-only delegation so profile-sensitive help and selector errors consistently use the established runtime parser without changing the selector-free help fast path.

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

Yes—the current-main launcher scan demonstrably consumes leading profile tokens before cached-help selection, and the supplied installed-package cases exercise the affected forms. This read-only review did not rerun the package scenario.

Is this the best way to solve the issue?

Yes—the runtime already owns profile parsing, validation, and environment projection, so rejecting those selectors from the launcher cache is the narrow canonical repair.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The PR repairs misleading CLI help and selector diagnostics with limited blast radius and no execution, persistence, or credential impact.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The changed production owner is the launcher fast path; the PR’s linked clean-package Testbox evidence exercises that entrypoint with selected, invalid, conflicting, and control selector forms and records 17 passing post-fix assertions.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the launcher fast path; the PR’s linked clean-package Testbox evidence exercises that entrypoint with selected, invalid, conflicting, and control selector forms and records 17 passing post-fix assertions.

Evidence

What I checked:

  • Current-main failure path: Current main consumes a leading root option before recognizing the command, so --profile can be skipped and cached help returned without runtime profile validation. (openclaw.mjs:469, a3b5ce6d2c7b)
  • Runtime owns the required behavior: The normal entry point parses profile selectors, reports malformed/conflicting selections, applies profile environment projection, then runs its help paths. (src/entry.ts:129, a3b5ce6d2c7b)
  • Introduced repair: The branch rejects --dev and --profile from the launcher fast path before metadata is read, preserving the runtime as the single owner of selector handling. (openclaw.mjs:465, ad92a490ce2a)
  • Boundary regression coverage: The table-driven launcher test covers valid named/default/development selectors and empty, invalid, and conflicting profile forms, asserting that each reaches the runtime rather than emitting metadata help. (test/openclaw-launcher.e2e.test.ts:469, ad92a490ce2a)
  • Equivalent current owner files: The runtime entry and profile parser have identical blobs on current main and this PR head, so the repair delegates to the same profile contract it was reviewed against. (src/cli/profile.ts:22, a3b5ce6d2c7b)
  • Packaged real-behavior proof: The captured PR body links a clean Testbox package-install run with 17 passing assertions across selected-profile help, invalid/conflicting selectors, and static-help controls; the body states the repaired launcher blobs match the package-tested commit. (test/openclaw-launcher.e2e.test.ts:480, ad92a490ce2a)

Likely related people:

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

Rating scale

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

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

Workflow

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

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-30T07:16:06.335Z sha bf73640 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T07:24:50.482Z sha bf73640 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T07:56:58.929Z sha ad92a49 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as draft August 30, 2026 07:39
@steipete
steipete marked this pull request as ready for review August 30, 2026 07:39
@steipete
steipete force-pushed the codex/qa-20260830-launcher-profile-help branch from bf73640 to ad92a49 Compare August 30, 2026 07:48
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 30, 2026
@steipete
steipete merged commit 43d2590 into main Aug 30, 2026
226 checks passed
@steipete
steipete deleted the codex/qa-20260830-launcher-profile-help branch August 30, 2026 08:22
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

CLI cached help ignores leading profile selection

1 participant