Skip to content

fix(app): avoid false follow-up queue after session becomes idle#18944

Open
Haohao-end wants to merge 1 commit intoanomalyco:devfrom
Haohao-end:fix/18713-followup-queue-stuck
Open

fix(app): avoid false follow-up queue after session becomes idle#18944
Haohao-end wants to merge 1 commit intoanomalyco:devfrom
Haohao-end:fix/18713-followup-queue-stuck

Conversation

@Haohao-end
Copy link

Issue for this PR

Closes #18713

Type of change

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

What does this PR do?

This fixes a follow-up queue bug in the app session page.

Before this change, follow-up queueing used a broader busy() check that looked at both:

  • session_status
  • whether an assistant message still had no time.completed

That created a short mismatch window where the session had already become idle, the UI looked finished, but the assistant completion metadata had not synced yet. In that case, a new prompt could be incorrectly queued instead of being sent immediately.

This patch narrows the queue decision to the authoritative session_status signal:

  • if follow-up mode is not queue, do not queue
  • if the composer is blocked, do not queue
  • if session_status.type !== "idle", keep queue mode active
  • if the session is already idle, do not queue even if assistant completion metadata is still lagging

The existing busy() logic is still kept for the other session flows that already depend on it, so this change only affects the false-positive queue decision.

I also added regression tests for:

  • idle + pending assistant completion -> should not queue
  • busy/retry -> should still queue

How did you verify your code works?

Tested locally with:

  • bun test src/pages/session/helpers.test.ts
  • bun typecheck
  • bun turbo typecheck

The new regression tests cover the queue decision directly.

Screenshots / recordings

N/A — this is a behavior fix for follow-up queueing, not a visual UI change.

Checklist

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant