Skip to content

fix(sessions): keep queued messages in queue when cancelling#2706

Open
MattPua wants to merge 1 commit into
mainfrom
posthog-code/keep-queued-messages-on-cancel
Open

fix(sessions): keep queued messages in queue when cancelling#2706
MattPua wants to merge 1 commit into
mainfrom
posthog-code/keep-queued-messages-on-cancel

Conversation

@MattPua

@MattPua MattPua commented Jun 16, 2026

Copy link
Copy Markdown
Member

Problem

  • Cancelling (Stop) an in-flight message dumps all queued messages back into the input box as combined text — they lose queued state.

Change

CleanShot.2026-06-16.at.11.59.48.2.mp4
  • Stop now cancels only the in-flight turn; queued messages stay queued (still shown as cards, individually removable).
  • New queuePaused flag on AgentSession, set by cancelPrompt, suppresses the auto-drain on the cancel-induced turn-end.
  • Flag cleared on next user send, so kept messages resume after that turn.
  • handleCancelPrompt no longer drains the queue into the editor.

Notes

  • Resume is "on next send" — no new UI.
  • Footer (N queued) hides after Stop (only shows while pending), but queued cards stay visible.

Testing

  • shared / core / agent typecheck clean
  • sessionServiceHost (116) + sessionStore (10) tests pass
  • Biome lint clean

Created with PostHog Code

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit a4556a4.

@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(sessions): keep queued messages in q..." | Re-trigger Greptile

Stop now cancels only the in-flight turn. Queued messages stay in the
queue (shown as queued cards) instead of being dumped into the input.
A queuePaused flag suppresses the auto-drain triggered by the
cancel-induced turn-end event; it's cleared on the next user send, so
the kept messages resume then.

Generated-By: PostHog Code
Task-Id: 82344ce6-2b72-4bb3-b929-41cd17820f5e
@MattPua MattPua force-pushed the posthog-code/keep-queued-messages-on-cancel branch from fd9cdd1 to a4556a4 Compare June 16, 2026 15:59
@MattPua MattPua requested review from a team and charlesvien June 16, 2026 16:01
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