WIP: 实现画布 Agent 停止请求 #108

Closed
k88936 wants to merge 11 commits from editor-agent-abortable into master
Member

简单地使用http请求中断实现

简单地使用http请求中断实现
k88936 added 4 commits 2026-04-16 02:41:25 +08:00
Merge branch 'master' into editor-agent-abortable
Project CI / Repository checks (pull_request) Successful in 1m11s
Project CI / Frontend tests (pull_request) Successful in 2m7s
Project CI / Native shell tests (pull_request) Successful in 2m19s
Project CI / Backend tests (pull_request) Successful in 3m9s
0c077a876e
# Conflicts:
#	docs/project-memory/shared-memory/decision-log.md
k88936 added 3 commits 2026-07-22 17:40:33 +08:00
为每轮消息请求注入 AbortController 并停止当前 HTTP 请求

停止后在 isAborting 生命周期内静默刷新并阻止重复发送

补充 AbortError、客户端 signal 与面板状态回归测试
验证客户端断开会 drop Axum handler 并释放会话锁

验证 Pingora 将下游断开传播到 api-server 上游
记录画布 Agent HTTP 停止方案
Project CI / Repository checks (pull_request) Failing after 1m39s
Project CI / Native shell tests (pull_request) Failing after 1m26s
Project CI / Frontend tests (pull_request) Failing after 5m53s
Project CI / Backend tests (pull_request) Failing after 3h0m1s
9bae10c397
同步普通规划停止、消息保留和会话锁释放边界

记录 isAborting 覆盖静默会话重读的最终交互
k88936 added 1 commit 2026-07-22 18:09:40 +08:00
Merge branch 'master' into editor-agent-abortable
Project CI / Repository checks (pull_request) Failing after 35s
Project CI / Frontend tests (pull_request) Successful in 27s
Project CI / Backend tests (pull_request) Successful in 3m24s
Project CI / Native shell tests (pull_request) Successful in 2m14s
6186166229
# Conflicts:
#	docs/【编辑器】画布Agent对话面板-2026-07-03.md
#	src/components/image-editor/EditorAgentConversation/EditorAgentConversationPanelView.test.tsx
k88936 added 1 commit 2026-07-22 19:07:40 +08:00
fix format
Project CI / Backend tests (pull_request) Failing after 9s
Project CI / Repository checks (pull_request) Failing after 10s
Project CI / Frontend tests (pull_request) Successful in 29s
Project CI / Native shell tests (pull_request) Successful in 3m19s
9b7a787dc5
k88936 added 1 commit 2026-07-22 19:09:25 +08:00
Merge branch 'master' into editor-agent-abortable
Project CI / Frontend tests (pull_request) Successful in 36s
Project CI / Repository checks (pull_request) Successful in 1m38s
Project CI / Backend tests (pull_request) Successful in 3m26s
Project CI / Native shell tests (pull_request) Successful in 2m58s
d05ac49d07
k88936 changed title from WIP: 实现画布 Agent 请求停止交互 to WIP: 实现画布 Agent 停止请求 2026-07-22 19:45:50 +08:00
k88936 marked the pull request as ready for review 2026-07-22 19:57:14 +08:00
k88936 requested review from kdletters 2026-07-22 19:57:20 +08:00
kdletters requested changes 2026-07-23 11:38:02 +08:00
kdletters left a comment
Member

[P1] 新项目首次发送时,创建会话完成前“停止”按钮是空操作,之后仍会继续发送规划请求。代码 (line 474)
[P1] 用户快速停止可能早于 OSS 消息写入;随后的 GET 会用旧历史覆盖 optimistic message,导致提示词静默消失。代码 (line 98)
[P1] 停止后的权威 GET 失败被吞掉,随后仍恢复发送,与“GET 成功后才恢复”的契约相反。代码 (line 525)
[P2] 切换项目或卸载组件只清空控制器引用,没有 abort 在途 POST,旧 LLM 请求和会话锁会成为 UI 无法停止的孤儿请求。代码 (line 191)

