Repository navigation
fix: align bootstrap config selection and error output - #628
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: needs maintainer review before merge. Reviewed September 20, 2026, 3:58 AM ET / 07:58 UTC. ClawSweeper reviewWhat this changesAligns startup configuration with the final working-directory and MCP-config flags, formats configuration errors consistently, and adds regression tests and documentation. Merge readiness✅ Ready for maintainer review This fix remains necessary: current main and v0.17.1 retain the bootstrap mismatch. The patch is focused, and the supplied production-path observations cover permission enforcement and startup error output; no blocking defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe CLI loads project configuration before dispatching commands to ACP agents. That configuration supplies permissions, MCP servers, and output defaults, so its working directory must match command execution. flowchart TD
A[Top-level CLI flags] --> B[Select final path values]
B --> C[Load project and MCP configuration]
C --> D[Run ACP command]
D --> E[Enforce permissions before file writes]
C --> F[Configuration error]
F --> G[Requested output format]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Use the same effective paths for configuration and execution while retaining existing permission enforcement, output formats, and stored configuration. Do we have a high-confidence way to reproduce the issue? Yes: source establishes first-value bootstrap selection versus last-value execution, and the contributor supplies before/after denied-write observations. This read-only review did not execute tests. Is this the best way to solve the issue? Yes: consolidating path selection and extending the existing error boundary repairs the implicated paths without new flags, persisted formats, or competing configuration mechanisms. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 95c9d79513a6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Landed as 5dc546b. Startup configuration now follows the same final cwd/MCP values as command execution, and configuration errors honor explicit JSON/quiet formatting. The regression suite reproduced the wrong-project permission decision before the fix. Afterward, 31 focused tests, 51 source-blind CLI/ACP cases, and full checks with 1,316 passed/2 skipped were green; declared coverage, docs, and independent review through P2 passed. All 12 CI jobs passed for 512496f: https://github.com/openclaw/acpx/actions/runs/35498194369. Main is synchronized and clean. |
Repeating top-level
--cwdcurrently loads configuration from the first directory while Commander executes in the last. An approve-all first project can therefore authorize writes inside a final deny-all project. Repeated--mcp-confighas the same first-value mismatch, and configuration errors occur outside the normal output formatter.Use one shared last-value scan for bootstrap paths, preserving required option values, command boundaries, empty cwd, and literal whitespace. Resolve the final MCP path against the final cwd. Move configuration loading into the existing error boundary with an explicit-output fallback before configuration becomes available; loaded format defaults still govern later errors. This removes the redundant first-match helpers without adding flags or changing exit/error codes.
Regression command:
pnpm run build:testfollowed bynode --test --test-name-pattern='^bootstrap' dist-test/test/cli.test.js. Before the fix, 24 cases failed and the version/default-format control passed. A synthetic--cwd FIRST --cwd=SECOND --format json fixture exec 'write SECOND/sentinel.txt denied'returned exit 0 despite SECOND's deny-all policy. After the fix it exits 5 and the file is absent. The focused bootstrap/version/config/output selection now passes all 31 tests.Separate source-blind validation passed 51 cases over five contracts using the built CLI and a self-authored ACP peer. Actual
session/new.cwdand peer cwd matched the final project; a positive approve-all control wrote its synthetic file, while deny-all returnedPermission denied for fs/write_text_fileand created none. Final relative MCP configuration reachedsession/newas:{"name":"second-tools","command":"synthetic-mcp","args":["second"],"env":[]}Malformed global/project JSON, invalid timeout, and missing MCP files each exited 1. JSON/strict modes emitted exactly one JSON-RPC error with
id:null,error.data.acpxCode:"RUNTIME", andorigin:"cli", with empty stderr. Quiet emitted one stderr diagnostic; text emitted no stack trace. Boundary, literal-option-value, empty/whitespace-cwd, malformed-earlier-project, version-bypass, and no-agent-launch default-format probes also passed. All synthetic peers exited and fixtures were removed.pnpm run checkandpnpm run check:docspassed on AWS Crabboxcbx_232ff861a01d, runrun_3245442fa92e121de3a376fb44a17ab5: 1,316 tests passed, 2 skipped, and the declared flows/runtime coverage gates passed. Isolated autoreview through P2 is scoped-clean. Config/output docs and Unreleased changelog updated.