Repository navigation
fix(wecom): end the inbox acceptance wait at its deadline (CHE-1842) [merge] - #298
Merged
Merged
Conversation
10 of 13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
Ready for human merge decision. Cross-lab review: ACCEPTED by x99-codex-luna at
c6203d0d86041d1385b99f2459ac839659fa93bb(comment01a14bbc-0762-7c20-bb05-ea110b121151), 0 current P0/P1. The original-test parent-red criterion is WAIVED by Cheese (Decision A, comment01a14bac-76b0-7f24-93fc-d4d5a31e7ff2), not PASS. Agents do not merge.Conditions
d4978e0c00b9a5f34f38e84d668f2728484a71fd.TestGetTaskChannelOrigin_RealSQLfails on this X99 database withcolumn "task_kind" does not exist. It fails the same way on the parent build, so it is not caused by this change. CI runs migrations first.TestTryDeliverInbox_FallbackAttemptDoesNotWaitAgaindid NOT fail locally on X99 on the parent or on the head. Pinned baselines, one normal run each (go test -p 1 ./internal/integrations/wecom -run '^TestTryDeliverInbox_FallbackAttemptDoesNotWaitAgain$' -count=200 -race -v, go1.26.9, isolated clean clones, exit 0): parentd4978e0c00b9a5f34f38e84d668f2728484a71fdcompleted 200 attempts with 0 failures; headc6203d0d86041d1385b99f2459ac839659fa93bbcompleted 200 attempts with 0 failures. The raw receipts are in the attachmentche1842-receipts.tgzon CHE-1841.-racerun (13:30 ICT, 17 Oct) was recovered from a session transcript. It recorded the parent SHA and anokline, with no per-attempt count and no captured exit status. Two earlier head runs (13:44 ICT and 13:49 ICT) ran on uncommitted trees and recorded no SHA, so they are not used. The earlier stress attempts against the parent (200 under 112 CPU hogs, 100 pinned to one busy core, 100 under a 5% CPU quota, 1300 with the process paused 4ms of every 7ms: 1,700 attempts in total, all passing) have logs with no per-attempt lines, no commands and no source SHAs. This PR makes no aggregate claim from them.01a14bac-76b0-7f24-93fc-d4d5a31e7ff2): WAIVED, not PASS. The cause is derived from the CI failure message and the code, then pinned by a deterministic test. That test is a surrogate and does not satisfy the original-test parent-red criterion.Change
confirmInboxpolls the claim store on a step timer (window/8). The caller context keeps a backstop that expires window/8 + 1ms after the deadline. A step timer started just before the deadline ran a whole step past it. The margin to the backstop shrank to 1ms plus the distance of the last poll from the deadline. Under load, the backstop won theselect, the verdict becamerelayUncertain, and the fallback bot was never offered the card.CI evidence (run
39005239805, jobbackend-tests):tryDeliverInbox = falseand "the recipient-wide bot was offered 0 frames, want 1" after 0.57s.Fix, in
server/internal/integrations/wecom/relay_outbound.go:min(step, time.Until(deadline)), so the final poll lands at the deadline.selectwaits on the caller context, not the backstop. A stall that expires both before theselectruns no longer decides the verdict by pick order.relayUncertain, because the wait now ends at that deadline before the context reports it.No timeout was raised and no retry was added.
Evidence
85f5e7c39162a92ac28b396d70eaadb44e59713aadds only a test. Its parent isd4978e0c00b9a5f34f38e84d668f2728484a71fd. On the parent that wall-clock test failed 18 of 20 runs. The independent review found it unsound: a late wake-up could skip the second poll and pass the regression.f2823e115800fe1056784ccff74113272a6e1facholds the fix.c6203d0d86041d1385b99f2459ac839659fa93bbreplaces the test withTestConfirmInbox_LastWaitDoesNotRunPastTheDeadlineon atesting/synctestclock. Time is fake, so no sleep, scheduler delay or load changes the result. The test asserts exactly 2 polls, the first at the start, the last at exactly the 800ms deadline, and a return at exactly 800ms.go test -p 1 ./internal/integrations/wecom -run '^TestConfirmInbox_LastWaitDoesNotRunPastTheDeadline$' -count=200 -racepassed 200 of 200.relay_outbound.goreverted to the parent source failed 200 of 200 ("the last acceptance poll ran at 898ms, want exactly the 800ms deadline").-run 'TestRelayPublish_|TestTryDeliverInbox_|TestConfirmInbox_' -count=30 -racepassed. Full package-p 1 -race -count=1: all pass except thetask_kinddatabase test named in Conditions.Closes CHE-1842
Refs CHE-1841
Changelog: none