[P1] 新项目首次发送时,创建会话完成前“停止”按钮是空操作,之后仍会继续发送规划请求。[代码 (line 474)](/home/dsk/.codex/worktrees/f324/Genarrative/src/components/image-editor/EditorAgentConversation/useEditorAgentConversation.ts:474) [P1] 用户快速停止可能早于 OSS 消息写入;随后的 GET 会用旧历史覆盖 optimistic message,导致提示词静默消失。[代码 (line 98)](/home/dsk/.codex/worktrees/f324/Genarrative/server-rs/crates/api-server/src/editor_agent/api.rs:98) [P1] 停止后的权威 GET 失败被吞掉,随后仍恢复发送,与“GET 成功后才恢复”的契约相反。[代码 (line 525)](/home/dsk/.codex/worktrees/f324/Genarrative/src/components/image-editor/EditorAgentConversation/useEditorAgentConversation.ts:525) [P2] 切换项目或卸载组件只清空控制器引用,没有 abort 在途 POST,旧 LLM 请求和会话锁会成为 UI 无法停止的孤儿请求。[代码 (line 191)](/home/dsk/.codex/worktrees/f324/Genarrative/src/components/image-editor/EditorAgentConversation/useEditorAgentConversation.ts:191)
@@ -445,0 +476,4 @@
conversationId,
clientMessageId,
controller,
};
Member

新项目首次发送时,创建会话完成前“停止”按钮是空操作,之后仍会继续发送规划请求。

新项目首次发送时,创建会话完成前“停止”按钮是空操作,之后仍会继续发送规划请求。
k88936 marked this conversation as resolved
kdletters reviewed 2026-07-23 11:43:06 +08:00
@@ -177,6 +188,8 @@ export function useEditorAgentConversation({
pendingSendRequestIdRef.current += 1;
createConversationRequestIdRef.current += 1;
isWaitingRef.current = false;
activeSendRef.current = null;
Member

切换项目或卸载组件只清空控制器引用,没有 abort 在途 POST,旧 LLM 请求和会话锁会成为 UI 无法停止的孤儿请求。

切换项目或卸载组件只清空控制器引用,没有 abort 在途 POST,旧 LLM 请求和会话锁会成为 UI 无法停止的孤儿请求。
Author
Member

我觉得用户刷新/重进后,没完成的规划应该继续在后台跑完,,,,,,用户换过去换回来他好像不着急中断llm规划,,,,

我觉得用户刷新/重进后,没完成的规划应该继续在后台跑完,,,,,,用户换过去换回来他好像不着急中断llm规划,,,,
Member

你这边 activeSendRef.current = null;是直接丢弃了引用,再切回来也无法找回,所以切换对话之后这个对话就无法中止了

你这边 `activeSendRef.current = null;`是直接丢弃了引用,再切回来也无法找回,所以切换对话之后这个对话就无法中止了
@@ -483,0 +522,4 @@
conversationId &&
activeConversationIdRef.current === conversationId
) {
await loadConversation(conversationId, {
Member

停止后的权威 GET 失败被吞掉,随后仍恢复发送,与“GET 成功后才恢复”的契约相反

停止后的权威 GET 失败被吞掉,随后仍恢复发送,与“GET 成功后才恢复”的契约相反
k88936 marked this conversation as resolved
k88936 marked the pull request as work in progress 2026-07-24 15:27:53 +08:00
kdletters added this to the 美术Agent project 2026-07-24 20:17:45 +08:00
k88936 added 1 commit 2026-07-28 16:13:49 +08:00
Merge remote-tracking branch 'origin/master' into editor-agent-abortable
Project CI / Repository checks (pull_request) Failing after 26s
Project CI / Frontend tests (pull_request) Failing after 48s
Project CI / Native shell tests (pull_request) Successful in 2m46s
Project CI / Backend tests (pull_request) Successful in 3m21s
ee4c9668be
# Conflicts:
#	docs/project-memory/shared-memory/decision-log.md
#	docs/【编辑器】画布Agent对话面板-2026-07-03.md
#	server-rs/crates/api-server/src/editor_agent/api.rs
#	src/components/image-editor/EditorAgentConversation/EditorAgentConversationPanelView.test.tsx
#	src/components/image-editor/EditorAgentConversation/EditorAgentConversationPanelView.tsx
#	src/components/image-editor/EditorAgentConversation/useEditorAgentConversation.test.tsx
Author
Member

低优先级

低优先级
k88936 closed this pull request 2026-08-04 12:21:21 +08:00
Some checks are pending
Project CI / Repository checks (pull_request) Failing after 26s
Project CI / Frontend tests (pull_request) Failing after 48s
Project CI / Native shell tests (pull_request) Successful in 2m46s
Project CI / Backend tests (pull_request) Successful in 3m21s

Pull request closed

Sign in to join this conversation.