Skip to content

fix: stop working timer when agent is awaiting user input#1348

Draft
rdoupe wants to merge 3 commits intopingdotgg:mainfrom
rdoupe:fix/working-timer-pending-user-input
Draft

fix: stop working timer when agent is awaiting user input#1348
rdoupe wants to merge 3 commits intopingdotgg:mainfrom
rdoupe:fix/working-timer-pending-user-input

Conversation

@rdoupe
Copy link

@rdoupe rdoupe commented Mar 24, 2026

What Changed

Two locations showed stale "Working" state after the agent finished:

  1. ChatView.tsx — "Working for Xm Xs" timer in the main chat area
  2. Sidebar.logic.ts — "Working" pill on thread list items

Both checked only session.status === "running" to decide whether to show the working state.

Why

The server can lag in transitioning session.status away from "running" even after the latest turn has a completedAt timestamp. This caused:

  • The main chat timer to keep counting after Claude finished responding
  • The sidebar pill to keep showing "Working" after the turn completed
  • Both to keep showing even when the agent was blocked waiting for user input (via AskUserQuestion)

Fix: suppress working state when latestTurn.completedAt is set (turn is done, regardless of server status lag), or when pendingUserInputs.length > 0 (agent is waiting on the user, not actively working).

// ChatView.tsx - was a single line, now accounts for both cases:
const isActivelyRunning =
  phase === "running" &&
  pendingUserInputs.length === 0 &&
  !activeLatestTurn?.completedAt;
const isWorking = isActivelyRunning || isSendBusy || isConnecting || isRevertingCheckpoint;

// Sidebar.logic.ts - added completedAt guard:
if (thread.session?.status === "running" && !thread.latestTurn?.completedAt) { ... }

UI Changes

⚠️ Video pending — will add a before/after screen recording before marking ready for review.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Fixes #1069, closes #1335

The isWorking flag was computed before pendingUserInputs, so it never
accounted for the agent being in a paused state waiting for user input.
This caused the "Working for Xm Xs" timer to keep counting indefinitely
even after the agent had asked a question and was no longer actively running.

Fixes pingdotgg#1069, closes pingdotgg#1335

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a91c5dde-af0a-4b9b-b76e-6655817aa2ca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 24, 2026
@rdoupe rdoupe marked this pull request as draft March 24, 2026 03:41
Two locations showed stale "Working" state after the agent finished:

1. ChatView.tsx - "Working for Xm Xs" timer in the main chat
2. Sidebar.logic.ts - "Working" pill on thread list items

Root cause: both checked only session.status === "running", but the
server can lag in transitioning that status even after the latest turn
has a completedAt timestamp. Also, neither checked for pending user
inputs, so the timer kept running when the agent was blocked waiting
for the user to answer a question.

Fix: suppress "working" state when latestTurn.completedAt is set
(turn is done regardless of server status lag), or when there are
pending user inputs (agent is waiting, not working).

Fixes pingdotgg#1069, closes pingdotgg#1335

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Mar 24, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added size:XS 0-9 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Working timer continues when the agent asks a question [Bug]: Main timeline keeps counting "Working for X" while thread is awaiting user input

1 participant