fix: stop 'key: value' call arguments from sending a leading space #520
<!-- clawsweeper-pr-ack:opened item=520 -->
🦞👀
ClawSweeper picked this up.
Pull request received. I will update this pull request when review starts.
<!-- clawsweeper-review-progress:start -->
ClawSweeper review complete
ClawSweeper finished reviewing this revision. The review result is being finalized.
View the workflow run.
<!-- clawsweeper-review-progress:end -->
<!-- codex-pull-request-review-summary -->
<!-- codex-review-state:v1 {"code_review":{"commit_sha":"9d9aa82d820fc3861770de35b85267248acb7db1","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} -->
<details>
<summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
| --- | --- | --- | --- |
| 📝 Code Review | ✅ Completed <relative-time datetime="2026-11-21T06:25:45.246298Z">2026-11-21T06:25:45.246298Z</relative-time> | 9d9aa82 | PR opened |
<details> <summary>ℹ️ About Codex in GitHub</summary>
<br/>
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
</details>
</details>
Codex review: needs maintainer review before merge.
What this changes
Treat whitespace after the colon in a single quoted 'key: value' argument as a separator while preserving trailing and whitespace-only values.
Example: Run mcporter call linear.get_issue 'issueId: LNR-123'.
Review scores
| Measure | Result | What it means |
|---|---|---|
| Overall readiness | 🐚 platinum hermit (4/6) | A useful minimal repair with supplied end-to-end results, focused regression coverage, passing head checks and no actionable defects. |
| Proof confidence | 🐚 platinum hermit (4/6) | Sufficient (live_output): The supplied built-CLI results exercise the changed parser through a real stdio MCP fixture and show the corrected server-received value alongside unchanged argument-form controls. |
| Patch quality | 🐚 platinum hermit (4/6) | No actionable review findings were identified. |
Product
Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A documented quoted 'key: value' argument sends an unwanted leading space that can make server lookups fail.
Reason: Restoring the established colon syntax has clear compatibility value, requires no new option, and preserves the prior whitespace fix's explicit controls.
Regression provenance
Regression provenance — suspected predecessor, not a causality claim: source commit 507bb6de9516 by Peter Steinberger; no PR verified.
Possible regression — suspected (reviewed change). No predecessor PR is attributed.
Merge readiness
✅ Ready for maintainer review
This PR repairs a documented CLI syntax regression still present on main; the focused patch has supplied CLI-to-server evidence, passing head checks, and no actionable findings.
Priority: P2
Reviewed head: 9d9aa82d820fc3861770de35b85267248acb7db1
Before merge
None.
Findings
None.
<details>
<summary><strong>Agent review details</strong></summary>
How this fits together
The shared CLI argument parser converts shell tokens into values that pass through schema handling and MCP transport to the selected tool.
flowchart LR
A[Shell arguments] --> B[Named argument parser]
B --> C[Value coercion]
C --> D[Schema handling]
D --> E[MCP transport]
E --> F[Tool server]
Technical review
Best possible solution:
Land the focused repair in the existing token parser with its regression coverage and syntax clarification.
Do we have a high-confidence way to reproduce the issue?
Main deterministically forwards the separator space into string values, and the contributor supplies matching before-and-after server echoes; this read-only review ran no target code.
Is this the best way to solve the issue?
Handling separator whitespace in parseKeyValueToken fixes the syntax boundary directly without weakening the earlier exact-string preservation behavior.
AGENTS.md: found and applied where relevant.
Codex review notes: model internal, reasoning medium; reviewed against d559d33d1d61.
Provenance checked
Colon-delimited argument parsing keeps the original intent (623d3e7a4ef286180b56f7e73d255a2fa9196ab3: Accept colon forms alongside equals-form named arguments; the later helper split carried this behavior into call-argument-values.ts.)String whitespace preservation changes intended behavior with a stated reason (https://github.com/openclaw/mcporter/pull/504: Preserve meaningful leading and trailing whitespace in string values while detecting typed literals using trimmed text; this PR explains the narrow separator exception.)Testing
Proof path: shipped entry point.
Security
None.
Evidence
What I checked:
src/cli/call-argument-values.ts:30, d559d33d1d61)src/cli/call-argument-values.ts:31, 9d9aa82d820f)src/cli/call-command.ts, 623d3e7a4ef2)src/cli/call-argument-values.ts:67, a93b6d46b55a)tests/servers/modern/server.ts:39, 9d9aa82d820f)Preflight source
Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.
Labels
Label changes:
P2: A documented argument form changes string values and can break ID lookups, with limited scope and working alternative argument forms.proof: sufficient: Contributor real behavior proof is sufficient.rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.Label justifications:
P2: A documented argument form changes string values and can break ID lookups, with limited scope and working alternative argument forms.rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.proof: sufficient: Contributor real behavior proof is sufficient.Rating scale
6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.
Workflow
ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.
</details>
_Reviewed November 21, 2026, 1:37 AM ET / 06:37 UTC._
<!-- clawsweeper-verdict:needs-human item=520 sha=9d9aa82d820fc3861770de35b85267248acb7db1 confidence=high updated_at=2026-11-21T06:35:17Z reviewed_at=2026-11-21T06:37:08.556Z lease_owner=github-run-44876161792-1 lease_comment_id=7058698256 source_revision=d54275a1429c3857b8d201f587f3ffe1feaf584e8eb71254a1b0b4c153116908 hold=not_opted_in findings=0 -->
<!-- clawsweeper-review-state:ready item=520 sha=9d9aa82d820fc3861770de35b85267248acb7db1 v=1 -->
<!-- clawsweeper-review-version item=520 reviewed_at=2026-11-21T06:37:08.556Z sha=9d9aa82d820fc3861770de35b85267248acb7db1 source_revision=d54275a1429c3857b8d201f587f3ffe1feaf584e8eb71254a1b0b4c153116908 lease_owner=github-run-44876161792-1 lease_comment_id=7058698256 v=1 -->
<!-- clawsweeper-review item=520 -->
JYunth
Related: #504
What Problem This Solves
The call syntax docs list
key: valueas an argument form. Since #504 stopped trimming string values, passing that form as one quoted shell token sends the value with a leading space:mcporter call linear.get_issue 'issueId: LNR-123'reaches the server as" LNR-123", so lookups by ID, queries and paths quietly stop matching.User Impact
'issueId: LNR-123'sends"LNR-123"again, as it did before 0.17.1. The rest of #504 is unchanged: trailing whitespace,key=value, the two-tokenkey:valueform and whitespace-only values all keep their whitespace exactly.Why This Change Was Made
Before #504 the space after the colon was removed only because every string value was trimmed. The space is a separator, not part of the value, so the colon branch now drops whitespace after the colon when a value follows it. Whitespace-only values such as
'note: 'are left as they were.Evidence
The built CLI called
fixture.echoon the repo's modern stdio fixture, which returns the text it received:| Argument | main (d559d33) | this branch |
|---|---|---|
|
'text: LNR-123'(one token) |" LNR-123"|"LNR-123"||
'text:LNR-123'|"LNR-123"|"LNR-123"||
'text:' 'LNR-123'(two tokens) |"LNR-123"|"LNR-123"||
'text= indented '|" indented "|" indented "|A new case in
tests/call-arguments.test.tscovers'issueId: LNR-123','query: hello world '(separator dropped, trailing space kept),'note: '(whitespace-only kept) and'tool: list_issues'. It fails on main withexpected { issueId: ' LNR-123', … }and passes here.pnpm checkpasses.pnpm testgives 2468 passed and 3 failed locally. The 3 failures are Bun native-build tests incli-generate-cli.integration.test.ts, which fail the same way on main here, because this machine has Bun 1.3.7 and the repo needs 1.4.4 or newer.