-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(serve): expose Workflow tasks and controls #9546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9bab3c3
75f2975
80f94d6
bea0746
6febdb2
fdadec7
135bf45
4ab652a
e139338
3497d0d
32d8934
c25a5f9
2ac1f68
15847f9
e80f785
eeca4d7
f8506d3
b799ea6
3d6b3bc
f42b285
0b5d23c
6c79490
f119607
c58b3fd
2c2c232
4b441a9
8bdd956
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,7 @@ import { | |
| type ServeSessionContextStatus, | ||
| type ServeSessionLspStatus, | ||
| type ServeSessionTasksStatus, | ||
| type ServeSessionWorkflowTaskStatus, | ||
| type ServeWorkspaceMcpResourcesStatus, | ||
| type ServeWorkspaceMcpStatus, | ||
| type ServeWorkspaceMcpToolsStatus, | ||
|
|
@@ -10919,10 +10920,11 @@ export function createAcpSessionBridge(opts: BridgeOptions): AcpSessionBridge { | |
| ); | ||
| }, | ||
|
|
||
| async getSessionTasksStatus(sessionId) { | ||
| async getSessionTasksStatus(sessionId, opts) { | ||
| return requestSessionStatus<ServeSessionTasksStatus>( | ||
| sessionId, | ||
| SERVE_STATUS_EXT_METHODS.sessionTasks, | ||
| { includeWorkflows: opts?.includeWorkflows === true }, | ||
| ); | ||
| }, | ||
|
|
||
|
|
@@ -10937,14 +10939,31 @@ export function createAcpSessionBridge(opts: BridgeOptions): AcpSessionBridge { | |
| return requestSessionTranscriptPage(req); | ||
| }, | ||
|
|
||
| async cancelSessionTask(sessionId, taskId, taskKind) { | ||
| async cancelSessionTask(sessionId, taskId, taskKind, context) { | ||
| const entry = byId.get(sessionId); | ||
| if (!entry) throw new SessionNotFoundError(sessionId); | ||
| resolveTrustedClientId(entry, context?.clientId); | ||
| return requestSessionStatus<{ cancelled: boolean }>( | ||
| sessionId, | ||
| SERVE_CONTROL_EXT_METHODS.sessionTaskCancel, | ||
| { taskId, taskKind }, | ||
| ); | ||
| }, | ||
|
|
||
| async controlSessionWorkflowTask(sessionId, taskId, action, context) { | ||
| const entry = byId.get(sessionId); | ||
| if (!entry) throw new SessionNotFoundError(sessionId); | ||
| resolveTrustedClientId(entry, context?.clientId); | ||
| return requestSessionStatus<{ | ||
| changed: boolean; | ||
| status?: ServeSessionWorkflowTaskStatus['status']; | ||
| taskId?: string; | ||
| }>(sessionId, SERVE_CONTROL_EXT_METHODS.sessionWorkflowTaskAction, { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] R1-13: Still stands at 中文说明R1-13 在 — qwen3.8-max via Qwen Code /review (v0.22.0) |
||
| taskId, | ||
| action, | ||
| }); | ||
|
Comment on lines
+10961
to
+10964
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] R1-13: Still stands at 中文说明仍然成立:bridge.test.ts 本轮未改动; — qwen3.8-max via Qwen Code /review (v0.22.0)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] R1-13: Still stands at 中文说明仍然成立:bridge.test.ts 本轮未改动; — qwen3.8-max via Qwen Code /review (v0.22.0) |
||
| }, | ||
|
Comment on lines
+10963
to
+10965
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] R1-13: Still stands at Round-5 probe: re-traced at HEAD: bridge.test.ts still exercises only the InvalidClientIdError path of controlSessionWorkflowTask. 中文说明第 5 轮复查:自第 4 轮以来分支仅合并了 仍然成立:bridge.test.ts 本轮未改动; — qwen3.8-max via Qwen Code /review (v0.22.0)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deferred this round: Critical-only mode is active and the batch was capped at the six Critical findings (the cross-session deletion/resurrection cluster and the untrusted-workspace includeWorkflows leak), each landed with regression tests and mutation-probed witnesses. This Suggestion remains queued for a follow-up round. The controlSessionWorkflowTask success-path payload assertion was not added this round. 本轮顺延:当前处于 Critical-only 模式,批次上限为 6 个 Critical 发现(跨会话删除/复活问题簇与不可信工作区的 includeWorkflows 泄露),均已随回归测试和变异探针见证落库。该建议保持排队,留待后续轮次处理。 |
||
|
|
||
| async controlSessionGoal(sessionId, request, context) { | ||
| const entry = byId.get(sessionId); | ||
| if (!entry) throw new SessionNotFoundError(sessionId); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion]
controlSessionWorkflowTask— the only code that joins the serve/ACP-http routes to the agent-sideqwen/control/session/task/workflow-actionext handler by constructing the{ taskId, action }payload — has no happy-path test: the sole bridge.test.ts reference is the InvalidClientIdError rejection, which throws beforerequestSessionStatusis reached, so the payload construction is never exercised. Probe: renaming the payload keys to{ task_id, act }passes all 775 bridge tests; in production the agent handler then throws invalidParams on every request and all SDK/WebUI controls fail while CI is green. Part of a pattern in this PR: the cross-layer wire junctions (bridge, SDK client, ACP dispatch, route table) have no request-construction tests.Fix: a bridge.test.ts happy path mirroring the
includeWorkflowsassertion style used in this diff — the fake agent recordsqwen/control/session/task/workflow-actioncalls; invokebridge.controlSessionWorkflowTask(sessionId, 'task-1', 'pause')and assert the recorded params are{ sessionId, taskId: 'task-1', action: 'pause' }and the echoed response is returned.中文说明
[Suggestion]
controlSessionWorkflowTask——唯一通过构造{ taskId, action }载荷把 serve/ACP-http 路由与 agent 侧qwen/control/session/task/workflow-actionext handler 连接起来的代码——没有正向路径测试:bridge.test.ts 中唯一的引用是 InvalidClientIdError 拒绝用例,它在requestSessionStatus之前就抛错,因此载荷构造从未被执行。探针:把载荷键改名为{ task_id, act }后全部 775 个 bridge 测试通过;而在生产中,agent handler 会对每个请求抛出 invalidParams,所有 SDK/WebUI 控制都会失败,CI 却是绿的。这是本 PR 的一个模式:跨层接线点(bridge、SDK client、ACP dispatch、路由表)没有请求构造测试。修复:在 bridge.test.ts 中仿照本 diff 的
includeWorkflows断言风格增加正向路径——让假 agent 记录qwen/control/session/task/workflow-action调用;调用bridge.controlSessionWorkflowTask(sessionId, 'task-1', 'pause'),断言记录的参数为{ sessionId, taskId: 'task-1', action: 'pause' }且响应被原样返回。— qwen3.8-max via Qwen Code /review (v0.22.0)