poll: return closed when the review ended before the poll started - #20
Open
BioInfo wants to merge 1 commit into
Open
poll: return closed when the review ended before the poll started#20BioInfo wants to merge 1 commit into
BioInfo wants to merge 1 commit into
Conversation
endSession only hands {"status":"closed"} to pollers already registered on
the entry key. The documented agent loop is apply-then-poll, so the poll that
follows a delivered batch usually starts after the human has already clicked
End review. That poll registers on a target nothing will ever close and blocks
for its whole --timeout.
The server now leaves an end mark in the store when the last session for a
target goes away, and /api/poll consumes it before registering a poller. The
mark is checked after the pending batch, so feedback the human already sent is
never hidden by it, and opening the target again clears it.
It is persisted rather than held in memory because the server idles out after
45 minutes, and a poll arriving after that would otherwise hang against a fresh
process for the same reason.
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.
The bug
endSessionhands{"status":"closed"}only to pollers already registered on the entry key. But the loopSKILL.mdprescribes is apply-then-poll, so the poll that follows a delivered batch normally starts after the human has clicked End review. That poll registers on a target nothing will ever close and blocks for its whole--timeout.Hit it live today reviewing a Markdown draft: poll returned a batch, I applied it, the reviewer clicked End review, and the next
poll --ackhad nothing to end it.Reproduction
Before: exits after the full 20s with
{"status":"timeout"}.After: exits in under 100ms with
{"status":"closed"}.The new test in
test/poll-handoff.test.jsasserts exactly this. Run againstmainit fails at 20,125ms; with the change it passes in ~2.1s. Full suite 91/91.The change
endSessionleaves an end mark in the store when the last session for a target goes away, and/api/pollconsumes it before registering a poller. Three ordering details:closedtwice. The test covers this.endSessionconsumes the mark for each poller it drains directly, so the two delivery paths cannot both fire.It is persisted rather than held in memory because the server idles out after 45 minutes (
IDLE_SHUTDOWN_MS), and a poll arriving after that would otherwise hang against a fresh process for the same reason. Verified by killing the server between the end and the poll: the fresh server answersclosedin 0s.No response vocabulary changed, so no
SERVER_PROTOCOLbump and agents need no update. Theclosedpayload moved to oneSESSION_CLOSEDconstant since two paths now send it.Notes
src/plus the test.