Skip to content

fix(zalo): report failed HTTP probes as unhealthy - #124593

Merged
steipete merged 1 commit into
mainfrom
fix/autoqa-channel-probe-outcomes-v3
Aug 16, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/autoqa-channel-probe-outcomes-v3

Conversation

@steipete

@steipete steipete commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor
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 works even 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

  • Live public Zalo control: the exact rebased candidate made one read-only, bodyless POST getMe call to the real public Zalo Bot API with a clearly synthetic invalid token. Zalo returned its actual invalid-token contract—HTTP 200 with body-level Not Found—and the existing body-error path returned probe.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.
  • Controlled non-2xx regression: a real loopback HTTP server returned HTTP 401 with deliberately success-shaped JSON (ok:true plus bot identity). Before the repair, the probe returned ok:true and the human projection rendered works; on this head, the shared API owner rejects it and the probe reports ok:false with zalo.getMe (401). The server closes connections and awaits shutdown.
  • Owner and projection coverage: 62 focused tests passed; Gateway status and human CLI projection added 36 passing checks; the real plugin/Gateway/manual source-blind projection passed twice.
  • Static and review gates: formatting, lint, types, import cycles, and focused diff checks passed. Fresh autoreview reported no accepted/actionable findings. The broader changed gate reached only a missing playwright-core worktree dependency; all relevant lanes were green.
  • Exact head: 701776ca2c60828ac9049a61b8b7e56bfaa45a30. Rebase onto local origin/main changed the commit identity but left both patch blobs byte-identical.
  • LOC: production +5/-1 (net +4); tests +48/-0.

ClawSweeper Rank-up Moves

  • Current-main refresh: accepted on the existing exact head. GitHub reports the PR mergeable against current main, and exact-head hosted CI run 31949697657 is green. Repository landing policy treats behind-main drift as advisory when there is no conflict; lead review explicitly authorized preserving exact candidate 701776ca2c60828ac9049a61b8b7e56bfaa45a30, so no drift-only rebase is warranted. Native prepare will validate the current merge result.
  • Production growth: accepted. The net +4 production lines put the HTTP-status decision in the shared Zalo API owner. Moving it into the generic JSON reader would improperly broaden that helper, while a probe-only guard would leave sibling Zalo operations inconsistent.
  • Maintainer handling: no repair lane is needed. Proceeding through native review artifacts, Testbox prepare, and native merge on the reviewed head.
  • Stored-data note: ClawSweeper's serialized-state detector matched JSON inside probe.test.ts; this PR changes no persistence, schema, migration, config, or stored data model.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: zalo Channel integration: zalo size: S maintainer Maintainer-authored PR labels Aug 16, 2026
@steipete steipete self-assigned this Aug 16, 2026
@steipete
steipete marked this pull request as ready for review August 16, 2026 13:23
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 9:30 AM ET / 13:30 UTC.

ClawSweeper review

What this changes

The 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 provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No 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
Reviewed head: 701776ca2c60828ac9049a61b8b7e56bfaa45a30

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A small owner-boundary repair with a credible network-boundary regression test and no supported correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records a public-provider control and an after-fix loopback transport result.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records a public-provider control and an after-fix loopback transport result.
Evidence reviewed 7 items Current-main defect: Current main parses the body before checking HTTP success, so a non-2xx response with ok: true and a result can pass the later body-only success check.
Owner-boundary repair: The branch adds one pre-parse provider-error assertion in the common Zalo API client, covering getMe and every other call routed through it.
Shared helper contract: The existing Plugin SDK helper returns on response.ok and otherwise throws a normalized, bounded provider error after consuming the failed response body.
Findings None None.
Security None None.

How this fits together

Zalo 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
Loading

Before merge

  • Resolve merge risk (P1) - The common guard changes failed-status handling for every Zalo API operation, including configured alternate endpoints and proxies; this is the correct owner boundary, but exact-head validation after rebasing should confirm the deployed integration still passes.
  • Resolve merge risk (P1) - Production grows by four net lines for the shared status assertion. That growth is justified because moving HTTP-status policy into the JSON reader would broaden a generic helper and leave the Zalo client without an explicit transport boundary.
  • Complete next step (P2) - No repair lane is needed: the patch is a correct focused fix; normal maintainer merge handling and exact-head refresh are the remaining actions.
Agent review details

Security

None.

PR surface

Source +4, Tests +48. Total +52 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 1 +4
Tests 1 48 0 +48
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 53 1 +52

Review metrics

Metric Value Why it matters
Production versus regression-test LOC production +5/-1 (net +4); tests +48/-0 The production addition is one shared HTTP-status decision that covers all Zalo calls; the test adds a real loopback transport regression.

Stored data model

Persistent data-model change detected: serialized state: extensions/zalo/src/probe.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Refresh against current main (recommended)
    Rebase or otherwise refresh the cleanly mergeable branch and rerun exact-head validation so the shared Zalo transport change is verified with the current base.
  2. Accept the current-base evidence
    Merge the clean branch only if maintainers explicitly accept the current exact-head proof despite its behind-main status.

Technical review

Best possible solution:

Keep one pre-parse Response.ok check in callZaloApi, rather than adding per-probe guards, then merge once the branch is refreshed against current main and exact-head checks are green.

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.

