Skip to content

test: deflake five single-OS CI failure classes under -T1C contention - #4556

Merged
jujn merged 1 commit into
agentscope-ai:mainfrom
xzxiaoshan:fix/ci-test-flakes-1202
Dec 2, 2026
Merged

jujn merged 1 commit into
agentscope-ai:mainfrom
xzxiaoshan:fix/ci-test-flakes-1202

Conversation

@xzxiaoshan

Copy link
Copy Markdown
Collaborator

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 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 #4102, #4470, #4499, #4508, #4509, #4441, #4515, #4541, #4551, #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 #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 #4471 (2026-11-28), #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 #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 #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 #4435 addressed for two other classes: since #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

## 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
jujn merged commit 4c63e6c into agentscope-ai:main Dec 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants