Skip to content

fix(harness): restore builder state after failed build - #3811

Merged
jujn merged 2 commits into
agentscope-ai:mainfrom
wahllllll:fix/issue-3719-failed-build-pollutes-shared-builder
Oct 30, 2026
Merged

jujn merged 2 commits into
agentscope-ai:mainfrom
wahllllll:fix/issue-3719-failed-build-pollutes-shared-builder

Conversation

@wahllllll

Copy link
Copy Markdown
Contributor

Summary

  • Restore the lazily auto-wired stateStoreOverride when HarnessAgent.Builder.build() fails.
  • Preserve the existing successful-build behavior: a resolved state store remains available to dynamic subagent factories.
  • Add regression tests for restoring the field after failure and reusing the same builder after replacing the invalid distributed store.
  • Document the failed-build reuse guarantee on Builder.build().

This addresses the remaining failure-path contamination described in #3719. The concurrent ConcurrentModificationException described against v2.0.4 is already avoided on main by the synchronized Harness builder and ReActAgent.Builder.copy(); this PR covers the case where auto-wiring mutates the shared Harness builder before a later validation failure.

Verification

  • mvn -B -pl agentscope-harness -am -Dtest='HarnessBuilderReuseTest,HarnessAgentDistributedSandboxTest' -DfailIfNoTests=false test: 11 tests passed.
  • mvn -B -pl agentscope-harness clean test: 1403 tests passed, 0 failures, 0 errors, 32 skipped.
  • git diff --check: clean.

The two Windows symlink cases in DangerousPathBypassTest require privileges unavailable in the local environment; they also fail on unmodified main and are unrelated to this change.

@wahllllll

Copy link
Copy Markdown
Contributor Author

CI update: Ubuntu passed, License and Module Sync passed. The Windows job failed only in the unrelated agentscope-chat example suite: ChatSessionsTest.interruptThenResumeKeepsInputAndTurnAndSeparatesExecutionIds timed out while the turn remained running (the changed agentscope-harness tests were not the failing module). The latest successful main Java CI run (40476755655, commit 19fdc9e6) provides the baseline that the repository's Windows build is generally healthy, but this failure is an existing/flaky chat test rather than a failure in this PR. I cannot rerun the workflow with the current repository permissions.

@jujn
jujn merged commit 804a555 into agentscope-ai:main Oct 30, 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