google-gemini / google-gemini/gemini-cli

fix(cli): all Executing subagent tool calls dropped from UI state, breaking task-tree hierarchy

Open
#22,589 6 comments 0 reactions 1 assignee Claimed by @TravisHaa View on GitHub
area/core effort/small help wanted kind/bug priority/p2 status/bot-triaged
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

## Bug Description

In `useToolScheduler.ts`, tool calls from non-root schedulers (subagents) are filtered before entering state. The filter passes through `AwaitingApproval` calls and previously-seen calls, but silently drops first-seen calls in `Executing` status:

```typescript
event.toolCalls.filter(
(tc) =>
tc.status === CoreToolCallStatus.AwaitingApproval ||
prevCallIds.has(tc.request.callId),
);
```

Subagent tool calls that transition directly to `Executing` without first hitting `AwaitingApproval` — reads, globs, searches, MCP calls, and any non-dangerous tool — are never in `prevCallIds` on their first update, so they are dropped and never reach the UI.

## Impact

**Hierarchy display is broken for subagent work.** The task-tree visualization feature builds its call graph using \`parentCallId\` on each \`IndividualToolCallDisplay\`. Because filtered-out calls never enter \`toolCallsMap\`, they are never included in \`pendingHistoryItems\`, and so \`useTaskTree\` never sees them. The tree is always flat even when a subagent is executing a deep call chain.

Beyond the task tree: any UI feature that needs to observe what a subagent is actually doing (live progress, step-through mode, error traces) is blind to these calls.

## Relationship to #21052 / PR #21268

PR #21268 addresses a narrower slice of the same root cause: it adds `tc.pid !== undefined` to the
filter so that interactive shell calls (PTY-backed) are surfaced when they hang on user input. This
fix is complementary — it extends the pass-through to _all_ `Executing` subagent calls, covering
non-shell tools (reads, MCP, etc.) that #21268 intentionally leaves filtered.

## Fix

Add `Executing` status to the filter unconditionally:

```typescript
tc.status === CeToolCallStatus.AwaitingApproval ||
tc.status === CoreToolCallStatus.Executing ||
prevCallIds.has(tc.request.callId),
```

Calls still in `Scheduled`/`Validating` remain hidden to prevent transient flicker in the
flat-list UI.

## PR

https://github.com/TravisHaa/gemini-cli/tree/fix/subagent-tool-calls-hidden-from-task-tree

Related: #21052, PR #21268

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.