Repository navigation
fix(zalo): report failed HTTP probes as unhealthy - #124593
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 9:30 AM ET / 13:30 UTC. ClawSweeper reviewWhat this changesThe PR makes Zalo’s shared API client reject non-2xx responses before parsing a body that could otherwise be interpreted as a healthy account probe. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo blocking correctness or security finding: the shared Zalo API boundary now rejects failed HTTP responses before a success-shaped body can make a probe appear healthy. This PR remains necessary because current main still lacks that check; merge after rebasing/refreshing exact-head validation. Priority: P2 Review scores
Verification
How this fits togetherZalo account health checks use the plugin’s common HTTP client, then surface their result through channel status in the Gateway and CLI. The changed client boundary decides whether an HTTP response is eligible to be interpreted as a successful Zalo API result. flowchart LR
A[Zalo account probe] --> B[Shared Zalo API client]
B --> C[HTTP response]
C --> D{Response is successful?}
D -->|No| E[Normalized provider error]
D -->|Yes| F[Parse Zalo JSON result]
E --> G[Channel status is unhealthy]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +48. Total +52 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one pre-parse Do we have a high-confidence way to reproduce the issue? Yes, from source: current main parses a response body before considering HTTP status, and probeZalo treats a success-shaped body as healthy. The added loopback case is a credible focused reproduction, though it was not executed in this read-only review. Is this the best way to solve the issue? Yes. The common Zalo API client is the narrowest owner because all Zalo operations pass through it; a probe-only guard would leave other failed HTTP responses inconsistent. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d8697d595647. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready verification for exact head 701776ca2c60828ac9049a61b8b7e56bfaa45a30. The root cause is in the shared Zalo API owner: it parsed success-shaped JSON before enforcing HTTP status. The canonical fix calls the existing Plugin SDK provider-error assertion before success parsing, so all Zalo operations reject non-2xx transport outcomes while HTTP 2xx body errors remain on the existing Proof completed:
Native landing commands:
Native artifact validation returned Known proof gap: the initial worktree's broader changed gate could not start because LOC: production |
|
Merged via squash.
|
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
AI-assisted: yes.
What Problem This Solves
Fixes an issue where Zalo account probes could report a channel as working when the Bot API returned a failed HTTP status carrying success-shaped JSON. That false-positive status could flow through Gateway status and the human CLI as
workseven though the transport request failed.Why This Change Was Made
The shared Zalo API owner now rejects non-2xx responses through the canonical Plugin SDK provider-error helper before parsing success data. This covers every Zalo API operation at the common boundary while preserving the existing body-level error handling for 2xx responses.
User Impact
Operators now see a failed Zalo probe when the provider transport returns a non-2xx response, rather than a misleading healthy status. Normal successful responses and Zalo's 2xx body-error contract are unchanged.
Evidence
POST getMecall to the real public Zalo Bot API with a clearly synthetic invalid token. Zalo returned its actual invalid-token contract—HTTP 200 with body-levelNot Found—and the existing body-error path returnedprobe.ok=false. The error was bounded to 9 characters, contained no token, the response body was consumed, and the request timer was cleared. No credential, message/send operation, or persistent mutation was involved.ok:trueplus bot identity). Before the repair, the probe returnedok:trueand the human projection renderedworks; on this head, the shared API owner rejects it and the probe reportsok:falsewithzalo.getMe (401). The server closes connections and awaits shutdown.playwright-coreworktree dependency; all relevant lanes were green.701776ca2c60828ac9049a61b8b7e56bfaa45a30. Rebase onto localorigin/mainchanged the commit identity but left both patch blobs byte-identical.+5/-1(net+4); tests+48/-0.ClawSweeper Rank-up Moves
main, and exact-head hosted CI run31949697657is green. Repository landing policy treats behind-main drift as advisory when there is no conflict; lead review explicitly authorized preserving exact candidate701776ca2c60828ac9049a61b8b7e56bfaa45a30, so no drift-only rebase is warranted. Native prepare will validate the current merge result.probe.test.ts; this PR changes no persistence, schema, migration, config, or stored data model.