Skip to content

fix: use FLAG_TERMINATOR constant in getCommandPathInternal - #85710

Closed
d3Lap1ace wants to merge 4 commits into
openclaw:mainfrom
d3Lap1ace:fix/flag-terminator-constant
Closed

d3Lap1ace wants to merge 4 commits into
openclaw:mainfrom
d3Lap1ace:fix/flag-terminator-constant

Conversation

@d3Lap1ace

@d3Lap1ace d3Lap1ace commented May 23, 2026 •

Copy link
Copy Markdown

Closes #83902

getCommandPathInternal was the only function in argv.ts using a hardcoded "--" instead of the imported FLAG_TERMINATOR constant. Replaced the literal with the constant for consistency — if FLAG_TERMINATOR ever changes, command-path resolution will now stay in sync with all other argv helpers.

Real behavior proof

Behavior addressed: getCommandPathInternal used a hardcoded "--" literal that was inconsistent with the FLAG_TERMINATOR constant used elsewhere in argv.ts; unified to the constant. Behavior is preserved — "--" is still the flag terminator at runtime.

Real environment tested: local macOS (darwin 25.5.0), Node 24, pnpm 11.2.2, built openclaw CLI from this branch

Exact steps or command run after this patch:

  1. pnpm install && pnpm build
  2. pnpm openclaw status -- --foo --bar
  3. (supplemental) pnpm test src/cli/argv.test.ts → 86 tests passed
  4. (supplemental) pnpm check:changed → all green

Evidence after fix (real CLI output):

$ pnpm openclaw status -- --foo --bar
$ node scripts/run-node.mjs status -- --foo --bar
🦞 OpenClaw 2026.5.22 (4b4be8a)
OpenClaw status
... (full status table rendered; "--" correctly terminated flag parsing,
     --foo --bar passed as positional args, no parse error)

(See attached screenshot below for full terminal capture.)

Observed result after fix: openclaw CLI parses command path identically to before. -- still terminates flag scanning and downstream args are passed through to the command's positional/raw argv. No regression in any of the touched code paths.

What was not tested: full e2e suite, non-macOS platforms

terminal-output

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as duplicate/superseded: this PR’s production replacement is correct, but #84438 is an open, mergeable, maintainer-modifiable, proof-backed branch with the same fix plus focused argv and argv-invocation regression coverage.

Canonical path: Land #84438 or another maintainer-selected proof-backed branch with focused argv coverage, then close the linked issue and remaining duplicate PRs.

So I’m closing this here and keeping the remaining discussion on #84438.

Review details

Best possible solution:

Land #84438 or another maintainer-selected proof-backed branch with focused argv coverage, then close the linked issue and remaining duplicate PRs.

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

Yes. Source inspection on current main and v2026.6.10 shows getCommandPathInternal still uses arg === "--" while the shared terminator constant exists and sibling helpers use it; I did not mutate the constant or run tests because this review is read-only.

Is this the best way to solve the issue?

No for this branch as the best landing path. The one-line production replacement is correct, but #84438 carries the same fix with focused argv and invocation regression coverage.

Security review:

Security review cleared: Cleared: the diff only changes local CLI argv parsing and does not touch dependencies, workflows, secrets, packaging, permissions, downloads, or other supply-chain surfaces.

AGENTS.md: found and applied where relevant.

What I checked:

  • Repository policy read: Root AGENTS.md was read fully; no scoped AGENTS.md owns src/cli, so the root PR review, duplicate-handling, proof, and source-inspection guidance applies. (AGENTS.md:1, d1b917120a47)
  • Current main still has the source mismatch: Current main imports FLAG_TERMINATOR, but getCommandPathInternal still stops on the literal arg === "--", while sibling argv helpers use the shared constant. (src/cli/argv.ts:461, d1b917120a47)
  • Shared terminator contract exists: FLAG_TERMINATOR is the shared CLI token and currently equals --. (src/infra/cli-root-options.ts:2, d1b917120a47)
  • Runtime caller path checked: resolveCliArgvInvocation derives commandPath through getCommandPathWithRootOptions, so the touched helper participates in pre-dispatch CLI routing. (src/cli/argv-invocation.ts:21, d1b917120a47)
  • Existing main coverage is weaker than the canonical PR: Current main has a command-path terminator test, but it uses the literal --; the canonical PR adds constant-backed argv and invocation coverage. (src/cli/argv.test.ts:438, d1b917120a47)
  • This PR is only the production replacement: The live diff for this PR changes only arg === "--" to arg === FLAG_TERMINATOR in src/cli/argv.ts, with no regression tests on this branch. (src/cli/argv.ts:461, fc8a25de2411)

Likely related people:

  • steipete: Commit d5c8172197478fa72281f949f56729794c1d3de1 added routed CLI path helper coverage and touched src/cli/argv.ts and src/cli/argv.test.ts. (role: introduced CLI path helper; confidence: high; commits: d5c817219747; files: src/cli/argv.ts, src/cli/argv.test.ts)
  • gumadeiras: Commits f26853f14c9ba2361c983de8909926aa74143929 and 15a0455d040fd3f035870b77c30e9b9db0c66e38 introduced and expanded the shared root-option parsing surface, including FLAG_TERMINATOR and argv tests. (role: adjacent CLI root-option contributor; confidence: high; commits: f26853f14c9b, 15a0455d040f; files: src/infra/cli-root-options.ts, src/cli/argv.ts, src/cli/argv.test.ts)
  • vincentkoc: Recent GitHub commit history for src/cli/argv.ts shows multiple June 2026 CLI argv/root-option refactors by this contributor, including shared root option prefix scanning and stale path policy cleanup. (role: recent area contributor; confidence: medium; commits: d8e6ee04d0ba, 76bdb025d63a, 39c5de484d25; files: src/cli/argv.ts)

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

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Neon Lint Imp

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: purrs at green checks.
Image traits: location diff observatory; accessory lint brush; palette plum, gold, and soft gray; mood watchful; pose nestled inside a glowing shell; shell paper lantern shell; lighting soft underwater shimmer; background soft code-shaped tiles.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Neon Lint Imp in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@clawsweeper clawsweeper Bot added the P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. label May 23, 2026
@d3Lap1ace

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 23, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: sufficient ClawSweeper judged the real behavior proof convincing. labels May 23, 2026
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 23, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 23, 2026
@d3Lap1ace

Copy link
Copy Markdown
Author

Hi maintainers, this PR is now marked proof: sufficient and status: ready for maintainer look.

It is a one-line consistency fix for #83902, with real behavior proof and local test/check output included in the PR body. Could someone take a look and merge if the required checks are green?

Thanks!

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jun 21, 2026
@clawsweeper clawsweeper Bot closed this Jun 28, 2026
@clawsweeper

clawsweeper Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

🦞✅
ClawSweeper autoclose is complete.

Reason: structured ClawSweeper close marker: close-required (sha=fc8a25de2411eac138c22a97f8fa76f7b1b42106)

Closed:

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

Labels

cli CLI command changes P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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.

getCommandPathInternal uses hardcoded "--" instead of FLAG_TERMINATOR constant

1 participant