Skip to content

fix(tui): clear sticky currentFile pill when agent activity is quiet#765

Merged
kelsonpw merged 3 commits into
mainfrom
salvage/tui-currentfile-pill-timeout
May 14, 2026
Merged

fix(tui): clear sticky currentFile pill when agent activity is quiet#765
kelsonpw merged 3 commits into
mainfrom
salvage/tui-currentfile-pill-timeout

Conversation

@kelsonpw
Copy link
Copy Markdown
Member

@kelsonpw kelsonpw commented May 14, 2026

Summary

Salvaged from #738 by cherry-picking its unique commit onto a fresh branch from main. The original PR was stacked on the closed feat/v2-tui-redesign (#696); its git history carried ~35 commits of v2 orchestration scaffolding that couldn't be rebased onto main's parallel orchestration implementation.

Original commit preserved: fc8bc468

Test plan

  • tsc clean
  • eslint clean
  • pnpm build clean
  • CI will run vitest + Bugbot

Generated with Claude Code


Note

Low Risk
Low risk: only adjusts TUI rendering logic for the “currently editing” indicator and adds focused tests; no auth/data-flow changes.

Overview
Fixes the Progress tab’s sticky “currently editing …” pill so it stops claiming the agent is editing a file after activity has ended.

RunScreen now clears the last shown filename when either (a) the most recent fileWrites entry is terminal (applied/failed) and older than the new STALE_FILE_WRITE_MS grace window, or (b) post-agent steps begin (postAgentSteps.length > 0). Adds a new vitest suite covering in-flight display, stale-time clearing, immediate clearing on post-agent steps, and “heartbeat” behavior when new writes arrive.

Reviewed by Cursor Bugbot for commit e580915. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Tests assert on nonexistent "editing " prefix from missing component
    • Added the missing "editing " prefix to the current-file pill rendering in RunScreen.tsx (line 504), making the component output match what the tests assert on — positive assertions now correctly verify the pill is visible, and negative assertions genuinely validate that clearing works.

Create PR

Or push these changes by commenting:

@cursor push 2cfe09d64b
Preview (2cfe09d64b)
diff --git a/src/ui/tui/screens/RunScreen.tsx b/src/ui/tui/screens/RunScreen.tsx
--- a/src/ui/tui/screens/RunScreen.tsx
+++ b/src/ui/tui/screens/RunScreen.tsx
@@ -501,7 +501,7 @@
             </Box>
             {currentFile && (
               <Text color={Colors.muted} wrap="truncate-end">
-                {currentFile}
+                editing {currentFile}
               </Text>
             )}
           </Box>

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit a184ff9. Configure here.

Comment thread src/ui/tui/screens/__tests__/RunScreen.currentFilePill.test.tsx
kelsonpw added a commit that referenced this pull request May 14, 2026
…o 30s (#777)

The "refreshes the MCP Authorization header when the token rotates
between attempts" test simulates a 60s cold-start stall plus jittered
backoff (2-30s) inside fake timers — up to ~90s of virtual time per
attempt. The test logic is correct, but the per-test 15s real-time
timeout left no headroom for the scheduler under CI load on Node 20,
producing intermittent "Test timed out in 15000ms" failures across
multiple PRs (#765, #766, #767, #768, #769, #771).

Double the timeout to 30s. No logic change.
kelsonpw added 2 commits May 14, 2026 12:06
The "currently editing X" pill on RunScreen latched `lastFileRef` whenever
`rawFile` was truthy but had no clear path — so after the inner agent
finished its last write, the pill kept showing that file forever, into
the Finalizing phase and beyond. The header lied about what the wizard
was doing.

Clear the sticky value when either condition holds:

  1. The most recent `fileWrites` entry is older than 10s AND its
     status is terminal (`applied` / `failed`) — quiet enough that
     "currently editing" is no longer true.
  2. `postAgentSteps.length > 0` — the agent has moved past the
     file-write phase entirely (commit events, create dashboard, …).
     Clear immediately, no grace period needed.

The stale-time check rides the spinner's existing SPINNER_INTERVAL
re-render — no extra timer mounted. Computed inline during render
rather than through useEffect so a quiet stretch (rawFile null, last
entry timestamps unchanged) doesn't skip re-evaluation.

Tests pin both clear conditions plus a heartbeat-keepalive regression:
a new write before the stale window switches the pill to the new path
without clearing.
…rtions

Same fix as PR #768. The revising-screen elapsed timer ticks every
1s via setInterval; on Node 22 under CI clock pressure the interval
can fire one tick before the test's advanceTimersByTime boundary,
so the rendered "elapsed:" string lands at `1m 29s` instead of
`1m 30s`. Both readings are correct for the test's intent
(verifying tier WIRING, not exact copy), so widen the assertions
to a regex that accepts ±1s.
@kelsonpw kelsonpw force-pushed the salvage/tui-currentfile-pill-timeout branch from da8dbc2 to c4c210e Compare May 14, 2026 19:08
@kelsonpw kelsonpw merged commit 4e48bcd into main May 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant