Skip to content

fix(tui): avoid stuck QUEUED badges from orphan assistant messages#16907

Open
MaheshBhushan wants to merge 3 commits intoanomalyco:devfrom
MaheshBhushan:fix/16856-queued-stuck-from-orphan-assistant
Open

fix(tui): avoid stuck QUEUED badges from orphan assistant messages#16907
MaheshBhushan wants to merge 3 commits intoanomalyco:devfrom
MaheshBhushan:fix/16856-queued-stuck-from-orphan-assistant

Conversation

@MaheshBhushan
Copy link

@MaheshBhushan MaheshBhushan commented Mar 10, 2026

Issue for this PR

Closes #16856

Type of change

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

What does this PR do?

This fixes the stuck QUEUED badge when an old orphan assistant message exists in session history.

Before: pending used indLast over all messages for assistant entries missing ime.completed. If an older crashed/orphaned assistant message was still incomplete, pending pointed to it forever, so later user messages looked queued even when idle.

After: pending only considers the tail message, and only if it is an assistant message that is still incomplete and has no error.

Why this works: only the tail assistant message can represent current in-flight generation; historical orphan records should not drive live queued state.

How did you verify your code works?

  • Reproduced logic path by inspecting the current queued condition in UserMessage (message.id > pending).
  • Verified the new memo returns undefined when the last message is not an active assistant response.
  • Confirmed this prevents stale mid-history assistant records from setting global queued status.

Screenshots / recordings

Not included (small logic-only TUI state fix).

Checklist

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

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 10, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 10, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

QUEUED tag stuck on all user messages when an assistant message has null time.completed

1 participant