Skip to content

fix(desktop): honor lineage when gating background queue drain - #70377

Closed
zapabob wants to merge 1 commit into
NousResearch:mainfrom
zapabob:fix/desktop-queue-lineage-busy
Closed

fix(desktop): honor lineage when gating background queue drain#70377
zapabob wants to merge 1 commit into
NousResearch:mainfrom
zapabob:fix/desktop-queue-lineage-busy

Conversation

@zapabob

@zapabob zapabob commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Treat compression lineage root and tip as the same conversation when deciding whether a background queue may auto-drain.
  • Skip drain when the selected or busy stored id shares lineage with the queue key, not only on exact string equality.

Why

Composer/queue keys prefer the durable lineage root (resolveComposerSessionKey), while `` / selected session may hold the live compression tip. Strict equality then mis-classified a busy or selected chat as idle/offscreen, allowing double drain or drain during an active tip turn — a session-bleed / wrong-transcript class bug.

Complements merged #66001 (originating-session drain) and lineage work around #43483. Deliberately does not duplicate open #66240 (restored-queue manual send).

Test plan

  • use-background-queue-drain.test.tsx lineage busy + tip-selected cases
  • Manual: compress a session with a queued follow-up; confirm background drain waits for the tip turn

Co-authored-by: Cursor <cursoragent@cursor.com>
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 23, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused regression fix. Current main still uses strict equality for the selected and busy gates in apps/desktop/src/app/session/hooks/use-background-queue-drain.ts:161-165, while resolveComposerSessionKey deliberately scopes queues to the lineage root in apps/desktop/src/store/session.ts:203-213. The proposed lineage predicate addresses that mismatch, and the added busy-tip and selected-tip tests cover both affected gates.

No substantive correctness issue found in this focused change. This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 30, 2026
@zapabob

zapabob commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Current official main already implements this exact fix in c9de69c: the background drainer uses idsShareLineage for both selected and busy gates, and the official commit includes the busy-tip and selected-tip regression tests from this PR. A rebase produces only an implementation-overlap conflict, so there is no remaining delta to carry. Closing as implemented on main without rewriting the contributor branch.

@zapabob zapabob closed this Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants