Repository navigation
test: deflake five single-OS CI failure classes under -T1C contention - #4556
Merged
Merged
Conversation
## Background Swept the last 125 PRs (agentscope-ai#4357 to agentscope-ai#4552), every single-OS-failed CI run since 2026-11-24 (including runs that a later push or re-run hid from the check rollups) and the main-branch push runs for `mvn -B -T1C clean verify` failures (one build OS red and the other green on the same commit = flake suspect). Five test classes still fail on current main, all on windows-latest. All fixes are test-side only (no `src/main` changes). ## Fixes and evidence | Test class | Victims | Signature | Fix | |---|---|---|---| | `HarnessContextRegressionTest` | agentscope-ai#4102, agentscope-ai#4470, agentscope-ai#4499, agentscope-ai#4508, agentscope-ai#4509, agentscope-ai#4441, agentscope-ai#4515, agentscope-ai#4541, agentscope-ai#4551, agentscope-ai#4213 (2026-11-26 to 12-02), all windows-latest | journaled invocations stopped finishing within their 10s and 15s `block` deadlines (Surefire elapsed up to 15.56s), while the journal-disabled rows stayed at 0.01-0.47s in the same runs; the class takes 25.2-43.7s on windows-latest when green against 13.1-19.2s on ubuntu | ephemeral `InMemoryThreadJournalStore` on all seven agent builders, so the journal-enabled and journal-disabled rows keep their meaning | | `HarnessGatewayEventPublicationTest` | agentscope-ai#2871 (2026-12-01), windows-latest | `turn.get(5s)` crossed at 9.72s; 0.99-8.67s when green on windows-latest against 0.15-0.32s on ubuntu | ephemeral `InMemoryThreadJournalStore` on the one real agent | | `WaitAsyncResultsToolTest` | agentscope-ai#4471 (2026-11-28), agentscope-ai#4395 and main run 46441604698 (both 2026-11-30), all windows-latest | `ConcurrentModificationException` in the test's own stub: the completer thread appends to an `ArrayList` while the tool thread streams it | `CopyOnWriteArrayList` in `MutableTaskRepository` | | `LocalFilesystemWithShellTest` | agentscope-ai#4523 and main run 46571815777 (both 2026-12-01), windows-latest, one sibling test each | the test body passed, then JUnit's `@TempDir` cleanup failed to delete `<root>`: a forcibly terminated fixture process still held its working directory | the three process-tree tests poll until the directory can be renamed, which succeeds on the first attempt unless the hold is still open | | `ChatControllerTest` | agentscope-ai#4481 (2026-11-28), windows-latest | WebTestClient's default 5s response timeout crossed on the idempotent replay, 6.61s for the test against 1.45-6.00s when green on windows-latest; the demo's SQLite store itself waits up to 10s for the database lock | `responseTimeout(15s)` through one `webClient` helper | The first two share the cause agentscope-ai#4435 addressed for two other classes: since agentscope-ai#4154 the default workspace journal is `SqliteJournalStorage` on Windows, one connection and one durable transaction per storage operation. Neither class asserts journal persistence, so they now use the ephemeral backend. Locally on Windows `HarnessContextRegressionTest` dropped from 12.47s to 2.27s. ## Constraint compliance - Happy path zero cost: the journal swaps remove work, the rename probe returns on its first attempt, and the one relaxation only moves a failure deadline. No sleeps were added to the happy path and no assertion was weakened. - Structural hardening first: four of the five fixes are structural. `awaitDirectoryReleased` sleeps 20ms only while the hold is still open, and `responseTimeout(15s)` is the smallest round value above the store's own 10s lock wait. - No `src/main` changes. ## Observed but deliberately not fixed here - `ChatControllerTest.toolOutputPreviewIsDeliveredWithoutAdvancingTheSessionCursor` (four windows-latest runs since 2026-11-27: agentscope-ai#4463, agentscope-ai#4466 and main runs 46098902103 and 46376103441): `preview.get(10s)` times out because the tool-output previews are lost, not late. Live previews are buffered per subscription and drained only once the reader has caught up, and `LivePreviewState` drops a `tool.output.delta` once that tool's outcome is committed. When the subscription's poll path stalls under -T1C the tool finishes first and its buffered previews are discarded; in the three logs with timestamps the tools had produced their output 3.6-4.5s before the timeout. Widening the deadline cannot help, and whether a late reader should still deliver previews that preceded the outcome is a durable runtime decision. - The same test failed three more times on windows-latest with `durable.db` still open at `@TempDir` cleanup (main run 46231881667, agentscope-ai#4515, agentscope-ai#2567): agentscope-ai#4509 addresses that. - `McpRecoveryTest.workerReplacementRecoversOriginalCallAfterLostReplyAndPreservesStructuredResult` (agentscope-ai#3716, 2026-11-26, windows-latest, 56.01s): `Worker lease lost` interrupts a manual `tick()`, the same lease and heartbeat family agentscope-ai#4435 listed for `WorkerRuntimeTest`. - `ReActAgentPerSessionStateTest.evictStateCacheAfterCallWithThreadJournalDropsPermissionEngine` (agentscope-ai#4545, ubuntu-latest, 0.011s): added by that PR, so a race in its new eviction path cannot be excluded. - On 2.0.x only: `HarnessAgentOverflowRecoveryTest.pendingSummaryKeepsSameSessionOwnedWhileAnotherSessionProgresses[1]` (agentscope-ai#4542, 5s deadline crossed at 8.52s; the agentscope-ai#4435 journal swap is not on that branch) and `HttpSelfRegistrationTest.registrationUsesTenantAndDurableIdentityForHeartbeatAndDelete` (agentscope-ai#4450). - Three windows-latest jobs ended with "The hosted runner lost communication with the server": agentscope-ai#4351 run 45750997046, main run 46271166838 and the Windows job of agentscope-ai#4545. - Already fixed upstream, victims predate the fix: `DashScopeMultiModalEmbeddingTest` (agentscope-ai#4413, fixed by agentscope-ai#4435) and `HarnessAgentOverflowRecoveryTest.overflowAfterAToolStepRetriesOnceWithoutRerunningTheTool[3]` (agentscope-ai#4426, agentscope-ai#4042, fixed by agentscope-ai#4435).
jujn
approved these changes
Dec 2, 2026
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.
Background
Swept the last 125 PRs (#4357 to #4552), every single-OS-failed CI run since 2026-11-24 (including runs that a later push or re-run hid from the check rollups) and the main-branch push runs for
mvn -B -T1C clean verifyfailures (one build OS red and the other green on the same commit = flake suspect). Five test classes still fail on current main, all on windows-latest. All fixes are test-side only (nosrc/mainchanges).Fixes and evidence
HarnessContextRegressionTestblockdeadlines (Surefire elapsed up to 15.56s), while the journal-disabled rows stayed at 0.01-0.47s in the same runs; the class takes 25.2-43.7s on windows-latest when green against 13.1-19.2s on ubuntuInMemoryThreadJournalStoreon all seven agent builders, so the journal-enabled and journal-disabled rows keep their meaningHarnessGatewayEventPublicationTestturn.get(5s)crossed at 9.72s; 0.99-8.67s when green on windows-latest against 0.15-0.32s on ubuntuInMemoryThreadJournalStoreon the one real agentWaitAsyncResultsToolTestConcurrentModificationExceptionin the test's own stub: the completer thread appends to anArrayListwhile the tool thread streams itCopyOnWriteArrayListinMutableTaskRepositoryLocalFilesystemWithShellTest@TempDircleanup failed to delete<root>: a forcibly terminated fixture process still held its working directoryChatControllerTestresponseTimeout(15s)through onewebClienthelperThe first two share the cause #4435 addressed for two other classes: since #4154 the default workspace journal is
SqliteJournalStorageon Windows, one connection and one durable transaction per storage operation. Neither class asserts journal persistence, so they now use the ephemeral backend. Locally on WindowsHarnessContextRegressionTestdropped from 12.47s to 2.27s.Constraint compliance
awaitDirectoryReleasedsleeps 20ms only while the hold is still open, andresponseTimeout(15s)is the smallest round value above the store's own 10s lock wait.src/mainchanges.Observed but deliberately not fixed here
ChatControllerTest.toolOutputPreviewIsDeliveredWithoutAdvancingTheSessionCursor(four windows-latest runs since 2026-11-27: fix(harness): read session task records once per subagent summary #4463, fix(harness): route background wakeups to the owning agent #4466 and main runs 46098902103 and 46376103441):preview.get(10s)times out because the tool-output previews are lost, not late. Live previews are buffered per subscription and drained only once the reader has caught up, andLivePreviewStatedrops atool.output.deltaonce that tool's outcome is committed. When the subscription's poll path stalls under -T1C the tool finishes first and its buffered previews are discarded; in the three logs with timestamps the tools had produced their output 3.6-4.5s before the timeout. Widening the deadline cannot help, and whether a late reader should still deliver previews that preceded the outcome is a durable runtime decision.durable.dbstill open at@TempDircleanup (main run 46231881667, feat(harness): add per-invocation skill credential hook #4515, fix(harness): classify sandbox-backed overlays for skill shell paths #2567): fix(durable): drain borrowed connections before JdbcRecordStore.close() returns #4509 addresses that.McpRecoveryTest.workerReplacementRecoversOriginalCallAfterLostReplyAndPreservesStructuredResult(fix(core): ACCEPT_EDITS approves in-scope writes without overriding the tool's own decision (#2870) #3716, 2026-11-26, windows-latest, 56.01s):Worker lease lostinterrupts a manualtick(), the same lease and heartbeat family test: deflake four single-OS CI failure classes under -T1C contention #4435 listed forWorkerRuntimeTest.ReActAgentPerSessionStateTest.evictStateCacheAfterCallWithThreadJournalDropsPermissionEngine(feat(core): add opt-in evictStateCacheAfterCall to release per-session caches #4545, ubuntu-latest, 0.011s): added by that PR, so a race in its new eviction path cannot be excluded.HarnessAgentOverflowRecoveryTest.pendingSummaryKeepsSameSessionOwnedWhileAnotherSessionProgresses[1](fix(aistio): deregister on close without a heartbeat registering the instance again (#3132) #4542, 5s deadline crossed at 8.52s; the test: deflake four single-OS CI failure classes under -T1C contention #4435 journal swap is not on that branch) andHttpSelfRegistrationTest.registrationUsesTenantAndDurableIdentityForHeartbeatAndDelete(fix(harness): key transcript segments on the sessions route on 2.0.x (#2918) #4450).DashScopeMultiModalEmbeddingTest(fix(storage): avoid overflow in search page bounds #4413, fixed by test: deflake four single-OS CI failure classes under -T1C contention #4435) andHarnessAgentOverflowRecoveryTest.overflowAfterAToolStepRetriesOnceWithoutRerunningTheTool[3](fix(studio): run blocking Studio HTTP calls off the subscriber thread #4426, fix(core): fail SSE streams that end before the declared terminator instead of silently truncating #4042, fixed by test: deflake four single-OS CI failure classes under -T1C contention #4435).