Repository navigation
fix(chat): preserve queued follow-ups while the active head loads - #9134
Open
mameikagou wants to merge 1 commit into
Open
mameikagou wants to merge 1 commit into
mameikagou wants to merge 1 commit into
Conversation
|
@mameikagou is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Preserve accepted chat follow-ups when their queued acknowledgements arrive before the client has loaded the active pending head. Previously, every acknowledgement replaced the queue-only cache with
[task], dropping earlier queued entries from local pending state.Thinking path:
queued: truecan arrive before the running head is available locally. The shared pending helper deliberately keeps such state headless until the pending query loads.queued_tasksloses earlier accepted entries; merging through the existingnormalizeQueuepreserves them with the same FIFO ordering, task-ID deduplication, and rich-preview preference as the existing loaded-head path.Scope: this fixes a deterministic frontend queue-state overwrite. It does not change backend scheduling, cancel/retry behavior, or claim that persisted messages were deleted. It has not established that every reported instance of a replaced message has this cause.
Related Issue
User-reported repeated chat queue replacement; no linked GitHub issue.
Type of Change
Changes Made
packages/core/chat/pending.ts: append queued acknowledgements to the existing headless queue and normalize, rather than replacing it. Preservesupports_queueand keep the active head unspecified until it is known.packages/core/chat/pending.test.ts: four regression cases covering sequential and reversed acknowledgements, late head acknowledgement, task-ID deduplication, sibling preservation, and rich/sparse preview observations in either order. Also declare the DOM-free Node test environment.How to Test
queued: true, then accept follow-up B withqueued: true. Before this fix the cached queue changes from[A]to[B]; after it the queue is[A, B]with no fabricated head. Reversing acknowledgement order produces the same FIFO queue.Verified locally: 10 test files / 320 tests pass; core typecheck, changed-file lint, and diff whitespace check pass. The four new regression cases all failed against the original helper before applying the fix. Dependencies were reused from an existing local installation; no dependency or lockfile changes are included.
Risks / verification limits: this reuses existing normalization semantics and only changes the headless
queued: truebranch. It was manually reviewed, but no browser E2E, real-provider smoke test, full-monorepo build, or deployment was performed. No server or daemon changes are included.Checklist
apps/web/features/landing/i18n/) and relevant docs (apps/docs/content/docs/) (not applicable)apps/docs/content/docs/developers/conventions.zh.mdx(terminology, mixed-rule fortask/issue/skill) (not applicable)AI Disclosure
AI tool used: Codex via Multica.
Prompt / approach: The user reported that sending additional chat messages before a response replaced earlier messages instead of queueing them, and requested an upstream PR. Inspected the send and pending-state paths, reproduced the shared helper's headless queue overwrite, added failing regression tests, reused existing queue normalization for a minimal fix, ran related core tests/typecheck/lint, and manually reviewed the two-file diff. No live chat messages or provider requests were used to test this patch.
Screenshots (optional)
No visual styling changes or browser screenshots. The reproducible queue-state trace is
[A] -> [B]before and[A] -> [A, B]after the fix.