Bug
When a chat response contains multiple terminal tool invocations, the OS notification toast shows the command from the first terminal invocation (which may have already completed) rather than the one actually waiting for confirmation.
Repro
- Start a session where the agent runs multiple terminal commands sequentially
- The first command (e.g.
git status --short) completes and the agent moves on
- A later command (e.g. a complex
npx playwright test ... invocation) requires user confirmation
- The OS toast notification fires but displays the first command (
git status --short) instead of the pending one
Cause
_getPendingTerminalCommand in chatWindowNotifier.ts iterates over all response parts and returns the first toolInvocation with toolSpecificData.kind === 'terminal' — it does not check whether that invocation is actually in WaitingForConfirmation or WaitingForPostApproval state.
Fix
Filter to only match tool invocations whose state is WaitingForConfirmation or WaitingForPostApproval, consistent with what _confirmAllow already does.
Bug
When a chat response contains multiple terminal tool invocations, the OS notification toast shows the command from the first terminal invocation (which may have already completed) rather than the one actually waiting for confirmation.
Repro
git status --short) completes and the agent moves onnpx playwright test ...invocation) requires user confirmationgit status --short) instead of the pending oneCause
_getPendingTerminalCommandinchatWindowNotifier.tsiterates over all response parts and returns the firsttoolInvocationwithtoolSpecificData.kind === 'terminal'— it does not check whether that invocation is actually inWaitingForConfirmationorWaitingForPostApprovalstate.Fix
Filter to only match tool invocations whose state is
WaitingForConfirmationorWaitingForPostApproval, consistent with what_confirmAllowalready does.