Repository navigation
fix: deflake four tests under parallel -T1C builds - #3616
Merged
Merged
Conversation
- JevSupervisionMiddlewareTest (two failing tests plus concurrentCalls): the shared helper's 10ms periodic supervision tick can fire before a preempted subscribing thread emits a synchronous worker's terminal event, adding a superseded mid-run observation ahead of the terminal one. Schedule the middleware with an interval beyond any test lifetime: the terminal tick is emitted on worker completion, not on a timer, so the periodic tick becomes structurally impossible with no added test time. - ChatSessionsTest.pendingExternalRequestSurvivesRestartAndContinuesSameTurn: ChatSessions.snapshot derived the active run from a head read separate from the facts scan; a snapshot straddling a run's writer acquisition sees run/start without a lease owner and mislabels the starting turn as interrupted. Derive activeRun from the same head read that bounds the scan, and raise the two lifecycle awaits to 60s to cover the 23s observed under -T1C contention (same precedent as the rest of the class). - ToolConfirmationCoordinatorTest.nonOwnerPersistsDecisionButOwnerPollerAloneReleasesContinuation: drop the assertion that the 200ms owner poller has not released yet; that intermediate state is timing-dependent by design, while the guarantees are pinned by OWNER_UNAVAILABLE and the release assertions.
jujn
approved these changes
Oct 16, 2026
xzxiaoshan
added a commit
that referenced
this pull request
Oct 17, 2026
Follow-up to #3616. In its post-merge CI run, `ChatSessionsTest.injectionDoesNotStartExecutionAndSurvivesRestart` timed out on `session.await(task).block(Duration.ofSeconds(15))`: the turn completed normally but needed 16.5s under -T1C contention (submit to run/end), missing the hard ceiling by 1.5s. All four fixes from #3616 passed in that same run; this is the next wait site in the same class, previously left alone because it had a nominal ~1.2s load and no failure record. `AgentSession.await` polls the task every 100ms and completes as soon as it settles, so the ceiling only bounds the failure deadline — the block returns immediately on completion. Raising it to 60s adds no time to the happy path (measured ~4.5s locally, ~7-19s across CI runs) and matches the 60s budgets already used for the same scenario in this test class. No assertions change.
3 tasks done
4 tasks done
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.
Deflakes the four failures from the 162118 CI batch. All are load-induced races under
-T1C; each fix is argued from code logic, not from reruns.JevSupervisionMiddlewareTest (ubuntu, 2 failures)
runtimeIterationLimitCannotTurnIntoCompletionEvenWithPositiveJudgments(expectedMANUAL_REVIEW, gotCONTINUE) andsynchronousWorkerIsSubscribedOnceAndAllEventsAreIdentical(expected 1 observation, got 2).The supervision tick stream is
Flux.interval(minInterval)cancelled by worker completion, plus a final tick emitted by that cancellation (concatWith). The tests use the shared helper with a 10ms interval, and their workers are synchronous (Flux.just). When a loaded runner preempts the subscribing thread mid-subscription, the 10ms periodic tick fires first and publishes a superseded mid-run observation ahead of the terminal one, which breaks both assertions.Fix: construct the middleware with an interval beyond any test lifetime (
Duration.ofDays(1)). The terminal tick is emitted on worker completion, not on a timer, so a mid-run tick becomes structurally impossible and the test duration is unchanged. The same upgrade is applied toconcurrentCalls..., which previously used a probabilistic 250ms widening for the identical race.ChatSessionsTest.pendingExternalRequestSurvivesRestartAndContinuesSameTurn (windows)
Timed out waiting for
suspendedwith the turn shown asinterrupted.Root cause (reproduced locally under full-core load, transient
interruptedbefore everysuspended):ChatSessions.snapshotcomputed the active run from onehead()read whileChatHistory.snapshotre-read the head and scanned facts separately. A snapshot that straddles a run's writer acquisition (GC pause / preemption between the two reads under -T1C) seesrun/startin the facts but no lease owner, and mislabels the starting turn asinterrupted. The CI log shows the failing run stalled 17s betweenPRE_CALLandPRE_REASONING, so the 15s await deadline landed mid-startup and caught exactly this window.Fix: derive
activeRunfrom the same single head read that bounds the facts scan, making the lease view and the facts view consistent by construction. Verified by rerunning the reproduction harness: zero mislabels after the fix (previously reproduced within 2-5 iterations).Additionally, the phase-1 await is raised to 60s: the CI run needed 23.45s for a single suspension under contention, above the 15s default. This matches the existing 60s budgets already used in this class for the same scenario, and adds no time to the happy path (poll-based exit).
ToolConfirmationCoordinatorTest.nonOwnerPersistsDecisionButOwnerPollerAloneReleasesContinuation (windows)
continuationReadywas expected false but was true: the owner poller daemon polls the shared ticket every 200ms, so asserting it has not yet released is timing-dependent by construction — any preemption longer than one poll cycle breaks it. The guarantee the assertion aimed at is already pinned deterministically byOWNER_UNAVAILABLE(the non-owner returns before any release side effect) plus the poller-driven release and idempotency assertions below it. The racy intermediate assertion is dropped with an explanatory comment.Testing
mvn -pl agentscope-examples/agents/agentscope-chat test— 10/10 (×6)mvn -pl agentscope-examples/jev test— 185/185 (fixed class ×9)mvn -pl agentscope-service/service-dataplane test— 135 pass / 2 skipped, same as CI (fixed class ×9)interruptedeliminated