Labels

Label changes:

  • add P2: Incorrect Zalo health reporting has a bounded channel-specific operator impact.
  • add merge-risk: 🚨 compatibility: The shared Zalo API client now rejects non-2xx responses for every plugin operation, affecting alternate endpoints and proxy-mediated responses.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records a public-provider control and an after-fix loopback transport result.

Label justifications:

  • P2: Incorrect Zalo health reporting has a bounded channel-specific operator impact.
  • merge-risk: 🚨 compatibility: The shared Zalo API client now rejects non-2xx responses for every plugin operation, affecting alternate endpoints and proxy-mediated responses.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless records a public-provider control and an after-fix loopback transport result.

Evidence

What I checked:

  • Current-main defect: Current main parses the body before checking HTTP success, so a non-2xx response with ok: true and a result can pass the later body-only success check. (extensions/zalo/src/api.ts:158, d8697d595647)
  • Owner-boundary repair: The branch adds one pre-parse provider-error assertion in the common Zalo API client, covering getMe and every other call routed through it. (extensions/zalo/src/api.ts:161, 701776ca2c60)
  • Shared helper contract: The existing Plugin SDK helper returns on response.ok and otherwise throws a normalized, bounded provider error after consuming the failed response body. (src/agents/provider-http-errors.ts:313, d8697d595647)
  • Status caller path: The Zalo channel status adapter invokes the runtime probe, which delegates to probeZalo; a failed common-client response therefore reaches the status projection as unhealthy. (extensions/zalo/src/channel.ts:258, 701776ca2c60)
  • Boundary regression coverage: The added loopback-server test supplies HTTP 401 with a success-shaped Zalo body and verifies the user-facing probe result is unsuccessful; it would have passed as healthy before the new assertion. (extensions/zalo/src/probe.test.ts:35, 701776ca2c60)
  • History and area ownership: The pre-PR response parsing lines blame to 7d05f7c; broader Zalo history includes repeated probe and delivery maintenance by the people listed below. (extensions/zalo/src/api.ts:158, 7d05f7c5b99d)

Likely related people:

  • steipete: Recent Zalo probe, delivery, and lifecycle fixes establish sustained ownership of this plugin surface beyond this proposed branch. (role: recent area contributor; confidence: high; commits: 7c6b512759f3, 846bef946dbc, 17006d7de525; files: extensions/zalo/src/api.ts, extensions/zalo/src/probe.ts, extensions/zalo/src/channel.runtime.ts)
  • vincentkoc: History shows direct Zalo API and plugin-boundary refactors that are adjacent to the shared client being changed. (role: historical Zalo API refactor contributor; confidence: medium; commits: fc4626c1221d, 645c5bda2cbe; files: extensions/zalo/src/api.ts)
  • Nehorai Hadad: The pre-PR HTTP-response parsing lines currently blame to this commit; the broader feature trail is shared. (role: current-line author in history; confidence: low; commits: 7d05f7c5b99d; files: extensions/zalo/src/api.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

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 data.ok path.

Proof completed:

  • Exact-head CI run 31949697657 is green with zero pending checks.
  • Controlled real loopback HTTP 401 plus success-shaped JSON reproduced the false healthy probe before the fix and now returns probe.ok=false with zalo.getMe (401); transport/server cleanup completed.
  • One read-only real public Zalo getMe control observed the provider's actual invalid-token contract, HTTP 200 plus body-level Not Found, and returned probe.ok=false; no credential, send, message, or persistent side effect was used.
  • Direct-review proof remained applicable because the rebase left both changed blobs byte-identical: 62 focused tests, 36 Gateway/CLI projection checks, two source-blind projections, format/lint/types/cycles, and clean autoreview.
  • ClawSweeper reviewed this exact head at 5/6 with no correctness or security findings. Every rank-up move and the serialized-state false positive are resolved in the PR body.

Native landing commands:

  • node scripts/watch-pr-ci.mjs 124593 701776ca2c60828ac9049a61b8b7e56bfaa45a30
  • scripts/pr review-init 124593
  • scripts/pr review-checkout-main 124593
  • scripts/pr review-checkout-pr 124593
  • scripts/pr review-guard 124593
  • scripts/pr review-artifacts-init 124593
  • scripts/pr review-validate-artifacts 124593
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 124593

Native artifact validation returned READY FOR /prepare-pr with zero findings. Prepare passed in hosted_exact_or_recent_parent mode at 2026-08-16 13:36 UTC, preserved the exact head, and verified the remote tree matches the prepared tree.

Known proof gap: the initial worktree's broader changed gate could not start because playwright-core was absent. All relevant lanes and exact-head hosted CI are green; native prepare accepted the exact hosted gate. No further live Zalo variants were attempted because manufacturing a proxy/provider non-2xx would not test the public API's real contract.

LOC: production +5/-1 (net +4); tests +48/-0. No config, protocol, SDK, persistence, schema, docs, changelog, release, or deployment change.

@steipete
steipete merged commit 85ac519 into main Aug 16, 2026
178 checks passed
@steipete
steipete deleted the fix/autoqa-channel-probe-outcomes-v3 branch August 16, 2026 13:38
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

channel: zalo Channel integration: zalo maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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.

1 participant