Skip to content

fix(chat): queue messages safely while sessions start - #79

Closed
loganj wants to merge 1 commit into
mainfrom
larry/queue-stack-flattened
Closed

fix(chat): queue messages safely while sessions start#79
loganj wants to merge 1 commit into
mainfrom
larry/queue-stack-flattened

Conversation

@loganj

@loganj loganj commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

🤖

Summary

New chats can now accept messages immediately while their backend session is still starting, without attempting to send those messages before the session is ready. Agent Builder messages follow the same rule: draft preparation waits for the final session identity, and removing or replacing the queued message cancels that preparation without leaving an orphan draft.

This is the one-commit merge vehicle for the reviewed stack #64#65#68#78. Those PRs remain open as the review record; this PR changes topology and attribution only.

Related issue

N/A — consolidates the four linked PRs.

Testing

  • The flattened commit tree is exactly 79491039b7b9c4c6f095e861e54c60543cb6a8de, byte-identical to gated stack tip 0385e40855d99e3668dc455772653611ede58839 (git diff --exit-code is empty).
  • The gated tip passed the full Vitest suite: 539 files, 6,309 passed, 1 skipped. PRs fix(chat): queue sends while sessions start #68 and fix(chat): cancel superseded builder preparation #78 were CI-green and passed independent exact-head review before flattening.
  • The flatten commit has one parent, stack base b0f489f053def3b93a25ffb1b63a703eb86dab5c, and preserves Chai Landau's and Morgan Martin's contributions through Co-authored-by trailers.
  • Current main has moved beyond that base. A local git merge-tree --write-tree origin/main 206e2277ec97f5a7083345d4a9dd189e0af23a6e completes without conflicts. No merge is authorized until Logan rules on merge semantics.

Known non-blocking note

The reviewed implementation guards both successful and failed asynchronous preparation with the same queue-record authority predicate. Regression coverage directly exercises successful preparation resolving after removal; it does not include the symmetric rejection-after-removal case. Exact-head review judged the shared guard sufficient and recommended avoiding churn to the green, gated tree.

Allow new chats to accept queued messages before backend creation finishes
without dispatching them early. Define the queue's acceptance and dispatch
contract, defer Agent Builder draft preparation until the final session ID
exists, and discard preparation when its triggering queue record is removed
or superseded.

Signed-off-by: Logan Johnson <loganj@squareup.com>
Signed-off-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
Co-authored-by: Chai Landau <chai@block.xyz>
Co-authored-by: Morgan Martin <98432065+morgmart@users.noreply.github.com>
Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
@loganj

loganj commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as superseded — this frozen flatten artifact predates the background-drain repair (its tree lacks commit e05a11e on #78) and the merge plan changed: the stack will be flattened by cascading merges (#78#68#65#64, then #64 → main) rather than via this commit-tree artifact. The four stacked PRs remain the review/merge vehicle.

@loganj loganj closed this Aug 18, 2026
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