Repository navigation
fix(server): keep a finished worker's callback channel open for its last report - #245
Merged
Merged
Conversation
…ast report A worker often sends its final report just after Prime ends its tab. The gateway closed the tab's callback channel immediately, so that report hit a closed channel and was lost. The channel now closes ten minutes after the tab goes terminal; until then a report on it reaches Prime through the relay's existing fallback for a channel whose tab is gone.
Hargun3
marked this pull request as ready for review
December 4, 2026 09:45
EdwardGallant
approved these changes
Dec 4, 2026
morgan-wowk
approved these changes
Dec 4, 2026
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.
Description
When Prime ends an external worker's tab, the gateway closes the tab's callback channel right away. Workers often send their last report a moment later, so that
send_to_primegets a 404 (unknown channel), the client shows "session not found", and Prime never sees the result.The relay already knows how to deliver a report from a channel whose tab is gone (see the "falls back rather than losing the text" test in
relayReport.test.ts). It just never got the chance, because the channel was already closed.This keeps the channel open for ten minutes after the tab finishes, then closes it. The rest of
retire()(roster entry, queued deliveries) is still released immediately.How to test
pnpm --filter @tangent/server testpasses (867/867). The updated gateway test fails if the channel is closed immediately again.completed, then callsend_to_primeon its channel. On main this returns 404; on this branch it returns "Delivered to Prime."Notes
detachedtabs keep their channel, as before.