Repository navigation
fix(gateway-protocol): trim connect error detail codes in readConnectErrorDetailCode - #99555
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 5:21 AM ET / 09:21 UTC. Summary PR surface: Source 0, Tests +45. Total +45 across 2 files. Reproducibility: yes. from source, without executing local tests in this read-only review. Current main and v2026.6.11 return raw padded detail codes while downstream gateway-client and Control UI paths compare those values strictly against canonical constants. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the shared-reader normalization with the focused regression tests after ordinary maintainer review; no new API, config, migration, or compatibility path is needed. Do we have a high-confidence way to reproduce the issue? Yes from source, without executing local tests in this read-only review. Current main and v2026.6.11 return raw padded detail codes while downstream gateway-client and Control UI paths compare those values strictly against canonical constants. Is this the best way to solve the issue? Yes. Trimming in readConnectErrorDetailCode is the narrowest maintainable fix because downstream callers already route strict code comparisons through that shared untrusted-payload reader. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 153ee2abbaff. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0, Tests +45. Total +45 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
@clawsweeper re-review Updated the PR body with standalone runtime proof for padded gateway connect-error detail codes outside Vitest. The proof imports the PR-head gateway-protocol runtime module directly and shows both |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Labels were stripped at 15:36 UTC while the review comment still shows platinum hermit / proof sufficient. Please re-sync labels with the current review verdict. |
|
@clawsweeper re-review |
720115e to
ec9df84
Compare
…ErrorDetailCode Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
ec9df84 to
419f5c1
Compare
|
Maintainer fixup and land-ready verification complete on exact head
Thank you @ly85206559 for the focused fix and regression coverage. |
|
Merged via squash.
|
…ErrorDetailCode (openclaw#99555) * fix(gateway-protocol): trim connect error detail codes in readConnectErrorDetailCode Co-authored-by: Cursor <[email protected]> * chore: add connect error detail code trim proof script Co-authored-by: Cursor <[email protected]> * chore(gateway-protocol): drop proof-only trim script --------- Co-authored-by: Cursor <[email protected]>
What Problem This Solves
Gateway connect-error payloads can carry padded
details.codestrings (leading/trailing whitespace).readConnectErrorDetailCode()previously returned the raw string after only checkingcode.trim().length > 0, so strict comparisons againstConnectErrorDetailCodes.*failed and downstream helpers (readPairingConnectErrorDetails,formatConnectErrorMessage) fell back to generic messages.Why This Change Was Made
Return
code.trim()fromreadConnectErrorDetailCode()so normalized detail codes match canonical constants and structured formatting paths run for untrusted gateway error details.User Impact
Control UI and other gateway clients show correct pairing-required and protocol-mismatch messages when the server sends padded detail codes, instead of generic fallback text.
Evidence
packages/gateway-protocol/src/connect-error-details.test.ts720115e02091e375b8b84be96842878dbe685458showing padded detail codes normalize before pairing/protocol formattingReal behavior proof
Standalone runtime proof
This runs outside Vitest and imports the PR-head gateway-protocol runtime module directly.
Command:
Output:
{ "proof": "gateway connect-error detail code trim", "prHead": "720115e02091e375b8b84be96842878dbe685458", "pairing": { "rawCode": " PAIRING_REQUIRED ", "normalizedCode": "PAIRING_REQUIRED", "details": { "code": "PAIRING_REQUIRED", "reason": "role-upgrade", "requestId": "req_123", "remediationHint": "Review the requested role upgrade, then approve the pending request." }, "formattedMessage": "role upgrade pending approval (requestId: req_123)" }, "protocolMismatch": { "rawCode": " PROTOCOL_MISMATCH ", "normalizedCode": "PROTOCOL_MISMATCH", "formattedMessage": "protocol mismatch: Control UI v2-v4, Gateway v3, probe min v2" } }Rebase
Vitest
Command:
Output:
Oxlint
Command:
Output: no diagnostics; exit code 0.