Repository navigation
Conversation
bobbai00
left a comment
There was a problem hiding this comment.
LGTM overall, left a few minor comments.
Addresses review on apache#9864: - Pass the run's abort signal to the first turn's workflow refresh and re-check it after the refresh, so a stop or delete during the refresh ends the turn before any model call. - Forward the abort signal to compileWorkflowAsync. - A destroyed flag guards post-destroy writes: addStep, recordResult and the refresh write nothing, and tool calls from the step that raced the destroy are skipped. - destroy() also clears the cached operator results. - Add a WebSocket test that deletes an agent mid-run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses review on apache#9864: - Pass the run's abort signal to the first turn's workflow refresh and re-check it after the refresh, so a stop or delete during the refresh ends the turn before any model call. - Forward the abort signal to compileWorkflowAsync. - A destroyed flag guards post-destroy writes: addStep, recordResult and the refresh write nothing, and tool calls from the step that raced the destroy are skipped. - destroy() also clears the cached operator results. - Add a WebSocket test that deletes an agent mid-run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9dd7614 to
8df2410
Compare
mengw15
left a comment
There was a problem hiding this comment.
Under the current definition in CONTRIBUTING.md, this may not qualify for v1.3, since deleting an agent mid-run has never stopped its run. #9862 may move us to defining a fix by intended behavior. As the v1.3 release manager, I've decided to backport it.
@sshiv012 once this merges into main, CI will open a backport PR to release/v1.3. The patch conflicts on that branch, so that PR will open as a draft and need some changes.
|
I'll add the release/v1.2 label and let the GitHub Action open the backport PR. This is not urgent for v1.2, as it does not affect execution results. After an agent is deleted, the run continues until it finishes or reaches its step limit. Users can also stop the run before deleting the agent. Since the patch does not apply cleanly to the v1.2 branch, the backport PR will require some manual work. I think a minimal fix would be sufficient: the change in destroy(), the abort signal on the two API helpers, and a test to verify that no further model calls are made after deletion. The destroyed guards can be limited to the fields available in v1.2. @sshiv012 , it would be great if you could help resolve the backport conflicts when you have time. Thanks! |
Automated Reviewer SuggestionsBased on the
|
TexeraAgent.destroy() now calls stop(), so deleting an agent mid-run aborts the run's AbortController: the ReAct loop makes no further model calls and an in-flight operator execution request is cancelled. It also drops the step callback, so steps recorded while the run winds down reach no one. Closes apache#9863 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SRmgtAUqHYqXFnu7gX8qXE
Addresses review on apache#9864: - Pass the run's abort signal to the first turn's workflow refresh and re-check it after the refresh, so a stop or delete during the refresh ends the turn before any model call. - Forward the abort signal to compileWorkflowAsync. - A destroyed flag guards post-destroy writes: addStep, recordResult and the refresh write nothing, and tool calls from the step that raced the destroy are skipped. - destroy() also clears the cached operator results. - Add a WebSocket test that deletes an agent mid-run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8df2410 to
769b53c
Compare
What changes were proposed in this PR?
Deleting an agent mid-run now ends its run.
TexeraAgent.destroy()callsstop()first, so the run'sAbortControlleraborts. It also drops the step callback, so steps recorded while the run winds down reach no subscriber.destroy()(unchanged)Stale sockets get nothing:
broadcastToAgentClientsreturns early once the agent is gone from the store, anddestroy()clears the client set.Out of scope, possible follow-up: telling sockets still open on a deleted agent that it was deleted (for example a final event and close). Today they receive no further events.
Any related issues, documentation, discussions?
Closes #9863. Part of #9576 ("closing or deleting an agent ends its work"). Discussion: #9568.
How was this PR tested?
New tests in
agent-service/src/agent/texera-agent.spec.ts, each red before the fix:destroy()mid-run: the model call's abort signal fires, only one model call is made, the run ends as stopped, and no step after the destroy reaches the step callback.destroy()while an operator executes: the execution request, which hangs until its signal aborts, is cancelled and the run ends as stopped.destroy()on an idle agent leaves it available.Manually on the local dev stack: started a multi-step prompt over the agent WebSocket, then deleted the agent mid-run. With the fix the agent-service log shows
agent run completewithsteps=0about 2 s after the prompt. Before it, the run went on for 10 to 20 s after the delete.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)
🤖 Generated with Claude Code
https://claude.ai/code/session_01SRmgtAUqHYqXFnu7gX8qXE