Repository navigation
Conversation
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.
| if (prior != null && !prior.isDone()) { | ||
| return; | ||
| } | ||
| Object lock = taskLocks.computeIfAbsent(taskId, k -> new Object()); |
There was a problem hiding this comment.
这里把锁表的使用范围从 resume 扩大到了所有 submit,但没有对应的回收逻辑。每个普通任务结束后,taskId 和锁对象都会一直留在 taskLocks 中。
我在本地对照验证了不同 ID 的普通任务:全部完成且 Future、提交上下文都已清空后,基线锁表为 0,当前 PR 会没有被删除掉。长期运行的服务会因此按历史任务数量持续积累锁对象。
建议补上安全的回收机制或采用有界锁方案和对应的测试用例,谢谢
There was a problem hiding this comment.
Thanks for catching this. You're right: retaining one lock object per taskId would grow with completed task volume. I replaced the per-task map with 64 fixed lock stripes selected by taskId hash. Both submit and resume use the same stripe, so same-task transitions remain serialized; hash collisions can add contention between unrelated tasks but do not affect correctness.
I added a regression that completes 80 unique tasks and asserts lock storage stays within the stripe bound. On the original PR head it failed after the tasks completed; with this change the focused protocol-module suite passes (3 tests), including same-task serialization and independent-task submission. spotless:check and git diff --check pass. Updated head: 4fb3010. Please re-review.
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
juruoO-o
left a comment
There was a problem hiding this comment.
submit 的检查、PENDING 持久化与 future 注册在同一 task 条带锁下完成,并与 resume 共用同步边界,能够关闭同实例的重复提交窗口。固定条带限制锁存储量,实际执行保持异步;未引入分布式保证或持久化格式变化。已核对并发回归用例与文档中的单实例边界,未发现阻塞问题。本轮未重跑测试。
Backport the verified fix to the 2.0.x implementation and retain its existing public contracts where the upstream kernel differs. (cherry picked from commit 9d4f864) Backport-review-patch: 1ae54d35eb93893ae8f00e28d3cff6af54f3b4b6 Constraint: No AgentScope Service or SDK migration Confidence: high Not-tested: Whole-repository verification pending after lane integration
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