← Back to Pull requests

fix: stop 'key: value' call arguments from sending a leading space #520

Open
JYunth opened this pull request with 18 lines diff across 4 files
View on GitHub
JYunth JYunth commented on Nov 21, 2026 06:23 UTC
Author

Related: #504

What Problem This Solves

The call syntax docs list key: value as 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-token key: value form 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.echo on 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.ts covers 'issueId: LNR-123', 'query: hello world ' (separator dropped, trailing space kept), 'note: ' (whitespace-only kept) and 'tool: list_issues'. It fails on main with expected { issueId: ' LNR-123', … } and passes here.

pnpm check passes. pnpm test gives 2468 passed and 3 failed locally. The 3 failures are Bun native-build tests in cli-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.

Diff: 18 lines (+16 / -2) across 4 files Reviewer: None requested Review duration: 15712m
All Vouch review confidence checks passed
Residual risk 0.12 = Change Risk (0.37) × (1 − Review Confidence (0.68)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 18 lines diff across 4 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.60 · 3 substantive comment(s)
0.60
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 10%
67%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.176
No Reviewer Assigned no_reviewer_assigned
0.120
Real PR Conversation Timeline
4 items
clawsweeper[bot] clawsweeper[bot] commented on Nov 21, 2026 06:23 UTC
Bot

<!-- 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 -->

chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 21, 2026 06:24 UTC
Bot

<!-- 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

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • 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>

    clawsweeper[bot] clawsweeper[bot] commented on Nov 21, 2026 06:38 UTC
    Bot

    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'.

  • Before: The server receives issueId as " LNR-123".

  • After: The server receives issueId as "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:

  • Main retains the separator: The colon branch forwards the remainder unchanged, and coerceValue preserves ordinary strings, so the documented single-token argument sends its leading separator space. (src/cli/call-argument-values.ts:30, d559d33d1d61)

  • Minimal repair and distinct regression coverage: The introduced diff changes only the existing colon-value branch, adds a regression covering separator removal, trailing spaces, whitespace-only values and the tool alias, and updates the syntax documentation and Unreleased changelog. (src/cli/call-argument-values.ts:31, 9d9aa82d820f)

  • Original syntax intent: Commit 623d3e7 introduced colon-delimited arguments in the former call-command parser and documented key:value and key: value as equivalent named-argument forms. (src/cli/call-command.ts, 623d3e7a4ef2)

  • Prior whitespace fix and affected release: Merged https://github.com/openclaw/mcporter/pull/504 intentionally preserved string whitespace; its changed string-return path explains this separator regression. The fixing commit for that prior change is contained in v0.17.1, whose changelog records it. (src/cli/call-argument-values.ts:67, a93b6d46b55a)

  • Supplied behavior evidence: The full PR body records built-CLI calls through the modern stdio fixture: 'text: LNR-123' changes from " LNR-123" to "LNR-123", with unspaced colon, two-token colon and padded equals-form controls preserved. The fixture's echo handler returns text unchanged. (tests/servers/modern/server.ts:39, 9d9aa82d820f)

  • Exact-head checks: Eight checks succeeded and two were skipped at the reviewed head, including successful Linux, Windows, Xcode and CodeQL checks; no failing check requires contributor repair. (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:

  • add P2: A documented argument form changes string values and can break ID lookups, with limited scope and working alternative argument forms.

  • add proof: sufficient: Contributor real behavior proof is sufficient.

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.

  • add 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 -->

    Reviewers
    None requested
    Assignees
    JYunth JYunth
    Labels
    risk: low confidence: 67.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37% (MEDIUM) · Higher = larger blast radius
    37%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 67.7% · Lower = rushed or shallow review
    67.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 12.0% · Safe to merge
    12.0%