Skip to content

test(harness): keep session journal out of shared-workspace skill staging E2E - #3519

Merged
jujn merged 1 commit into
agentscope-ai:mainfrom
guslegend0510:fix/issue-3514-shared-workspace-e2e-windows-flaky
Oct 13, 2026
Merged

jujn merged 1 commit into
agentscope-ai:mainfrom
guslegend0510:fix/issue-3514-shared-workspace-e2e-windows-flaky

Conversation

@guslegend0510

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT

Description

Fixes #3514

SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete is flaky on windows-latest. Both symptoms in the issue come from the durable session journal that every HarnessAgent call has written since #3441, not from skill staging.

Why Windows only. LocalSessionStorage uses SqliteSessionStorage on Windows: one journal.sqlite3 per workspace root, a new JDBC connection per operation, synchronous=EXTRA and a rollback journal. Both agents in this test share one workspace, so their journal writes serialize on one database file. With the Windows storage backend plugged in on macOS, each call did 41 journal reads and 18 CAS writes, so the test's 100 calls do about 5,900 journal operations, 1,800 of them fully synced writes.

Symptom B (120 s timeout). That I/O alone brings the run close to the budget on a slow runner. The run in the issue that did finish took 86.7 s.

Symptom A (Async resource cleanup failed after onComplete). The message comes from Reactor's usingWhen: it wraps an error raised by the async-complete callback. Here that callback is AgentBase.runLifecycleBody → ReActAgent.releaseCallExecution → SessionRecorder.finish(), which flushes the journal and releases the writer. Injecting a single SessionLogException on the writer-release CAS reproduces the exact toString() from the CI log, with Caused by: SessionLogException: Journal CAS failed. Which SQLite error happened on CI cannot be told from the log, because the test only printed Throwable.toString().

Changes (test only):

  • Give both agents an InMemorySessionLogStore. The test is about skill staging (middleware → MarketplaceStager → disk), which happens before the first model call and does not depend on the journal. Assertions, the 50 rounds per agent and the 120 s timeout are unchanged. Other Harness tests already use InMemorySessionLogStore the same way.
  • Print full stack traces when calls fail, so a future failure shows its cause in the CI log.

No production code is changed. Making SqliteSessionStorage cheaper on Windows (connection reuse, one-time schema setup) could be worth a separate issue, but it is a behavior change that needs Windows measurements, so it is not mixed into this PR.

How to test

  • mvn -B -T1 -pl agentscope-harness -am clean verify (macOS): core 2604, AG-UI 548, harness 1223 tests, 0 failures.
  • The target class run 5 more times on its own: all passed; the concurrent method takes about 0.7–0.9 s, down from about 16 s before the change on the same machine.
  • Not run on Windows locally; the build (windows-latest) lane of this PR is the Windows check.

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete
is flaky on windows-latest (agentscope-ai#3514). Since agentscope-ai#3441 every HarnessAgent call
writes a durable session journal into the workspace. On Windows that
journal is one SQLite file per workspace root, opened per operation with
synchronous=EXTRA and a rollback journal. The test's 100 calls perform
about 5,900 journal operations (41 reads + 18 CAS writes per call), and
the writes from both agents serialize on the shared database file.

- Symptom B (120 s timeout): the journal I/O alone brings the run close
  to the budget on a slow runner.
- Symptom A ("Async resource cleanup failed after onComplete"): Reactor's
  usingWhen wraps an error from the post-completion release step, i.e.
  SessionRecorder.finish() failing one journal write. Injecting a single
  SessionLogException on the release CAS reproduces the exact message.

The test is about skill staging, which happens before the first model
call and does not touch the journal, so give both agents an
InMemorySessionLogStore. Assertions, rounds and the timeout are
unchanged. Also print full stack traces when calls fail, so the cause is
visible in CI logs instead of only Throwable.toString().
@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@wahllllll wahllllll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed this carefully since it closes #3514, which I filed. Three things I checked independently, and all three hold.

The Reactor attribution is exactly right — and it answers the open question in that issue. When I filed #3514 I searched the whole tree for Async resource cleanup failed after onComplete, found nothing, and could only say it "most likely originates from a dependency". It is in reactor-core: unpacking 3.8.2 (the version dependency:tree resolves for agentscope-harness) and scanning the class constant pools, reactor/core/publisher/FluxUsingWhen$CommitInner.class contains that exact string, with ...after onError in $RollbackInner and ...after cancel in $CancelInner. So symptom A is indeed usingWhen wrapping an error raised by the async-complete callback, precisely as you describe. Thanks for pinning that down — it resolves the loose end I left in the issue.

The journal really is the dominant cost — measured, not just asserted. Same machine (Windows 11, JDK 17), running only this class:

main   (default WorkspaceSessionLogStore)   Tests run: 3   Time elapsed: 28.63 s
branch (InMemorySessionLogStore)            Tests run: 3   Time elapsed:  6.76 s

4.2x. On this machine 28.6 s is still inside the 120 s budget, so I did not reproduce the failure locally — the measurement supports the mechanism, not the failure itself. On a slower or contended runner that same multiplier is what pushes it over.

The scope is exactly right, though it reads as narrower than it is. The store is applied in the agent(...) helper, which only concurrentAgentsSharingWorkspaceBothComplete uses. The other two methods call middleware.onSystemPrompt(...) directly and never build a HarnessAgent, so they never touch the journal — the 0.43 s / 0.03 s those two show in the CI log is consistent with that. Nothing is left uncovered.

Separately, swapping errors for stackTraces(errors) is a real improvement: printing only Throwable.toString() is exactly why the CI log for #3514 could not tell us which exception was thrown.

One non-blocking thought for later: any other harness test that drives agents against a shared @TempDir workspace will carry the same Windows journal cost. If this flake resurfaces elsewhere, the same treatment should apply there. And if your ~18 fully-synced CAS writes per call reproduce outside tests, the journal cost may be worth a look on its own — but that is clearly out of scope here, and I agree with keeping this PR test-only.

LGTM. CI is 6/6 green here, including build (windows-latest) — the lane this flake actually lives on.

@jujn

jujn commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Assign to @wahllllll (Review)

@jujn
jujn merged commit d048083 into agentscope-ai:main Oct 13, 2026
6 checks passed
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.

[Bug]: SharedWorkspaceSkillStagingE2ETest.concurrentAgentsSharingWorkspaceBothComplete is flaky on windows-latest

4 participants