Repository navigation
fix(web-shell): defer assistant footer during background agent work #8787
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
Merged
wenshao
merged 14 commits into
QwenLM:main
from
carffuca:fix/web-shell-premature-assistant-footer
Aug 14, 2026
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
cda1434
test(web-shell): reproduce premature assistant footer
carffuca 108133f
fix(web-shell): defer assistant footer during agent work
carffuca 118f6b4
refactor(web-shell): clarify incomplete turn state
carffuca 756c3e4
test(web-shell): cover stale agent footer states
carffuca 0f9b25c
test(web-shell): cover background agent reconciliation gaps
carffuca ca73a26
fix(web-shell): bound background agent footer state
carffuca d3695c3
Merge branch 'main' into fix/web-shell-premature-assistant-footer
qwen-code-dev-bot 36095fd
fix(web-shell): gate assistant footer on live agent state only
carffuca d0f1a4b
Merge branch 'main' into fix/web-shell-premature-assistant-footer
qwen-code-dev-bot 1382924
fix(web-shell): address review feedback on background agent footer ga…
qwen-code-dev-bot 04050df
fix(web-shell): bound reconciliation retries and re-arm completion grace
qwen-code-dev-bot 0e38286
fix(web-shell): keep background agent completion queries retryable
qwen-code-dev-bot 4c6e4a6
fix(web-shell): re-arm grace latch per episode and guard round reuse
qwen-code-dev-bot 8f8bdd3
fix(web-shell): scope grace to unmatched episodes and per-agent retry…
qwen-code-dev-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 161 additions & 0 deletions
161
packages/sdk-typescript/test/unit/isSubagentSessionNotFound.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2025 Qwen Team | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { describe, expect, it } from 'vitest'; | ||
| import { | ||
| DaemonHttpError, | ||
| isSessionLevelNotFound, | ||
| isSubagentSessionNotFound, | ||
| } from '../../src/daemon/DaemonHttpError.js'; | ||
|
|
||
| const missingAgentBody = { | ||
| code: 'session_not_found', | ||
| sessionId: 'session-1', | ||
| toolCallId: 'call-1', | ||
| }; | ||
|
|
||
| describe('isSubagentSessionNotFound', () => { | ||
| it('matches a 404 whose body identifies the missing agent', () => { | ||
| expect( | ||
| isSubagentSessionNotFound( | ||
| new DaemonHttpError(404, missingAgentBody, 'not found'), | ||
| 'call-1', | ||
| ), | ||
| ).toBe(true); | ||
| }); | ||
|
|
||
| it('matches a session-level 404 when no toolCallId is required', () => { | ||
| expect( | ||
| isSubagentSessionNotFound( | ||
| new DaemonHttpError( | ||
| 404, | ||
| { code: 'session_not_found', sessionId: 'session-1' }, | ||
| 'not found', | ||
| ), | ||
| ), | ||
| ).toBe(true); | ||
| }); | ||
|
|
||
| it.each([ | ||
| ['non-DaemonHttpError', new Error('not found'), 'call-1'], | ||
| [ | ||
| 'non-404 status', | ||
| new DaemonHttpError(500, missingAgentBody, 'server error'), | ||
| 'call-1', | ||
| ], | ||
| [ | ||
| 'missing code', | ||
| new DaemonHttpError(404, { toolCallId: 'call-1' }, 'not found'), | ||
| 'call-1', | ||
| ], | ||
| [ | ||
| 'wrong code', | ||
| new DaemonHttpError( | ||
| 404, | ||
| { ...missingAgentBody, code: 'workspace_not_found' }, | ||
| 'not found', | ||
| ), | ||
| 'call-1', | ||
| ], | ||
| [ | ||
| 'missing toolCallId in body', | ||
| new DaemonHttpError( | ||
| 404, | ||
| { code: 'session_not_found', sessionId: 'session-1' }, | ||
| 'not found', | ||
| ), | ||
| 'call-1', | ||
| ], | ||
| [ | ||
| 'null toolCallId in body', | ||
| new DaemonHttpError( | ||
| 404, | ||
| { code: 'session_not_found', sessionId: 'session-1', toolCallId: null }, | ||
| 'not found', | ||
| ), | ||
| 'call-1', | ||
| ], | ||
| [ | ||
| 'mismatched toolCallId', | ||
| new DaemonHttpError(404, missingAgentBody, 'not found'), | ||
| 'call-other', | ||
| ], | ||
| ])('rejects %s', (_label, error, toolCallId) => { | ||
| expect(isSubagentSessionNotFound(error, toolCallId as string)).toBe(false); | ||
| }); | ||
|
|
||
| it('rejects non-object bodies', () => { | ||
| expect( | ||
| isSubagentSessionNotFound( | ||
| new DaemonHttpError(404, 'session_not_found', 'not found'), | ||
| 'call-1', | ||
| ), | ||
| ).toBe(false); | ||
| }); | ||
| }); | ||
|
|
||
| describe('isSessionLevelNotFound', () => { | ||
| it('matches a 404 whose body has no toolCallId', () => { | ||
| expect( | ||
| isSessionLevelNotFound( | ||
| new DaemonHttpError( | ||
| 404, | ||
| { code: 'session_not_found', sessionId: 'session-1' }, | ||
| 'not found', | ||
| ), | ||
| ), | ||
| ).toBe(true); | ||
| }); | ||
|
|
||
| it('matches a 404 whose body carries a null toolCallId', () => { | ||
| expect( | ||
| isSessionLevelNotFound( | ||
| new DaemonHttpError( | ||
| 404, | ||
| { | ||
| code: 'session_not_found', | ||
| sessionId: 'session-1', | ||
| toolCallId: null, | ||
| }, | ||
| 'not found', | ||
| ), | ||
| ), | ||
| ).toBe(true); | ||
| }); | ||
|
|
||
| it('rejects an agent-level 404', () => { | ||
| expect( | ||
| isSessionLevelNotFound( | ||
| new DaemonHttpError(404, missingAgentBody, 'not found'), | ||
| ), | ||
| ).toBe(false); | ||
| }); | ||
|
|
||
| it('rejects a 404 whose body carries a different code', () => { | ||
| expect( | ||
| isSessionLevelNotFound( | ||
| new DaemonHttpError( | ||
| 404, | ||
| { code: 'workspace_not_found', sessionId: 'session-1' }, | ||
| 'not found', | ||
| ), | ||
| ), | ||
| ).toBe(false); | ||
| }); | ||
|
|
||
| it('rejects non-404 and non-matching errors', () => { | ||
| expect( | ||
| isSessionLevelNotFound( | ||
| new DaemonHttpError( | ||
| 500, | ||
| { code: 'session_not_found', sessionId: 'session-1' }, | ||
| 'server error', | ||
| ), | ||
| ), | ||
| ).toBe(false); | ||
| expect(isSessionLevelNotFound(new Error('not found'))).toBe(false); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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]
getErrorBodyRecordduplicates existingisRecordtype guard in the same package — Concrete cost: the codebase now has two implementations of the same non-null-non-array-object check in the same module hierarchy. If the check ever needs updating, the privategetErrorBodyRecordinDaemonHttpError.tswill be missed.中文说明
getErrorBodyRecord是同一包中已有isRecord类型守卫的重复实现。建议删除getErrorBodyRecord并导入acpTransportUtils.ts中的isRecord。— deepseek-v4-flash via Qwen Code /review (v0.21.8)
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.
Declined: the duplication is deliberate.
DaemonHttpError.tsis an intentionally dependency-free leaf module (see its header comment) —RestSseTransportimports it, and it sits in the graph of both budgeted browser bundles thatpackages/sdk-typescript/scripts/build.jsbyte-limits (MAX_DAEMON_BROWSER_BUNDLE_BYTESand the opt-indaemon/transportsbundle). ImportingisRecordfromacpTransportUtils.jswould transitively pull in the ~1000-line ACP route table (acpTransportUtilsimportsROUTE_TABLEfromacpRouteTable.js), and theui/utils.jscopy would pull in the UI rendering helpers — each is excluded from one of those bundles today precisely to keep them out. A 4-line non-null-non-array-object check is stable enough that a local private copy is the bundle-correct choice; a comment ongetErrorBodyRecordnow records this constraint so the next person weighing dedup sees the trade-off.中文说明
拒绝:该重复是有意为之。
DaemonHttpError.ts是一个刻意保持零依赖的叶子模块(见其头部注释)——RestSseTransport导入它,且它位于两个受字节预算约束的浏览器 bundle 的模块图中(packages/sdk-typescript/scripts/build.js中的MAX_DAEMON_BROWSER_BUNDLE_BYTES与可选的daemon/transportsbundle)。从acpTransportUtils.js导入isRecord会连带引入约 1000 行的 ACP 路由表(acpTransportUtils从acpRouteTable.js导入ROUTE_TABLE);而ui/utils.js中的副本则会引入 UI 渲染辅助函数——这两者今天正是为了不进这些 bundle 而被隔离的。4 行的"非 null、非数组对象"判断足够稳定,本地私有副本是符合 bundle 预算的正确选择;现已在getErrorBodyRecord上添加注释记录该约束,便于后续考虑去重的人了解权衡。