Skip to content

feat(tui): dynamic status indicator for Execute vs Streaming states#122

Merged
echobt merged 1 commit intomainfrom
feat/dynamic-status-indicator
Feb 10, 2026
Merged

feat(tui): dynamic status indicator for Execute vs Streaming states#122
echobt merged 1 commit intomainfrom
feat/dynamic-status-indicator

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 5, 2026

Summary

Add distinct status indicators for different streaming phases:

  • 'Execute' when request is pending (waiting for first token)
  • 'Streaming..' when actively receiving tokens from the LLM

Motivation

Previously, both states showed 'Working' which didn't distinguish between waiting for a response and actively streaming one. This provides clearer feedback to users about the current state of their request.

Changes

  • Add is_actively_streaming field to StreamingState
  • Update status_header() to show different text based on streaming phase
  • Mark is_actively_streaming = true when first delta arrives

Testing

  • cargo check passes
  • cargo test passes
  • Manual verification of status changes

Add distinct status indicators for different streaming phases:
- 'Execute' when request is pending (waiting for first token)
- 'Streaming..' when actively receiving tokens from the LLM

This provides clearer feedback to users about the current state of
their request. Previously, both states showed 'Working' which didn't
distinguish between waiting for a response and actively streaming one.

Changes:
- Add is_actively_streaming field to StreamingState
- Update status_header() to show different text based on streaming phase
- Mark is_actively_streaming = true when first delta arrives
@greptile-apps
Copy link

greptile-apps bot commented Feb 5, 2026

Greptile Overview

Greptile Summary

This PR adds a new StreamingState.is_actively_streaming flag to distinguish the “waiting for first token” phase (Execute) from the “receiving tokens” phase (Streaming..). The flag is reset when streaming starts/stops, and is set when the event loop receives the first StreamEvent::Delta, which then drives MinimalSessionView::status_header() to render the updated status text.

Main thing to validate is that StreamEvent::Delta corresponds to real user-visible token output; if Delta can be empty/keepalive, the UI will incorrectly switch to Streaming.. before any content is shown.

Confidence Score: 4/5

  • This PR is safe to merge after addressing the Delta->active-streaming transition condition.
  • Changes are small and localized, but the new status transition currently triggers on any StreamEvent::Delta, which can misrepresent the UI state if deltas can be empty/keepalive or non-content.
  • src/cortex-tui/src/runner/event_loop/streaming.rs

Important Files Changed

Filename Overview
src/cortex-tui/src/app/streaming.rs Adds is_actively_streaming flag to StreamingState, resets it on start/stop, and exposes start_active_streaming() helper.
src/cortex-tui/src/runner/event_loop/streaming.rs Marks start_active_streaming() on every StreamEvent::Delta; needs guarding to avoid incorrectly switching to Streaming on empty/non-content deltas.
src/cortex-tui/src/views/minimal_session/view.rs Updates status header to show Execute vs Streaming.. based on new is_actively_streaming flag.

Sequence Diagram

sequenceDiagram
  participant U as User
  participant L as EventLoop
  participant S as StreamingState
  participant V as MinimalSessionView
  participant P as LLM Provider

  U->>L: "Submit prompt"
  L->>S: "start_streaming()"
  V-->>U: "Status shows Execute"

  L->>P: "Begin provider stream"
  P-->>L: "Delta arrives"
  L->>S: "start_active_streaming()"
  V-->>U: "Status shows Streaming.."

  P-->>L: "Done"
  L->>S: "stop_streaming()"
  V-->>U: "Status shows Idle"
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 305 to +308
match event {
StreamEvent::Delta(delta) => {
self.stream_controller.append_text(&delta);
// Mark that we are now actively receiving tokens (transition from Execute to Streaming..)
Copy link

Choose a reason for hiding this comment

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

Active-streaming flips too early

start_active_streaming() is called on every StreamEvent::Delta, but Delta can be an empty/whitespace keepalive (or other non-user-visible chunk). In that case the UI will switch from Execute to Streaming.. even though the user still hasn’t received the first token. Consider guarding this with something like if !delta.is_empty() / if delta.chars().any(|c| !c.is_whitespace()) (or using a dedicated “first content token received” event/flag from the streaming layer).

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cortex-tui/src/runner/event_loop/streaming.rs
Line: 305:308

Comment:
**Active-streaming flips too early**

`start_active_streaming()` is called on every `StreamEvent::Delta`, but `Delta` can be an empty/whitespace keepalive (or other non-user-visible chunk). In that case the UI will switch from `Execute` to `Streaming..` even though the user still hasn’t received the first token. Consider guarding this with something like `if !delta.is_empty()` / `if delta.chars().any(|c| !c.is_whitespace())` (or using a dedicated “first content token received” event/flag from the streaming layer).

How can I resolve this? If you propose a fix, please make it concise.

@echobt echobt merged commit a936194 into main Feb 10, 2026
15 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