openclaw - ✅(Solved) Fix --no-prefix-cwd flag silently has no effect due to Commander attribute naming [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#83901Fetched 2026-05-20 03:47:10
View on GitHub
Comments
2
Participants
3
Timeline
12
Reactions
1
Timeline (top)
labeled ×6commented ×2closed ×1cross-referenced ×1

Root Cause

Reproduction

Run openclaw acp --no-prefix-cwd; the bridge will still prefix every prompt with the working directory because opts.noPrefixCwd is undefined.

Fix Action

Fix / Workaround

Severity: medium / Confidence: medium / Category: bug Triage: risk Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18) Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-17e3589ff2-_20308ba0e3.

PR fix notes

PR #84039: fix(cli): honor --no-prefix-cwd in acp

Description (problem / solution / changelog)

Summary

  • Let Commander own the negated option default for --no-prefix-cwd.
  • Read the positive prefixCwd option that Commander actually populates.
  • Add ACP CLI coverage for both the explicit opt-out and the default behavior.

Closes #83901.

Verification

  • node scripts/run-vitest.mjs src/cli/acp-cli.option-collisions.test.ts src/acp/translator.prompt-prefix.test.ts
  • Crabbox AWS cbx_1689d0ad78e9, run run_a406418db6fe: regression failed before the source patch, then the focused ACP CLI and translator tests passed after the patch (15/15).

Real behavior proof

Behavior addressed: openclaw acp --no-prefix-cwd now forwards prefixCwd=false into the ACP bridge so prompts are not prefixed with [Working directory: ...]; the default path still forwards prefixCwd=true. Real environment tested: Fresh checkout of this PR branch after pnpm install and pnpm build, using a live ACP translator harness from the checkout; maintainer follow-up also verified focused behavior on AWS Crabbox Linux lease cbx_1689d0ad78e9. Exact steps or command run after this patch: Build the PR checkout, run the ACP translator harness once with the default prefixCwd path and once with the --no-prefix-cwd / prefixCwd=false path, then run node scripts/run-vitest.mjs src/cli/acp-cli.option-collisions.test.ts src/acp/translator.prompt-prefix.test.ts -- --reporter=verbose. Evidence after fix: The live ACP translator harness printed this after-fix output:

default prefixCwd=true
[Working directory: ~/openclaw-test]

hello
---
with --no-prefix-cwd / prefixCwd=false
hello

Observed result after fix: The default path still prefixes the working directory, and the --no-prefix-cwd path suppresses that prefix. Focused tests also passed with 15 passed; the same regression test failed before the source patch with prefixCwd received as true. What was not tested: No long-running interactive ACP server was left running; the live proof used a bounded ACP translator harness and the maintainer proof used focused CLI/translator tests.

Changed files

  • src/cli/acp-cli.option-collisions.test.ts (modified, +21/-0)
  • src/cli/acp-cli.ts (modified, +2/-2)

Code Example

.option("--no-prefix-cwd", "Do not prefix prompts with the working directory", false)

---

prefixCwd: !opts.noPrefixCwd,
RAW_BUFFERClick to expand / collapse

Severity: medium / Confidence: medium / Category: bug Triage: risk Detected against: openclaw v2026.5.18 (latest stable at time of scan, 2026-05-18) Tooling: clawpatch 0.3.0 + acpx/claude-sonnet-4-5 via Brad Mills protocol

Evidence

  • src/cli/acp-cli.ts:28-28 (registerAcpCli)
.option("--no-prefix-cwd", "Do not prefix prompts with the working directory", false)
  • src/cli/acp-cli.ts:47-47 (registerAcpCli)
prefixCwd: !opts.noPrefixCwd,

Reasoning

Commander.js treats --no-<name> options specially: the stored attribute is the camelCase of <name> without the 'no-' prefix. For --no-prefix-cwd, Commander sets opts.prefixCwd (not opts.noPrefixCwd). The action reads opts.noPrefixCwd, which is always undefined, so !opts.noPrefixCwd is always true. The effect is that prefixCwd is hardwired to true regardless of whether --no-prefix-cwd is passed, making the flag a no-op. Separately, the third argument false sets the default for the positive prefixCwd to false, but since the attribute read is wrong, even the default path is broken.

Reproduction

Run openclaw acp --no-prefix-cwd; the bridge will still prefix every prompt with the working directory because opts.noPrefixCwd is undefined.

Recommendation

Read opts.prefixCwd (the Commander-assigned attribute) directly: prefixCwd: opts.prefixCwd !== false. Alternatively, rename the option to --prefix-cwd with default true and negate manually, or verify the exact Commander version's camelCase behaviour and align accordingly.

Why existing tests miss this

No tests exercise the acp CLI option parsing; the flag's ineffectiveness is invisible without an integration test that checks the value passed to serveAcpGateway.

Suggested regression test

Unit test: parse ['node','openclaw','acp','--no-prefix-cwd'] through the registered Commander program; assert the resolved action call receives prefixCwd: false.

Minimum fix scope

Fix the option read in src/cli/acp-cli.ts line 47; verify against the locked Commander version's attribute naming semantics.


Standardized clawpatch finding. Persistent in v2026.5.18 (not resolved by upgrading from v2026.5.12). Finding ID: fnd_sig-feat-cli-command-17e3589ff2-_20308ba0e3.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix --no-prefix-cwd flag silently has no effect due to Commander attribute naming [1 pull requests, 2 comments, 3 participants]