feat(tui): honest status 'starting agent…' until session.info arrives

Post-async-session.create, `session.create` returns in ~1ms with partial
info and the real agent fires `session.info` ~1s later. Previously the
status bar went straight to 'ready' right after the instant RPC return,
which was misleading — `prompt.submit` would block server-side waiting
for the agent to finish building.

Now:
- `newSession`: status = 'starting agent…' when info has no `version`,
  else 'ready' (covers the fast resume path too)
- `session.info` event: flips status to 'ready' only if it was
  'starting agent…', preserving running/interrupted/error states
This commit is contained in:
Brooklyn Nicholson 2026-04-16 15:41:44 -05:00
parent a8e0a1148f
commit 04e36851b7
2 changed files with 13 additions and 1 deletions

View file

@ -165,6 +165,9 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:
patchUiState(state => ({
...state,
info: ev.payload,
// Flip from 'starting agent…' → 'ready' when the agent is live.
// Leave running/interrupted/error statuses alone.
status: state.status === 'starting agent…' ? 'ready' : state.status,
usage: ev.payload.usage ? { ...state.usage, ...ev.payload.usage } : state.usage
}))
// Agent init is async in session.create, so the intro message may