Skip to content

fix(indicator): hold the foreground glow 5 s after the last input and fade it - #493

Open
AmrDab wants to merge 1 commit into
mainfrom
fix/steady-glow
Open

AmrDab wants to merge 1 commit into
mainfrom
fix/steady-glow

Conversation

@AmrDab

@AmrDab AmrDab commented Nov 29, 2026

Copy link
Copy Markdown
Owner

What

The full-screen foreground glow (the amber edge "side bars") now stays up 5 s after the last real input, counted from when the input finishes. It also fades in (250 ms) and out (600 ms) on Windows and macOS. The three indicator states and their meaning are unchanged:

  • outline = background;
  • full-screen amber = foreground;
  • full-screen blue = needs the user.

Why

In a run that mixes background and foreground steps, the side bars flashed on and then stopped. The cause:

  • The tail: FOREGROUND_TAIL_MS was 1.5 s, armed when the input was announced (before it ran). The usual gap between agent tool calls is 2–10 s, so every foreground step became an isolated 1.5 s blink.
  • Windows: edge-glow.ps1 showed and hid the windows instantly, at a random point of the pulse, so the glow could pop in at full brightness.
  • macOS: overlay.swift did a hard orderFrontRegardless/orderOut.

How

  • banner.ts: the tail is now 5 s. A new foregroundDone() re-arms it when a foreground input finishes. It's a no-op unless a tail is running, so bursts, a pause and the user's turn behave as before, and no extra ON is sent.
  • pointer-guard.ts: setOnAgentInputDone, called right after g.done(...) at the three guarded-input sites.
  • edge-glow.ps1: a level eases 0→1 in 250 ms on ON and 1→0 in 600 ms on OFF, and scales the pulse.
    • The windows hide only once level reaches 0, and an ON during a fade-out turns it around with no hide/show.
    • The pulse restarts at its dim end when the glow comes up.
    • HIDE, used before a capture, still hides at once.
    • The stdin protocol and the 30 ms timer are unchanged.
  • overlay.swift: NSAnimationContext alpha fades (0.25 s in, 0.6 s out). orderOut runs only after a finished fade-out, and only if ON hasn't come back. HIDE is immediate, as before. CI compiles scripts/mac/*.swift on macOS.
  • The pill: it follows the mode as before, so it says "requires foreground" until the 5 s tail ends.

Tests

src/__tests__/banner.test.ts:

  • two foreground inputs 3 s apart keep the glow up with no OFF between them;
  • the tail counts from when an input finishes;
  • OFF comes 5 s after the last input ends, and not before;
  • the source checks for the fade in both overlay scripts.

The new cases fail with main's sources.

typecheck, typecheck:tests, lint (0 errors, the 3 warnings as on main), npm run test:ci: 4299 passed, 1 failed, 80 skipped. The failure was tests/pidfile.system.test.ts "refuses a genuine duplicate", which this branch doesn't touch; it passes on its own (8/8) on re-run. edge-glow.ps1 parses under PowerShell 5.1.

Known limit

A single input running longer than 5 s (a very long typeText) still drops the glow before it ends, because the tail is armed at announce and re-armed only while it is still running. Holding it for the whole input needs an in-flight count: a small follow-up if it shows up.

No release: for the 2.4 train.

🤖 Generated with Claude Code

… fade it

The foreground glow tail was 1.5 s and armed when an input was announced, so with
2-10 s between tool calls every foreground action was an isolated blink, and a
long typeText lost the glow while still typing. The tail is now 5 s and is
re-armed when the input finishes (a done hook from pointer-guard into the banner).
The Windows glow (edge-glow.ps1) and the macOS glow (overlay.swift) fade in over
250 ms and out over 600 ms instead of showing and hiding hard; the Windows pulse
starts at its dim end each time the glow comes up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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