Repository navigation
fix(cli): preserve foreground Gateway argument handling - #138765
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 10:00 PM ET / September 5, 2026, 02:00 UTC. ClawSweeper reviewWhat this changesShares Gateway flag recognition between startup paths and fixes foreground launches using ambient-channel flags, trailing no-color, or log-level options. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: fetched main still contains the reported failures, and this re-review found no blocking patch defect. The supplied dist-backed CLI evidence directly demonstrates the repaired argument handling and process count. Priority: P2 Review scores
Verification
How this fits togetherThe CLI startup layer decides whether to create a replacement process and which argument parser handles a command. For foreground Gateway launches, it passes validated options to the existing server startup owner. flowchart TD
A[CLI arguments] --> B[Shared Gateway flag recognition]
B --> C[Foreground process decision]
C --> D[Keep Gateway in process]
B --> E{Root options need full parsing?}
E -->|No| F[Reduced parser with color normalization]
E -->|Yes| G[Full parser and logging validation]
F --> H[Gateway startup validation]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource -21, Tests +66. Total +45 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one shared Gateway argument policy, reuse metadata-aware color normalization, and keep log-level validation and logging preactions with their existing full-parser owner. Do we have a high-confidence way to reproduce the issue? Yes: the supplied baseline commands and process observations map to unchanged failing paths on fetched main. This review established the mechanism from source rather than executing the CLI. Is this the best way to solve the issue? Yes: the patch repairs the shared argument owner and reuses existing normalization instead of duplicating flag lists or adding log-level handling to the reduced parser. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d8262bf1500b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
The remaining reviewer-side dependency gap is resolved by direct inspection of the installed Commander 15.0.0 used for the recorded tests and dist-backed CLI proof. I inspected The source confirms why the fix keeps log-level validation/preactions in the full parser and applies the existing metadata-aware no-color normalization at the reduced parser boundary. Required values that resemble flags remain values. This supplements—not substitutes for—the supplied actual Commander tests and dist-backed process/argument observations; the review did not reveal a patch defect requiring a different implementation. Exact-head CI on |
|
Merged via squash.
|
* refs/remotes/origin/main: (602 commits) fix(plugins): trace trust refusals and repair legacy provenance (openclaw#138746) perf(sqlite): reuse compiled plugin state point reads (openclaw#138758) refactor: type chat prefetch dependencies and clean loading tests (openclaw#138793) ci: reduce Doctor test startup and core lint jobs (openclaw#138796) feat(update): retain run history and share outcome reports (openclaw#138690) chore(deps): update @openclaw/fs-safe to 0.8.1 (openclaw#138500) fix: preserve global board ownership from pinning to notifications (openclaw#138675) fix(gateway): deliver session catalog updates from slow hosts (openclaw#138674) perf(sessions): index pending conversation replies (openclaw#127182) perf(auth): reuse ordered provider alias entries (openclaw#138805) docs(diagnostics): clarify whole-process CPU metrics (openclaw#138804) perf(memory): narrow source reads and stream embedding cache rows (openclaw#138766) fix: allow older source on newer Testbox checkouts (openclaw#138782) fix(agents): preserve recovered task progress and lifecycle ownership (openclaw#138785) perf(codex): reduce rollout tail scan CPU (openclaw#138784) perf(gateway): stop projecting history deltas at the byte budget (openclaw#138655) fix(build): bound native declaration inputs to checkout (openclaw#138742) fix(cli): preserve foreground Gateway argument handling (openclaw#138765) fix(ui): align task toolbar with side-panel tabs (openclaw#138769) fix(logbook): drain accepted work before closing SQLite (openclaw#138754) ... # Conflicts: # src/agents/embedded-agent-runner/compact.queued.ts
Closes #138762
Additional instructions
Allow edits from maintainers is to remain enabled when this PR is created.
What Problem This Solves
Fixes an issue where users running a foreground Gateway with
--ambient-channelsor its deprecated alias would get an unnecessary respawn parent. It also fixes existing argument failures where--verbose --no-coloror trailing--log-levelwere rejected before Gateway startup validation.The first local candidate exposed the reduced parser's existing no-color defect for ambient flags. Managed review caught that P2 before publication; this version fixes the shared owner rather than excluding the new cases from the fast path.
Why This Change Was Made
Foreground detection now uses the canonical Gateway flag table instead of duplicate lists. The reduced parser reuses existing metadata-aware no-color normalization, and fast-path root-option admission is consistent before and after
gateway. Log-level validation and logging preactions remain with the full parser that owns them.Production 27 additions/48 deletions: net -21. Tests 70 additions/4 deletions: net +66. No new CLI options, config/environment surfaces, persistence changes, timeout changes or compatibility paths. Windows containment and the separate managed-service handoff lifecycle repair are not included.
User Impact
The two documented ambient-channel flags preserve foreground process ownership. Global no-color and log-level options work with the applicable Gateway arguments, without weakening invalid-option or invalid-log-level validation. Required flag-looking token values remain intact.
Evidence
Fresh Node 24.20.0/pnpm 12.1.0 installs and supported dist-backed runtime builds were compared against
d329e6144965561c88cad197380def7b12eb6bebon macOS 27.0.--no-colorSupported build/CLI commands included:
A passive main-thread process-start observer supplied with Node
--requirecaptured the process comparisons; it did not mock spawning. Every command used private HOME/state/config/TMP. Valid argument cases intentionally ended with:Invalid log-level retained its dedicated validation error:
These are normal expected exit 1 outcomes, not Gateway-start success; no operator Gateway/listener or Windows VM was launched.
The entry regression failed 3 intended cases before repair. The real runCli+Commander+Gateway-registration regression failed 3 intended parse-exit cases before normalization repair and passed afterward. 696 tests passed across 10 focused files, with no skips. Existing value/terminator, option-collision, exit/profile and log-level coverage remained intact. The canonical 29-check changed gate passed in 397.25s (25 printed subprocess commands plus 4 internally run check stages), including formatting, core/test types, lint and required guards. Final managed P0–P2 review passed both partitions with no actionable findings; complete integration context was retained in both.
The first review's P2 and all red receipts remain retained. A baseline setup attempt initially failed because a root-only dependency symlink missed plugin-local workspace dependencies; a fresh authorized frozen install resolved that setup issue. Earlier source-entry observations are not used as the supported dist-backed proof. No successful Gateway boot, Windows execution or native containment proof is claimed.