Skip to content

fix(tui): handle session.error events in global sync - #48606

Open
OmarAlaaeldein wants to merge 1 commit into
anomalyco:devfrom
OmarAlaaeldein:fix/tui-session-error-sync
Open

fix(tui): handle session.error events in global sync#48606
OmarAlaaeldein wants to merge 1 commit into
anomalyco:devfrom
OmarAlaaeldein:fix/tui-session-error-sync

Conversation

@OmarAlaaeldein

Copy link
Copy Markdown

Issue for this PR

Closes #48530

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

In the terminal TUI, when a session encounters an error and the server emits a session.error event, the global sync reducer in packages/tui ignored it. As a result:

  1. session_status[sessionID] remained permanently stuck in busy mode with an unending progress spinner.
  2. The last assistant message was never updated with an error marker or finish: "error".

This PR adds a session.error handler in packages/tui/src/context/sync.tsx (the terminal counterpart to #48534 for packages/app). When session.error is received:

  • session_status[sessionID] is reset to { type: "idle" }.
  • The last assistant message in the session is marked with the error payload and finish: "error".

How did you verify your code works?

  • Added unit test in packages/tui/test/cli/cmd/tui/sync.test.tsx asserting that session.error resets the session status to idle and marks the assistant message error and finish state.
  • Ran bun test test/cli/cmd/tui/sync.test.tsx (3/3 pass).
  • Ran bun run --cwd packages/tui typecheck (tsgo --noEmit passes with 0 errors).

Screenshots / recordings

N/A (TUI state reconciliation)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

When a session fails and emits session.error, the TUI global sync
reducer was ignoring it, leaving session_status in busy mode and the
last assistant message without an error marker. Handle session.error
by resetting session_status to idle and marking the assistant message
error with finish: "error".

Closes anomalyco#48530
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Related PR found:

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.

session.error events are ignored by global sync (stuck busy, no error shown)

1 participant