Repository navigation
Conversation
When the gateway stop AbortSignal is already aborted at construction
time, the addEventListener('abort', stopOnAbort) listener never fires
per the AbortSignal spec. In non-webhook mode this skips stop() and
leaves the Zalo provider running. The fix calls stopOnAbort immediately
when abortSignal.aborted is already true, matching the pre-aborted
handling pattern in WhatsApp (openclaw#109903), QQBot (openclaw#109896), and ZaloUser
(openclaw#109988).
Co-Authored-By: Claude <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 6:37 AM ET / 10:37 UTC. Summary PR surface: Source +9, Tests +162. Total +171 across 3 files. Reproducibility: yes. in source-backed integration evidence: the supplied A/B loopback gateway scenario observes the unwanted Zalo API/resource-acquisition path on the base and its absence on the proposed head. The supplied evidence is against the PR base rather than a newly executed current-main run. Review metrics: none identified. 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:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the guarded early-return path after a routine rebase/check refresh, preserving the existing normal later-abort cleanup path. Do we have a high-confidence way to reproduce the issue? Yes in source-backed integration evidence: the supplied A/B loopback gateway scenario observes the unwanted Zalo API/resource-acquisition path on the base and its absence on the proposed head. The supplied evidence is against the PR base rather than a newly executed current-main run. Is this the best way to solve the issue? Yes. Checking the already-fired signal at the monitor boundary, invoking existing cleanup, and returning before resource acquisition is the narrowest fix; it avoids adding lifecycle state, configuration, or a parallel cleanup path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5360c75de23b. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +9, Tests +162. Total +171 across 3 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 (6 earlier review cycles)
|
…dy fired When the gateway stop AbortSignal is already aborted, return immediately after calling stopOnAbort() instead of falling through to hosted-media route registration, webhook setup, or polling. Previously, calling stop() before resource acquisition set stopped=true with an empty stopHandlers list; startup then continued and registered cleanup handlers (e.g. plugin HTTP route unregister callbacks) that were skipped by the finally block because stopped was already true. This leaked plugin HTTP routes across restart cycles. The fix exits before the try block so no resources are ever acquired when the monitor is already destined for shutdown. Co-Authored-By: Claude <[email protected]>
…ok startup Verify that monitorZaloProvider returns immediately without entering the polling loop or registering webhook routes when the abort signal is already aborted at construction time. Co-Authored-By: Claude <[email protected]>
ClawSweeper review feedback: the polling regression test should also assert getWebhookInfo is not called, since on main the polling path inspects the webhook before starting the loop. Without the early-return guard a pre-aborted signal would trigger the webhook inspection and then hang at waitForAbortSignal. Co-Authored-By: Claude <[email protected]>
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review Head 14a96a5 adds a committed no-module-mock integration proof through the configured Zalo account resolver, production gateway startAccount path, production HTTP client over loopback TCP, real AbortSignal, and real plugin route registry. The same test fails 2/2 on base db32132 by observing getWebhookInfo or setWebhook/deleteWebhook after pre-abort, and passes 2/2 on head with only the required getMe account probe and zero routes. The PR body contains the exact A/B matrix and proof boundary; Real behavior proof is green. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Reconstruct the verified Zalo lifecycle fix from #109990 on current main and preserve its exact production and regression-test blobs. Source: #109990 Co-authored-by: LZY3538 <[email protected]>
Reconstruct the verified Zalo lifecycle fix from #109990 on current main and preserve its exact production and regression-test blobs. Source: #109990 Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: LZY3538 <[email protected]>
|
Thank you, @LZY3538 — your Zalo lifecycle fix and both regression-test files are now landed on current Canonical PR: #115763 We reconstructed your change on current repaired Closing this original only now that the canonical commit has actually merged. Thank you for identifying and fixing the startup/shutdown race. |
) Reconstruct the verified Zalo lifecycle fix from openclaw#109990 on current main and preserve its exact production and regression-test blobs. Source: openclaw#109990 Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: LZY3538 <[email protected]>
What Problem This Solves
Fixes a shutdown race in the Zalo channel provider. When the gateway stop
AbortSignalwas already aborted beforemonitorZaloProviderregistered its listener, the abort event was not replayed and startup continued into polling or webhook resource acquisition.Why This Change Was Made
The monitor now checks
abortSignal.abortedimmediately before listener registration and before acquiring hosted-media routes, registering a webhook, or starting polling. The normal later-abort path remains unchanged.The fix stays inside the Zalo plugin and adds no config, protocol, SDK, dependency, or compatibility surface.
User Impact
Fast gateway stops and overlapping account lifecycle transitions no longer allow Zalo polling, webhook mutation, or local HTTP-route startup after shutdown has already won the race.
Evidence
Real behavior proof
The committed integration test exercises the complete production boundary:
configured OpenClaw Zalo account->zaloPlugin.gateway.startAccount->startZaloGatewayAccount-> real account probe ->monitorZaloProviderIt does not mock the Zalo API module, monitor, gateway runtime, config resolver,
fetch,AbortSignal, or plugin HTTP-route registry. The production Zalo HTTP client connects over a real loopback TCP socket using its supportedZALO_API_URLoverride. The loopback endpoint returns normal Zalo-shaped responses and records every API method observed without exposing the configured token.The same test was run against the PR base and the reviewed head:
db3213264agetMe,getWebhookInfo; webhook:getMe,setWebhook,deleteWebhook14a96a5713getMe; webhook:getMegetMeis the production gateway's account probe. On the fixed head, the already-aborted monitor performs no polling inspection, update polling, webhook registration/deletion, or local route registration after that probe.Base failure excerpts:
Head result:
Focused related validation on the final head:
Targeted
oxfmt,oxlint, andgit diff --checkpass. The standard pushed-head CI remains authoritative for full build, lint, and test-type gates.Proof boundary: this is a real-process, real-socket integration against a deterministic loopback Zalo API endpoint, not a claim of testing the public Zalo service. That substitution is appropriate for this race because the asserted behavior is the absence and ordering of API/resource acquisition after a pre-aborted lifecycle; the test fails on the base by observing the exact unwanted production HTTP methods and passes on the fixed head with only the required account probe.