Repository navigation
fix(channels): return only final ACP response text #6615
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 3 commits
732bee8
cf18ad4
0cf0112
f20f950
a6d31c3
aee6a87
f41e881
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 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -792,8 +792,15 @@ export abstract class ChannelBase { | |||||||||||||||
| releaseHeldChunks(); | ||||||||||||||||
| } | ||||||||||||||||
| }; | ||||||||||||||||
| const onResponseBoundary = (sid: string) => { | ||||||||||||||||
| if (sid !== sessionId || promptState.cancelled) { | ||||||||||||||||
| return; | ||||||||||||||||
| } | ||||||||||||||||
| heldChunks.length = 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. [Critical] Apply the same
Suggested change
When the cancel succeeds, chunks are discarded via — qwen3.7-max via Qwen Code /review |
||||||||||||||||
| const promptBridge = this.bridge; | ||||||||||||||||
| promptBridge.on('textChunk', onChunk); | ||||||||||||||||
| promptBridge.on('responseBoundary', onResponseBoundary); | ||||||||||||||||
|
|
||||||||||||||||
| try { | ||||||||||||||||
| const response = await this.runLoopBridgePrompt( | ||||||||||||||||
|
|
@@ -884,6 +891,7 @@ export abstract class ChannelBase { | |||||||||||||||
| throw err; | ||||||||||||||||
| } finally { | ||||||||||||||||
| promptBridge.off('textChunk', onChunk); | ||||||||||||||||
| promptBridge.off('responseBoundary', onResponseBoundary); | ||||||||||||||||
| const stillCurrent = this.activePrompts.get(sessionId) === promptState; | ||||||||||||||||
| if (!promptState.clearEvicted) { | ||||||||||||||||
| try { | ||||||||||||||||
|
|
@@ -3547,8 +3555,16 @@ export abstract class ChannelBase { | |||||||||||||||
| releaseHeldChunks(); | ||||||||||||||||
| } | ||||||||||||||||
| }; | ||||||||||||||||
| const onResponseBoundary = (sid: string) => { | ||||||||||||||||
| if (sid !== sessionId || promptState.cancelled) { | ||||||||||||||||
| return; | ||||||||||||||||
| } | ||||||||||||||||
| heldChunks.length = 0; | ||||||||||||||||
| streamer?.stop(); | ||||||||||||||||
|
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. [Critical]
When the boundary fires, In block-streaming mode this is not an issue: Feishu's Suggested fix: Add an adapter-level reset hook (e.g., a protected — qwen3.7-max via Qwen Code /review |
||||||||||||||||
| }; | ||||||||||||||||
| const promptBridge = this.bridge; | ||||||||||||||||
| promptBridge.on('textChunk', onChunk); | ||||||||||||||||
| promptBridge.on('responseBoundary', onResponseBoundary); | ||||||||||||||||
|
|
||||||||||||||||
| try { | ||||||||||||||||
| const response = await promptBridge.prompt(sessionId, promptToSend, { | ||||||||||||||||
|
|
@@ -3615,6 +3631,7 @@ export abstract class ChannelBase { | |||||||||||||||
| throw err; | ||||||||||||||||
| } finally { | ||||||||||||||||
| promptBridge.off('textChunk', onChunk); | ||||||||||||||||
| promptBridge.off('responseBoundary', onResponseBoundary); | ||||||||||||||||
| streamer?.stop(); | ||||||||||||||||
| // Identity guard: a turn that wedged past /clear's bounded wait gets | ||||||||||||||||
| // EVICTED — /clear gives up on active.done, deletes activePrompts, and a | ||||||||||||||||
|
|
||||||||||||||||
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]
emitResponseBoundaryand theclearChunkscallback silently zero the chunks array with no log, counter, or diagnostic. When debugging boundary-related issues (e.g., empty responses), there is no way to distinguish "agent generated no text" from "boundaries discarded text" from "bug swallowed chunks" without attaching a debugger.Consider adding a debug log:
— qwen3.7-max via Qwen Code /review