Skip to content

Fix/tui duplicate event delivery - #236

Closed
tae9898 wants to merge 6 commits into
kingsword09:mainfrom
tae9898:fix/tui-duplicate-event-delivery
Closed

tae9898 wants to merge 6 commits into
kingsword09:mainfrom
tae9898:fix/tui-duplicate-event-delivery

Conversation

@tae9898

@tae9898 tae9898 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor
image

Problem

When a background task (backgrounded exec or a background agent) completes and the
runtime starts a notification turn, the streamed assistant response can render with
every token repeated N times — users have seen both 2× and 3× in the wild:

fix

onEvent now drops an event it has already processed — matched by eventId,
or by the delivered object itself — before anything is appended to the
transcript. Seen keys are kept in a bounded LRU (256). Distinct events never
share a key, so legitimate output is never suppressed.

The session-subscription channel is untouched (it does not append streamed
content). The runtime-side trigger — one notification starting two concurrent
turns — lives in the vendored runtime and is out of scope here.

tae9898 and others added 6 commits October 21, 2026 11:31
The runtime forwards every session event to each live subscription (the
active prompt, steers, and subscriptions held open while background-task
notification turns run), so one stream event can reach the TUI several
times. AssistantStream.append is not idempotent, so each redelivery
rendered again: after a background task completed, notification-turn
responses displayed every token once per delivery (e.g. three deliveries
rendered each syllable three times) even though the persisted transcript
stayed clean.

Drop exact redeliveries at the onEvent boundary: an event is skipped
when its eventId was already seen, or when the delivered object itself
was (subscriptions forward the same object reference). Distinct events
never share a key, so legitimately repeated delta content still renders.
The session-subscription channel is left untouched; it does not append
streamed content.
@tae9898
tae9898 marked this pull request as draft October 25, 2026 12:32
@tae9898 tae9898 closed this Oct 25, 2026
@tae9898 tae9898 reopened this Oct 25, 2026
@tae9898 tae9898 closed this Oct 25, 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