Skip to content

Commit e7070e0

Browse files
Evsdrgdeepseek-v4-pro[1m]
andcommitted
fix: showSpinnerTree 模式下保留 local-agent token 显示
PR #1226 的 CodeRabbit 审查指出:当 spinner-tree 模式开启时, local-agent(后台代理)的 token 消耗完全不可见,因为它们没有 在树中有独立行,但被 showSpinnerTree 的 guard 排除了。 修复:将 guard 从循环外移到循环内,仅对 in_process_teammate 任务在 tree 模式下跳过(它们有独立树行),local-agent 任务 始终计入 teammateTokens。 Closes: review comment from PR #1226 (originally belongs to PR #1225) Co-Authored-By: deepseek-v4-pro[1m] <deepseek-ai@claude-code-best.win>
1 parent 80b46d2 commit e7070e0

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/components/Spinner.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,22 @@ function SpinnerWithVerbInner({
210210
const hasRunningTeammates = runningTeammates.length > 0;
211211
const allIdle = hasRunningTeammates && runningTeammates.every(t => t.isIdle);
212212

213-
// Gather aggregate token stats from all running swarm teammates
214-
// In spinner-tree mode, skip aggregation (teammates have their own lines in the tree)
213+
// Gather aggregate token stats from all running agents.
214+
// In spinner-tree mode, skip in-process teammates (they have their own
215+
// per-teammate lines in the tree) but still count local-agent tasks
216+
// (background agents) which have no dedicated tree rows.
215217
let teammateTokens = 0;
216-
if (!showSpinnerTree) {
217-
for (const task of Object.values(tasks)) {
218-
if (task.status === 'running' && (isInProcessTeammateTask(task) || isLocalAgentTask(task))) {
219-
if (task.progress?.tokenCount) {
220-
teammateTokens += task.progress.tokenCount;
221-
}
218+
for (const task of Object.values(tasks)) {
219+
if (task.status !== 'running') continue;
220+
if (isInProcessTeammateTask(task)) {
221+
if (!showSpinnerTree && task.progress?.tokenCount) {
222+
teammateTokens += task.progress.tokenCount;
223+
}
224+
continue;
225+
}
226+
if (isLocalAgentTask(task)) {
227+
if (task.progress?.tokenCount) {
228+
teammateTokens += task.progress.tokenCount;
222229
}
223230
}
224231
}

0 commit comments

Comments
 (0)