Skip to content

fix(native-chat): stop flashing "still starting" on every chat launch - #23666

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-claude-starting-flash
Sep 29, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-claude-starting-flash

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​366 $\color{#cf222e}{\Huge{\mathbf{−}}}$​42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​324
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​167 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​152

ELI5

When you open a new structured chat, the agent (for example Claude) needs a moment to start. During that moment the chat showed "Claude is still starting. Messages wait until it is ready; close this chat to give up on it." Because every chat goes through that moment, the sentence flashed on screen for about half a second on every normal launch. Now it only appears when startup is genuinely slow.

What Changed

Before. The chat pane showed the startup notice whenever the host reported the agent's process as starting. A healthy launch sits in that state briefly, so the notice appeared and vanished on every new chat.

After. A normal launch shows nothing. If the agent is still starting after 5 seconds, the notice appears and explains why messages are waiting. Once shown, it stays at least 400 ms, so it cannot blink if startup finishes just after the delay. Switching to another chat drops it at once, and a relaunch waits the full delay again.

Mechanism. A keyed delayed status turns the real startup phase into the notice the view shows. The execution host already identifies each provider child by generation and fence; its status summary now carries that identity as an optional field. The view keys its delay by conversation and child generation (fence when no generation exists), so replacing a child resets the full delay even if the phase stays starting. A phase transition also resets the delay when an older host omits child identity. Status ownership loss clears the identity. Message holding still reads the real phase, so delivery is unchanged.

Why

The notice is useful when startup is slow or stuck, since there is no longer a startup deadline, but noise when startup is normal. A general delayed status fixes the flash in both directions: it ignores short states and keeps a shown state from blinking off right away. It is also reusable for other short-lived statuses, rather than being a one-off timer in this component.

Alternatives considered:

  • Deleting the notice. This would leave a stuck start with no explanation of why messages are not being answered.
  • A plain mount-time timer. This still blinks when startup finishes just after the delay, and it does not handle a relaunch in the same session cleanly.

The 5 second show delay is deliberately longer than the few-hundred-millisecond delays suited to brief sync blips. Normal starts in the measured runs lasted roughly 0.3–0.4 seconds, so a shorter threshold could still flash.

Linked Issue

N/A. This was reported directly by a maintainer.

Visual Proof

Tested in a dev build on a second Mac. A test wrapper around the claude command delayed its startup by a chosen number of seconds. Each capture is the full window, taken while a new Claude chat was still starting.

Before: 3 s into a 4 s start After: 3 s into a 4 s start After: 8 s into a 10 s start
before-delay4-mid after-delay4-mid after-delay10-mid

The notice also pushes the empty state up by about 12 px, so the flash was a layout jump as well as text.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Manual testing: a macOS dev build with a fresh profile. Before = this branch with its production files reverted to main; after = this branch. A page observer recorded every moment the notice appeared or disappeared.

Scenario Before After
Normal launch (no added delay), 3 runs each Notice flashed every time, for 443 ms, 401 ms and 283 ms Notice never appeared
Startup delayed 4 s Notice shown for the whole start Notice never appeared
Startup delayed 5 s (ends just past the grace period) Not run Appeared 5.08 s after spawn and stayed 402 ms, the minimum visible time, so no blink
Startup delayed 10 s Not run Appeared 5.09 s after spawn and cleared 0.28 s after Claude started answering
  • src/renderer/src/lib/delayed-status.test.ts covers: a short status is never shown, a status is shown after the delay, the minimum visible time holds, a new key drops the status at once, and nothing shows after dispose.
  • NativeChatStructuredSessionStatus.test.tsx covers a normal and slow startup, session switch, rapid restart during the minimum display period, and a replacement child whose intermediate phase is not rendered. Status-feed tests cover child identity publication, ownership clearing, and stable subscriptions. The quiet-startup and relaunch tests fail against the previous component.
  • The renderer typecheck and the changed-code quality gates pass locally.

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The status summary gains one optional, non-persisted child identity field; older clients ignore it. An older host cannot identify a replacement child if it publishes two starts as one uninterrupted starting phase, though observed phase transitions still reset the delay. The notice is desktop-only and the timing behavior is platform-independent.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@brennanb2025
brennanb2025 marked this pull request as ready for review September 28, 2026 19:14
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6b5b2703-c71f-466e-907c-28bd4c95431d

📥 Commits

Reviewing files that changed from the base of the PR and between 3a63b47 and 4c78082.

📒 Files selected for processing (16)
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed-child.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed-test-session.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-subagent-recency.test.ts
  • src/main/runtime/runtime-worktree-structured-agent-rows-liveness.test.ts
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.test.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
  • src/renderer/src/lib/delayed-status.test.ts
  • src/renderer/src/lib/delayed-status.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed-lifecycle.test.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.ts
  • src/shared/agent-session-wire.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The status feed now includes provider-child generation and fence metadata in session summaries. The renderer reads a child key with generation as the primary value and fence as the fallback. A delayed-status controller and React hook now manage status display. The native chat startup notice appears after the startup phase remains active for five seconds. Tests cover child replacement, readiness, phase restarts, session changes, minimum visibility, and disposal.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 4c780

The reported restart should receive a fresh notice delay on the inspected path. No actionable merge-blocking risk remains after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 4c780

The new child identity appears to affect when a startup notice is shown, not who can send messages or control a session. No new security exposure was established, but behavior across every client and reconnect state is not fully evidenced.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The added identity reaches subscribers of the existing status contract, but the inspected downstream path uses it for renderer state rather than as a command or authorization input.

Trust Boundaries and Controls

  • observed — Message handover re-reads the host-owned child and requires both its generation and fence to match the awaited identity. The delayed notice does not supply that identity to handover.

Resilience and Maintainability Implications

  • observed — Both host and renderer cleanup remove child identity alongside live execution status, limiting stale notice state after ownership is revoked.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 17 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main user-facing change: preventing the startup notice from flashing during normal native-chat launches.
Description check ✅ Passed The description includes the required sections, explains the user impact and mechanism, provides visual proof, testing details, compatibility notes, and checklist status. The Review section is empty, …
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Delayed status primitive — new src/renderer/src/lib/delayed-status.ts (createDelayedStatus) and src/renderer/src/hooks/use-delayed-status.ts: a keyed status that is shown only after showDelayMs, held for at least minVisibleMs, and dropped immediately when the key changes.
  • Startup notice — NativeChatStructuredSessionStatus.tsx renders the "still starting" copy from the delayed value (5 s grace) instead of the raw starting phase; message holding still reads the real phase at NativeChatStructuredSession.tsx:43, so delivery is unchanged.
  • Tests — new delayed-status.test.ts (show delay, min-visible hold, key switch, dispose) plus a rewritten NativeChatStructuredSessionStatus.test.tsx covering a quiet normal startup, a slow startup, grace-period restart on relaunch/session switch, and ready/unknown phases.

Traced the timer state machine and the hook's React lifecycle behavior against the documented invariants; both hold for this consumer, and the new tests assert exact boundaries rather than loose ones. pnpm exec vitest run --config config/vitest.config.ts passes for both changed test files, and the changed-code quality gate reports 0 new findings.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review paused after finding a user-visible startup notice bug. If a slow start has displayed the notice and the agent restarts in the same conversation during the 400 ms minimum display period, the notice carries into the new start instead of waiting the promised five seconds. The pane is keyed by session ID, so the status component remains mounted; the delayed-status state keeps the same key and shown value across the restart (src/renderer/src/lib/delayed-status.ts:54-84).

No fix or new commit was pushed. The remaining review and Electron validation were stopped under the requested stop-on-unexpected-behavior rule. The PR is not ready for a clean review verdict until the restart behavior is corrected and validated.

Every structured chat passes through a short startup phase, and the pane
showed "<agent> is still starting…" for all of it, so a normal launch
flashed the notice for a fraction of a second. The notice now goes through
a keyed delayed status: it appears only once startup outlasts a grace
period, stays up for a minimum time once shown, and resets per session.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/fix-claude-starting-flash branch from 3a63b47 to 4c78082 Compare September 28, 2026 20:21

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior pullfrog review (3a63b47 → 4c78082), which threads a provider-child identity through the host status summary so the startup notice resets per child.

  • Child identity on the wire — AgentSessionStatusSummary gains an optional hostExecutionChild: { generation: string | null; fence: number }; the host feed publishes it with hostExecutionPhase, folds it into summariesEqual, and strips it (with the other host-execution fields) on revokeLive. Being a new optional field on an existing status frame, mixed-version peers ignore it safely.
  • Renderer hook generalized — useStructuredAgentSessionHostExecution replaces useStructuredAgentSessionHostExecutionPhase, returning { phase, childKey } (generation, else fence); NativeChatStructuredSession passes childKey through as startupChildKey. Message holding still reads the real phase.
  • Notice keyed by child — NativeChatStructuredSessionStatus keys useDelayedStatus on JSON.stringify([sessionId, typeof childKey, childKey]), so a replacement child restarts the full 5 s grace period even when the phase stays starting.
  • Delayed-status restart edge — createDelayedStatus now restarts the show delay when a shown status clears and returns during its minimum-visible hold, so an observed host-side restart (an older host with no child identity) re-arms instead of staying shown.
  • Tests — new main feed child-identity test, rewritten bridge and component tests (per-child reset, fence fallback), and an added delayed-status clear-and-return case.

I traced the timer state machine (key change, clear/return, min-visible hold, dispose), the feed's identity equality and revocation plumbing, and the hook's external-store reads; all hold for this consumer, and the new tests assert exact boundaries. The changed renderer and main test files pass locally (vitest run --config config/vitest.config.ts; 73 tests across 8 files).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Adds delay logic to prevent flashing startup messages in chat.

The PR appears safe to merge; the reusable utility has a non-blocking multi-value behavior to correct.

Findings

  1. P2 Replacement statuses skip the delay ▶

Summary

The PR delays the structured-chat startup notice until startup has lasted five seconds, holds a displayed notice briefly to prevent blinking, and carries provider-child identity through the status feed so a replacement child gets a new grace period.

  • Message holding continues to use the real host phase.
  • The reusable delayed-status utility does not delay a replacement non-null status value.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Host[Host child phase and identity] --> Feed[Status feed]
  Feed --> Bridge[Renderer phase and child key]
  Bridge --> Delivery[Message holding uses real phase]
  Bridge --> Delay[Delayed status]
  Delay --> Notice[Startup notice]
Loading

Reviews (1) · Last reviewed commit: "fix(native-chat): reset startup notice f..."

Comment on lines +82 to +85
if (value !== null) {
if (value !== shown) {
show(value)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Replacement statuses skip the delay
When one status is visible, changing directly to a different non-null value calls show(value) immediately. For example, after A has appeared, a brief B will appear even if it clears before showDelayMs. This breaks the utility’s promise that short-lived statuses never appear, so other consumers can still see the flash this helper is meant to prevent.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status on 4c780820eb7: blocked on an unexpected chat response seen during UI QA.

The startup-notice fix is pushed. The host now publishes its existing child identity, and the chat restarts the five-second notice delay when that child changes, even if both status updates say starting. Independent code review and the final readiness check found no proven defect in this patch. Focused tests, local node and web typechecks, cross-version wire compatibility, static analysis, packaging, and most CI jobs passed; five full-test shards were still pending at the time of this comment.

In an isolated dev profile on this commit, a newly created structured Claude chat displayed an unrelated answer about another QA session beneath my prompt, “Reply with only OK.” Later new chats answered OK. I have not established whether the mismatch comes from this PR or an existing/shared-session path, so I stopped UI QA and am not marking the PR merge-ready. The slow-start wrapper also did not intercept the actual chat child in this environment, leaving a fresh final-revision slow-start and same-session-replacement Electron replay unverified; the PR body has earlier slow-start screenshots, and focused tests cover replacement timing.

This full-window screenshot shows a later normal launch on the final revision, with the reply visible and no startup notice: Normal structured Claude launch on the final revision

The requested Grok Electron worker was started in a child worktree but could not run because Grok Build requested more credits. Its live worktree and terminal were left intact. No merge was performed.

@brennanb2025
brennanb2025 merged commit b283a09 into main Sep 29, 2026
45 checks passed
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Final status: merged as b283a096. This supersedes my earlier blocked-status comment.

The unexpected QA answer was traced to a separate Claude agent sending a cross-session message into the QA Claude process after that chat had already answered the test prompt with OK. The execution journal contains the original Orca user submission and answer, then an unsolicited provider turn with no second Orca user submission. That answer is therefore not evidence of this PR routing another chat's prompt or breaking the startup notice. No additional product-code change was warranted for this PR.

The final patch was independently reviewed, the final readiness check found no material blocker, and every applicable CI check passed, including all eight test shards, typecheck, cross-version wire compatibility, static analysis, and packaging. The branch also merged cleanly with current main. Electron QA on the final revision showed a normal structured Claude launch without the startup notice; the PR body retains full-window slow-start visual evidence from before the child-identity follow-up. A live same-session replacement replay on the final revision was not obtained; focused tests cover its phase and child-identity timing. The Grok worker could not perform QA because Grok Build required credits, so Electron validation used the available CDP workflow directly.

@brennanb2025

brennanb2025 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

The problem in #23666 was a brief, distracting “Claude is starting” message during normal starts. The merged change delays that notice for five seconds, then shows it only while the same provider child is still starting. A replacement child gets its own delay, so an old timer or notice does not leak into the new start.

Post-merge Claude Opus review (standard context, high effort, two matching subagents) and final readiness review found no P0–P2 issue caused by this PR. The host owns child identity and lifecycle fencing; the renderer only delays presentation. The optional child identity in the status feed is needed because a same-session child can be replaced without an intermediate empty state. No change to the merged PR was warranted.

Full hidden Electron QA on the M4Air exercised the exact merged source: normal startup showed no notice; a nine-second startup showed it at about five seconds and cleared it on ready; a same-session child restart received a fresh delay; pending and visible notices from the old child did not carry over; another chat never showed the slow chat’s notice. Six related test files (65 tests) passed. Evidence: normal start, slow-start notice, new child’s notice, cross-session isolation, and slow-start recording. Twenty screenshots and the recording are attached to this PR.

At QA time, adjacent #23682 had left a stale Codex import, so the exact merged source needed an out-of-tree build alias; the QA worktree stayed unchanged. This was separate from #23666. Since then, #23801 removed the stale import and #23808 restored child-turn settlement for a non-retried error when no turn completion arrives. Both are merged; #23808 passed its CI checks. Follow-up #23794 was superseded by those changes and closed without merging.

Deferred P3 observations: reconnecting or first opening an already-starting chat can restart the five-second display delay; replacing a child can end the 400 ms minimum visible period early; generic timing-helper edge cases and a full attach-path integration test remain. One initial QA attempt on the historical merged commit also showed an empty first response row after a message was sent while the first turn was running. That separate queued-message behavior was changed later on main, but this exact attempt was not replayed there, so its current behavior is unverified. Windows, Linux, and SSH rendered UI were not exercised in this pass.

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