Keep sessions through a network blip; wait for GSA labels across messages - #312
Merged
Merged
Conversation
A regression from #309, found driving a network drop in a browser: Chainlit calls on_chat_end on every disconnect, a brief blip included, and keeps the session for session_timeout so a reconnect resumes it. The cleanup #309 put there deleted a guest's conversation, offers and waiting matrix on every blip. It now waits out the timeout and runs only if the session is really gone. Checked both ways in a browser: an offer made before a 10s network drop is still there after it (FAIL with the cleanup at disconnect, PASS now). The GSA grouping question no longer blocks on AskUserMessage, which is tied to the socket open when asked: a reconnect left it waiting on a dead socket, the reader's labels went to the model, and ten minutes later the chat said no labels had arrived (review, area 2). The checked matrix now waits (gsa.pending, 30 minutes, one per session), and the next message that reads as labels runs it; anything else is answered as usual. A reply that is not usable labels keeps the matrix waiting. Checked in a browser against the recording ReactomeGSA stand-in: labels sent after a 10s network drop start the analysis and the table arrives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A regression from #309, now on beta
Chainlit calls
on_chat_endon every disconnect, including a brief network blip, and keeps the session forsession_timeoutso a reconnect can resume it. The cleanup #309 added there deleted a guest's conversation, offers and waiting matrix on every blip.Fix: the cleanup is scheduled to run after
session_timeoutplus 60s, and only ifWebsocketSession.get_by_id(sid)is gone by then.Checked in a browser (
~/chat-uitest/drop_offer.py): make a gene-list offer, drop the network for 10s, then type "yes".An earlier version of this check asked the model to recall a code word. It was unreliable: the model sometimes refuses that kind of request, whatever its memory holds. So it was replaced with this deterministic one.
The GSA grouping question (review, area 2)
AskUserMessageis tied to the socket that was open when it was asked. After a reconnect, the reader's labels went to the model, and ten minutes later the chat said no labels had arrived.Fix:
gsa.pending(30 minutes, one per session).chat.looks_like_labels) runs it.run_analysisis kept, built from the newreceive_matrixandrun_with_labels.Checked in a browser:
run_flow.pywith the recording ReactomeGSA stand-in, plus a 10s network drop before the labels. The analysis starts and the 2,679-row table arrives. Without the drop it also passes.Tests
tests/gsa/test_gsa_pending.py: waiting, taking once, replacing (deletes the old file), re-storing the same matrix (keeps its file; the sabotage of this is caught), expiry, dropping, and what counts as an attempt at labels../checks.shpasses.🤖 Generated with Claude Code