Skip to content

Fix stale send spinner after completed turns#1700

Merged
juliusmarminge merged 1 commit intopingdotgg:mainfrom
hhharryyyyy:fix-send-spinner-after-turn-complete
Apr 2, 2026
Merged

Fix stale send spinner after completed turns#1700
juliusmarminge merged 1 commit intopingdotgg:mainfrom
hhharryyyyy:fix-send-spinner-after-turn-complete

Conversation

@hhharryyyyy
Copy link
Copy Markdown
Contributor

@hhharryyyyy hhharryyyyy commented Apr 2, 2026

Summary

  • stop treating the composer as actively running when the latest turn already has a completion timestamp
  • use the real active-turn state for the composer spinner, interrupt button, auto-scroll, and elapsed-work timer
  • cover the stale-running-session case in session logic tests

Problem

Sometimes the assistant visibly finishes a turn, but the desktop/web composer keeps showing the running spinner and blocks the next send until refresh. This happens when the latest turn has already completed through message updates, but the session state is still stale at running.

Verification

  • bun fmt
  • bun lint
  • bun typecheck
  • cd apps/web && bun run test src/session-logic.test.ts

Note

Low Risk
Low risk: changes are confined to derived session/turn state and corresponding UI gating (spinner/interrupt/autoscroll/timer), with added unit coverage for stale running sessions.

Overview
Fixes cases where the composer stays stuck in “running” after a turn has already completed by deriving a new isSessionActivelyRunningTurn signal from latestTurn.completedAt + session.activeTurnId (instead of trusting session phase alone).

ChatView now uses this active-turn signal to drive the composer running spinner, auto-scroll while running, elapsed-work timer tick, and to block checkpoint reverts only when a turn is truly in-flight. Tests update isLatestTurnSettled expectations for stale-running sessions and add coverage for isSessionActivelyRunningTurn plus the related deriveActiveWorkStartedAt fallback behavior.

Written by Cursor Bugbot for commit 8f03b59. This will update automatically on new commits. Configure here.

Note

Fix stale send spinner by deriving running state from active turn completion

  • Adds isSessionActivelyRunningTurn in session-logic.ts to check whether a turn is truly in-progress by comparing session orchestrationStatus, activeTurnId, and latest turn completion status.
  • Fixes isLatestTurnSettled to treat a completed turn as settled even when the session orchestrationStatus remains 'running', eliminating the stale spinner.
  • Updates ChatView.tsx to derive isTurnRunning from the new helper, replacing the phase === "running" check that drove auto-scroll, the elapsed timer, composer footer layout, and checkpoint revert blocking.
  • Behavioral Change: revert-to-turn, auto-scroll, and elapsed timer now stop as soon as the turn completes, regardless of session status.

Macroscope summarized 8f03b59.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 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: 4ebf2f7d-9dea-4b83-9f9e-3fb170d16b4c

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 vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Apr 2, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 2, 2026

Approvability

Verdict: Approved

This is a straightforward bug fix for a stale UI spinner, adding a helper function with comprehensive tests. The scope is limited to improving the accuracy of 'is running' detection without changing any significant runtime behavior beyond fixing the intended UI glitch.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge juliusmarminge enabled auto-merge (squash) April 2, 2026 22:56
@juliusmarminge juliusmarminge merged commit 48481aa into pingdotgg:main Apr 2, 2026
12 checks passed
juliusmarminge added a commit that referenced this pull request Apr 3, 2026
This reverts commit 48481aa.

Co-authored-by: codex <codex@users.noreply.github.com>
gigq pushed a commit to gigq/t3code that referenced this pull request Apr 6, 2026
Chrono-byte pushed a commit to Chrono-byte/t3code that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 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.

2 participants