Skip to content

fix: accept HITL resume while the paused run unwinds; deflake flaky Windows CI tests - #3602

Merged
jujn merged 2 commits into
agentscope-ai:mainfrom
xzxiaoshan:fix/pr3593-ci-failures
Oct 16, 2026
Merged

jujn merged 2 commits into
agentscope-ai:mainfrom
xzxiaoshan:fix/pr3593-ci-failures

Conversation

@xzxiaoshan

@xzxiaoshan xzxiaoshan commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes one product bug plus five flaky-test fixes, all surfaced by Windows CI runs; each item below cites the run where the failure was observed.

agent-protocol — HITL resume race (product bug, from the #3593 CI run). A paused run persists the awaiting_confirm record before its CompletableFuture completes. A client reacting to the record (fast poll or the REQUIRE_CONFIRM SSE event) calling resume inside that window was rejected with IllegalStateException: task is already running → HTTP 409.

  • resume() now treats the persisted record as the authoritative pause signal; the in-memory future check is removed
  • a per-task lock with in-lock revalidation keeps concurrent double-resumes rejected (409 semantics preserved)
  • futures.remove(taskId, f) in submit/resume so a late-unwinding run cannot drop a newer run's future
  • new deterministic regression test pins the window with a latch: fails on the old code with the exact CI stack trace, passes after the fix

core — JdkHttpTransportTest flaky 2s deadlines (test stability, from the #3593 CI run). Under Windows CI parallel builds (mvn -T1C), the self-imposed 2s read/response deadlines were exceeded during connect: 3/52 tests failed as timeouts with no behavioral assertion failures (class runtime 21s on Windows vs 9s on Linux).

  • setUp deadlines relaxed: read/response 2s→10s, connect 5s→15s (stream idle stays 1s)
  • the two tests that assert timeout behavior now build their own 2s-deadline transports (existing pattern in the class), so guard strength is unchanged
  • 8 status-code assertions made null-safe (Integer.valueOf(n).equals(...)) so timeouts report the real error instead of an NPE

examples / harness — four more Windows CI flakes (test stability, follow-up commit). All four adjust timing budgets or await points only; what each test verifies is unchanged.

  • ChatSessionsTest (queuedTasksAreDistinctAndSteeringStaysInCurrentExecution, fix(core): read pending interactions in a single scan #3582 CI run): timed out in the await(...) helper's 15s default budget — two durable turns with streamed output can exceed 15s on GitHub's Windows runners. The two affected call sites now pass an explicit 60s budget.
  • WorkspaceTaskRepositoryRemoteStreamingTest (remoteTask_togglesAwaitingConfirm_thenFiresCompletionOnSuccess, fix(service): project managed chat turns into the session event log #3583 CI run): the poller persists the terminal record before firing the completion callback, so the terminal state could be observed in the gap between those two steps. The test now awaits the completion callback instead of asserting it has already run.
  • JevSupervisionMiddlewareTest (concurrentCallsKeepScopesEvidenceAndCountersSeparate, feat(a2a)!: upgrade to A2A protocol 1.0 with a2a-java-sdk 1.4.0.Final #3590 CI run): this test's worker completes synchronously, so only the terminal assessment should fire, but the shared helper's 10ms tick could sneak in a superseded mid-run observation before that synchronous emission when a loaded runner preempts the subscribing thread. The test now constructs its middleware with a wide schedule interval (250ms/750ms) so the terminal-only assumption stays safe under -T1C contention.
  • SubagentPendingToolRecoveryTest (rebuiltChildRespectsRecoveryAfterPersistedActingFailure, this PR's own CI run): hit Timeout on blocking read for 10000000000 NANOSECONDS with SQLite -journal file-lock symptoms in the logs. One child call serializes ~30 journal commits (connection-per-op, DELETE journal, synchronous=EXTRA), and Windows CI parallel builds plus real-time AV scans of fresh -journal files can stall those fsyncs past the old 10s budget — the same budget as SQLite's own busy timeout, with no headroom. Raised to 30s, keeping the guards intact.

…TransportTest

agent-protocol: a paused HITL run persists the awaiting_confirm record
before its future completes, and resume() rejected calls landing in that
window with "task is already running" (HTTP 409). The persisted record is
now the authoritative pause signal: resume() re-validates it under a
per-task lock (concurrent double-resume is still rejected), and the
in-memory future check is removed. futures.remove(taskId, f) in
submit/resume keeps a late-unwinding run from removing a newer run's
future. Adds a deterministic regression test that pins the window with a
latch; it fails on the old code with the exact CI stack trace.

core: JdkHttpTransportTest self-imposed 2s read/response deadlines were
punched through by Windows CI parallel builds (mvn -T1C): 3/52 tests
timed out during connect/first signal. setUp deadlines are relaxed to
10s read/response and 15s connect (idle stays 1s); the two tests that
assert timeout behavior now build their own 2s-deadline transports
(existing pattern) so the guards keep their strength; 8 status-code
assertions become null-safe so a timeout reports the real error instead
of an NPE.
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...tensions/agentprotocol/AgentProtocolTaskStore.java 86.36% 1 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

…g tests

- ChatSessionsTest: extend await timeouts to 60s; two durable turns with
  streamed output can exceed 15s on Windows runners
- JevSupervisionMiddlewareTest: widen the supervision schedule interval so
  a preempted subscribing thread cannot emit a superseded mid-run
  observation before the synchronous terminal assessment
- SubagentPendingToolRecoveryTest: bump timeout 10s -> 30s; ~30 SQLite
  journal fsyncs per child call can stall past 10s under CI parallel
  builds and real-time AV scans
- WorkspaceTaskRepositoryRemoteStreamingTest: await the completion callback
  instead of asserting it already ran in the persistence gap
@xzxiaoshan xzxiaoshan changed the title fix: accept HITL resume while the paused run unwinds; deflake JdkHttpTransportTest fix: accept HITL resume while the paused run unwinds; deflake flaky Windows CI tests Oct 16, 2026

@jujn jujn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jujn
jujn merged commit 5ae9f60 into agentscope-ai:main Oct 16, 2026
6 checks passed
@xzxiaoshan
xzxiaoshan deleted the fix/pr3593-ci-failures branch October 16, 2026 07:36
xzxiaoshan added a commit that referenced this pull request Oct 16, 2026
…oken presence (#3610)

Follow-up to #3608, covering the remaining failures from the parallel
-T1C CI batch. No timeout values were changed — both fixes remove
failure mechanisms rather than budgeting more time for them.

**JevTraceManagedAgentTest block timeout** (job 115705826734): the
default workspace journal is one SQLite file written per event with full
sync, connection-per-op, busy timeout 10 s — equal to the test's entire
block budget, i.e. zero headroom by construction. Under -T1C on Windows
runners, per-commit fsyncs plus AV scans of the fresh -journal files can
stall a run past 10 s; this is the same mechanism documented for
SubagentPendingToolRecoveryTest in #3602. The test validates JEV
middleware wiring on an all-stub pipeline (mocked JevClient, Flux.just
model, Mono.just sources) and never reopens state from disk, so an
InMemorySessionLogStore removes the IO mechanism outright — the pattern
applied to SharedWorkspaceSkillStagingE2ETest in #3519.

**Codecov upload failing the build** (job 114655326210): fork PRs cannot
see CODECOV_TOKEN, and Codecov rejects tokenless uploads to a protected
branch with HTTP 400, which failed the whole job. The step is now
skipped when the token is absent, and fail_ci_if_error is off so
codecov-side outages never mask the build result.
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