Repository navigation
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
…the stream emitted `ProcessRecoveryTest` polls `backend.turn(...)` while calling `replacement.tick`, and the runtime interrupts whoever ticks to deliver a wakeup. The fixture loop in the same file already cleared the interrupt flag; the two polling loops in the test body did not, so `Thread.sleep` threw `InterruptedException` and failed the run even though nothing was wrong. That is the failure seen on agentscope-ai#4102 and on main: ProcessRecoveryTest.replacementCollectsOriginalResultWithoutRepeatingEffect java.lang.InterruptedException: sleep interrupted Route all three sleeps through one `pause` helper that clears the flag. The loops still exit on their deadline, and the terminal `SUCCEEDED` assertion is unchanged, so a genuine stall still fails. `AgentScopeAgentExecutorInputRequiredTest.stream` failed with "the stream ended without reaching TASK_STATE_FAILED", which says nothing about what the stream did emit before ending. Record the events and put them in the message. The A2A change is diagnostics only. It did not reproduce locally (30 repetitions, 30 passes), so its root cause is still open and no production code is touched.
…ssages, and ignore wakeups Two test-harness defects, both seen on CI. RocketMQ: `Broker.consumer` re-offers a message 50ms after handing it out unless it was acked, without knowing whether the consumer is still working on it. When the ack lands after the window the message is delivered twice, which is what failed this PR's ubuntu build: authorizationPrecedesAdmissionAndCancellationTombstoneSurvivesLateExecute:604 expected: <1> but was: <2> A single CANCEL produced two acks. Narrowing the window to 1ms reproduces it locally, together with the recovery flake: expected: <1> but was: <2> turn.status=WAITING, modelCalls=1, commandAcks=10, eventAcks=17, queuedEvents=2 A real invisible duration is measured in seconds; these tests only need redelivery to happen inside their 10s waits. Name the window, raise it to one second, and record the constraint next to it. ProcessRecovery: the test polls `backend.turn(...)` while ticking, and the runtime interrupts the ticking thread to deliver a wakeup, so `Thread.sleep` threw `InterruptedException` and failed a run in which nothing was wrong (agentscope-ai#4102, and main). The fixture loop in the same file already cleared the flag; route all three sleeps through one `pause` helper instead. The deadlines and the terminal assertion are untouched, so a real stall still fails.
…ssages, and ignore wakeups Two test-harness defects, both seen on CI. RocketMQ: `Broker.consumer` re-offers a message 50ms after handing it out unless it was acked, without knowing whether the consumer is still working on it. When the ack lands after the window the message is delivered twice, which is what failed this PR's ubuntu build: authorizationPrecedesAdmissionAndCancellationTombstoneSurvivesLateExecute:604 expected: <1> but was: <2> A single CANCEL produced two acks. Narrowing the window to 1ms reproduces it locally, together with the recovery flake: expected: <1> but was: <2> turn.status=WAITING, modelCalls=1, commandAcks=10, eventAcks=17, queuedEvents=2 A real invisible duration is measured in seconds; these tests only need redelivery to happen inside their 10s waits. Name the window, raise it to one second, and record the constraint next to it. ProcessRecovery: the test polls `backend.turn(...)` while ticking, and the runtime interrupts the ticking thread to deliver a wakeup, so `Thread.sleep` threw `InterruptedException` and failed a run in which nothing was wrong (agentscope-ai#4102, and main). The fixture loop in the same file already cleared the flag; route all three sleeps through one `pause` helper instead. The deadlines and the terminal assertion are untouched, so a real stall still fails.
…ssages, and ignore wakeups Two test-harness defects, both seen on CI. RocketMQ: `Broker.consumer` re-offers a message 50ms after handing it out unless it was acked, without knowing whether the consumer is still working on it. When the ack lands after the window the message is delivered twice, which is what failed this PR's ubuntu build: authorizationPrecedesAdmissionAndCancellationTombstoneSurvivesLateExecute:604 expected: <1> but was: <2> A single CANCEL produced two acks. Narrowing the window to 1ms reproduces it locally, together with the recovery flake: expected: <1> but was: <2> turn.status=WAITING, modelCalls=1, commandAcks=10, eventAcks=17, queuedEvents=2 A real invisible duration is measured in seconds; these tests only need redelivery to happen inside their 10s waits. Name the window, raise it to one second, and record the constraint next to it. ProcessRecovery: the test polls `backend.turn(...)` while ticking, and the runtime interrupts the ticking thread to deliver a wakeup, so `Thread.sleep` threw `InterruptedException` and failed a run in which nothing was wrong (agentscope-ai#4102, and main). The fixture loop in the same file already cleared the flag; route all three sleeps through one `pause` helper instead. The deadlines and the terminal assertion are untouched, so a real stall still fails.
…ssages, and ignore wakeups Two test-harness defects, both seen on CI. RocketMQ: `Broker.consumer` re-offers a message 50ms after handing it out unless it was acked, without knowing whether the consumer is still working on it. When the ack lands after the window the message is delivered twice, which is what failed this PR's ubuntu build: authorizationPrecedesAdmissionAndCancellationTombstoneSurvivesLateExecute:604 expected: <1> but was: <2> A single CANCEL produced two acks. Narrowing the window to 1ms reproduces it locally, together with the recovery flake: expected: <1> but was: <2> turn.status=WAITING, modelCalls=1, commandAcks=10, eventAcks=17, queuedEvents=2 A real invisible duration is measured in seconds; these tests only need redelivery to happen inside their 10s waits. Name the window, raise it to one second, and record the constraint next to it. ProcessRecovery: the test polls `backend.turn(...)` while ticking, and the runtime interrupts the ticking thread to deliver a wakeup, so `Thread.sleep` threw `InterruptedException` and failed a run in which nothing was wrong (agentscope-ai#4102, and main). The fixture loop in the same file already cleared the flag; route all three sleeps through one `pause` helper instead. The deadlines and the terminal assertion are untouched, so a real stall still fails.
…ssages, and ignore wakeups Two test-harness defects, both seen on CI. RocketMQ: `Broker.consumer` re-offers a message 50ms after handing it out unless it was acked, without knowing whether the consumer is still working on it. When the ack lands after the window the message is delivered twice, which is what failed this PR's ubuntu build: authorizationPrecedesAdmissionAndCancellationTombstoneSurvivesLateExecute:604 expected: <1> but was: <2> A single CANCEL produced two acks. Narrowing the window to 1ms reproduces it locally, together with the recovery flake: expected: <1> but was: <2> turn.status=WAITING, modelCalls=1, commandAcks=10, eventAcks=17, queuedEvents=2 A real invisible duration is measured in seconds; these tests only need redelivery to happen inside their 10s waits. Name the window, raise it to one second, and record the constraint next to it. ProcessRecovery: the test polls `backend.turn(...)` while ticking, and the runtime interrupts the ticking thread to deliver a wakeup, so `Thread.sleep` threw `InterruptedException` and failed a run in which nothing was wrong (agentscope-ai#4102, and main). The fixture loop in the same file already cleared the flag; route all three sleeps through one `pause` helper instead. The deadlines and the terminal assertion are untouched, so a real stall still fails.
|
后台子 Agent 失败时,父 Agent 应该明确收到
本地 Harness 相关的 50 项测试通过。 |
…ions The message-bus completion callback pushed the same "has completed ... Result: (no output)" inbox hint for FAILED tasks as for delivered results, so the parent model treated execution failures (e.g. model retries exhausted) as empty business results and closed the loop instead of retrying or escalating. The callback now carries the terminal TaskStatus plus the failure message, and the hint wording mirrors the task-delivery reminder's <task_error> semantics.
Changing TaskCompletionCallback.onCompleted to seven parameters broke existing lambdas, custom repositories and precompiled callers, and left ControlPlaneTaskRepository uncompilable. Restore the original method and carry terminal status and errors through an additive default onSettled; TaskSettledCallback lets the built-in message-bus wiring consume them through the unchanged setCompletionCallback. Built-in repositories, including the control-plane one, call onSettled explicitly, so empty successes stay completions. Tests now cover both bridge directions (including callers compiled against the old interface), both repository backends and every message-bus wiring path.
Per maintainer feedback on agentscope-ai#4102, notifications to the parent agent now carry a short, sanitized error summary: the raw exception message is reduced to its first line and truncated, since stack traces and long internal dumps can leak paths, endpoints, or credentials into the conversation prompt. The full message stays in the durable task record, reachable via task_output/task_list. Applies the same cap to the aggregated <task_error> blocks in the delivery reminder, and documents the new behavior in both the v2 and dev docs sets.
98eafc3 to
86229e5
Compare
|
感谢详细意见,两点都已处理,分支已重构为基于 1. 拆分 PR
2. 错误摘要脱敏
另说明一下 merge base:当前 main 顶端 |
juruoO-o
left a comment
There was a problem hiding this comment.
复审了 05b3222。A2A 和 Durable 的改动已拆出,原有五参数回调接口也已保留。合入前请再处理两个已复现的问题。
- [P1] 用户取消任务后,父 Agent 会收到 FAILED 通知。 在 WorkspaceTaskRepository 中注册状态回调,传入尚未完成的 AdoptedTaskRunSpec,再调用 cancelTask(),持久化记录为 CANCELLED,但同一任务的回调收到 FAILED。取消 Future 会进入 whenComplete 的异常分支;updateStatus 的终态保护保住了 CANCELLED,随后 fireCompletionCallback 仍传出 FAILED,可能让父 Agent 重试用户刚取消的任务。请让通知与实际持久化的终态一致,并覆盖这条取消路径。
- [P1] 异常首行仍会原样进入父 Agent 会话。 用包含虚构凭据的单行异常调用 taskSettledHintContent,生成的通知完整保留了该凭据。sanitizeErrorSummary 只去掉后续行并限制长度。建议自动通知使用任务 ID、失败状态和固定错误类别,详细异常沿用 task_output 查询;请同时覆盖 inbox hint 和任务投递 reminder。
Ubuntu、Windows 和本地构建均在 SubagentTaskSettledHintTest.java 第 116 行的 Spotless 检查失败,请一并修正断言换行。跳过该格式检查后,本地 61 项相关测试通过;另用两个独立用例复现了上述问题。
Review follow-up on agentscope-ai#4102, fixing two reproduced issues: 1. Cancelled tasks must not announce FAILED. updateStatus now returns the status actually persisted, and every settlement goes through settleAndNotify, which fires the callback with that effective status. Cancelling an adopted future (or a local supplier failing after cancellation) enters the exception branch, but the record — and now the notification — stays CANCELLED, so the parent agent no longer risks retrying a task the user just cancelled. Settled hints gained a CANCELLED wording. Covered by tests for the adopted+cancelTask path and the local post-cancel failure path. 2. Automatic notifications no longer embed any part of the exception message: the first line of a single-line error still leaked verbatim. Hints and <task_error> blocks now carry only the task id, the terminal status, and a fixed error category; the raw error remains in the durable task record, reachable via task_output. The truncating sanitizer is removed along with its length cap. Also fixes the Spotless violations in the settled-hint tests.
|
感谢复现和详细反馈,两个 P1 问题与 Spotless 格式问题都已在 8fd1786 处理: 1. 取消的任务误报 FAILED(P1)
2. 单行异常原文仍进入会话(P1)
3. Spotless
本地验证: |
juruoO-o
left a comment
There was a problem hiding this comment.
感谢补齐修复。复审时确认,取消任务误报 FAILED、自动通知带出原始异常和 Spotless 失败均已解决。本地 61 项定向测试通过。
[P1] 终态写入失败后仍会发出完成通知。 我在独立测试中让工作区终态写入抛异常,回调仍收到 COMPLETED,重新读取的任务记录却仍是 RUNNING。persistRecord 捕获写入异常后,updateStatus 仍返回拟写入的状态,settleAndNotify 据此发送通知。请根据实际写入结果决定是否发送终态通知,并覆盖终态落盘失败的用例。
另外,中英文 docs/v2 的新增段落引用了 TaskSettledCallback,而文档对应的 v2.0.4 没有这个接口。中英文开发版文档已有相同说明,请移除稳定版的新增段落。
updateStatus now reads the record back after writing: WorkspaceManager swallows storage failures, so a normal return from the write says nothing about what the task exposes afterwards. The settlement callback therefore never announces a terminal status that is not on record. A completed result exists only in memory, so it is handed over with the on-record status instead of being dropped (agentscope-ai#4399 requires the result to survive a failed record write); an unrecorded failure or cancellation has nothing to deliver and is not announced.
|
感谢复现,两点都已在 fffe6fe 处理,同时合入了最新 main( 1. [P1] 终态写入失败后仍发出完成通知
2. docs/v2
测试
本地验证: |
AgentScope-Java Version
2.1.0-SNAPSHOT, merged with main at
31d320049.Description
Background
Failed background subagent tasks are correctly persisted as
FAILED, but their message-bus notification says "has completed" with "Result: (no output)" and omits the execution error.This gives the parent agent contradictory signals and can cause an execution failure to be treated as an empty business result. The dynamic subagent path relies on this notification for push delivery; the static path can additionally receive a contradictory
<task_error>reminder.Changes
TaskCompletionCallback.onCompletedmethod and add a defaultonSettledmethod carrying status and error details.TaskSettledCallback, registered through the unchangedsetCompletionCallbackmethod.FAILEDand distinguish execution failures from business conclusions.<task_error>blocks in the delivery reminder. The full message stays in the durable task record, reachable viatask_output/task_list.cancelTask()), the record — and therefore the notification — staysCANCELLED, so the parent agent no longer risks retrying a task the user just cancelled. Settled-task hints gained aCANCELLEDwording.updateStatusreads the record back after writing, becauseWorkspaceManager.writeTaskRecordlogs and swallows storage failures instead of throwing. When the terminal write does not land, no terminal status is announced: the result of a completed task exists only in memory and is handed over with a notice that it is not on record (main's fix(harness): harden context management and recovery #4399 requires the result to survive a failed record write), while an unrecorded failure or cancellation is not announced. The stabledocs/v2additions were removed.Task-record formats, durable delivery, model routing, and retry behavior are unchanged.
Compatibility
The change preserves source and binary compatibility with the original five-argument API, including existing lambdas, custom repositories, and precompiled callers.
Tests compile legacy consumers against the original interface and verify both callback bridge directions. The original abstract method descriptor also matches the released 2.0.4 API.
Legacy repositories may continue calling
onCompleted; they retain the existing null-result failure convention but cannot provide error details. Repositories should callonSettledto supply explicit status and errors.Scope
Per maintainer feedback, the durable-runtime late-heartbeat fix and the a2a early task-release fix that were previously part of this PR have been split into #4302 and #4303 for separate review. This PR now contains only the Harness failure-notification changes.
Addresses the FAILED-notification portion of #2159. Related to #2187; thanks to @BG0527 for identifying and addressing this problem.
How to test
Run the focused regression tests:
mvn -pl agentscope-harness -am test \ -Dtest=SubagentTaskSettledHintTest,SubagentDeliveryTest,WorkspaceTaskRepositoryTest,WorkspaceTaskRepositoryRemoteStreamingTest \ -Dsurefire.failIfNoSpecifiedTests=falseCoverage includes: legacy source and binary compatibility and both callback bridges; success, failure, empty success, and callback suppression; adopted futures and workspace remote failures; cancelled settlements (adopted +
cancelTask, and local post-cancel failure); notifications never leaking raw error content; terminal writes that throw or silently fail, for both completed and failed tasks, at the repository and message-bus wiring levels.Note on the merged upstream test
SubagentDeliveryTest.deliveryPreservesLargeResultsAndErrorsWithTaskOutputAvailablewas added by #4399 and asserted that the delivery reminder carries the raw error text. That contradicts the review request to keep raw exceptions out of the conversation, so the case is nowdeliveryPreservesLargeResultsAndDefersErrorsToTaskOutput: large results are still delivered in full, errors are left totask_output.