Repository navigation
fix(protocol): serialize concurrent task submissions - #3643
Open
pengmoubuaixuexi wants to merge 1 commit into
Open
pengmoubuaixuexi wants to merge 1 commit into
pengmoubuaixuexi wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
This branch has not been deployed
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.
AgentScope-Java Version
2.1.0-SNAPSHOT, based on main
c3959cea69c40e2c44fd2365dfbdeed4bc53e951.Description
Fixes #3642.
Two concurrent
submitcalls with the same task ID can both observe no running future and schedule an agent run, despite the documented idempotency contract. A persisted PENDING record does not prevent the second submission from passing the check before the first future is registered. This can duplicate model/tool execution and leave only one of the runs addressable by task ID.Use the existing per-task monitor (already used by
resume) around the submission checks, pending persistence and future registration. Actual agent execution remains asynchronous; different task IDs retain independent registration. Keep the existing identity-based future cleanup and terminal-task rejection behavior. Update the English and Chinese protocol guides to state the single-instance scope.The regression pauses the first PENDING save after it reaches a real temporary workspace repository. A second submission then either completes registration on the old code or blocks on the first thread's task monitor after the fix. The agent stream is held open until assertions finish. A separate different-ID case requires the second submission to finish before the first save is released, guarding against accidental global serialization. Completion and rejection of a completed ID are also checked.
Validation
Java 17.0.20.1, Maven 3.9.12, Windows, from the repository root:
one registration per logical task ==> expected: <1> but was: <2>); the different-ID control passes.git diff --checkpass.docs/,npm test: 13 pass;npm run validate: passes (430 pages, 584 redirects plus Mintlify build validation).npm run broken-links: exits 1 with 2,208 reported links in 326 files. Re-running with the original EN/ZH pages gives the same file/link entries; no new reports from this change.Scope: coordination within one
AgentProtocolTaskStore, not cross-replica exactly-once execution. This reuses the existing task-lock registry and its lifecycle; cancellation and persisted-task recovery semantics are unchanged. Full-repositoryclean verifyand real-model/HTTP integration tests were not run.AI assistance: investigation, implementation and test execution were performed with Codex. The final diff was checked against the reproduction and the validation above; this is not a claim of independent human review.
Checklist
mvn spotless:applymvn test) — all 35 protocol module tests pass; full-repository suite not run