Repository navigation
perf(session): coalesce family reads during subagent bursts - #229
Merged
Merged
Conversation
Every FamilyRefreshRequested (Home sends one per new subagent) cancelled the family read in flight, started it over, and relisted shells and jobs. Ten subagents starting at once walked the family ten times. Ports iOS #298 (fd33dc04, CoalescedRead): a family request while a read is in flight queues exactly one follow-up read. Only the last answer of a queued run sets familyReadAt, and leaving the screen forgets the queued read. Shells and jobs aren't family, so FamilyRefreshRequested no longer relists them; a new event stream (EventStreamConnected) does, so a reconnect still catches missed shell exits and job settles. Tests: ported aBurstOfSubagentsWalksTheFamilyTwice, onlyTheLastQueuedFamilyAnswerMakesItFresh, leavingTheScreenForgetsTheFamilyWalk and aNewStreamRelistsShells; the first three fail with the old FamilyRefreshRequested. The two reconnect job tests now reconnect through EventStreamConnected, as on iOS, and three reconnect tests stub the new lists. Verified: full scripts/check.sh on the Android VM passes.
Review fixes for coalesced family reads: - CoalescedRead is a plain data class. The Store drops a state equal to the last one, so the always-equal version lost the in-flight and queued flags and every burst restarted the read again (new store-level test). - A carried screen's Task resets familyRead when it cancels the family read, so a read cancelled there can't leave later requests queued forever. - A family answer that finds new members relists jobs, so a child's job that started before the child was known still shows. - Drop unused sessionFamily stubs in the reconnect job tests; fix the jobs file comment; exhaustive tests now expect the familyRead flags. Verified: the store-level test fails on the previous commit (2 reads, not 1); full scripts/check.sh on the Android VM passes.
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.
When several subagents start at once, each one restarted the session's family read and relisted shells and jobs, so a burst of ten walked the family ten times.
Now a family request during a read in flight queues exactly one follow-up read. Only the last answer marks the family fresh, and leaving the screen drops the queued read. Shells and jobs are relisted on a new event stream instead, and jobs also when a family answer finds a new subagent, so a child's early background script still shows.
Ports iOS anomalyco/opencode-ios#298 (fd33dc04,
CoalescedRead). Unlike iOS,CoalescedReadis a plain data class, because the Android store drops a state equal to the last one. Nothing visible changes.Verified with the four ported iOS tests (three fail on dev), a test that drives a burst through the real
Store(it fails with the always-equal version), a test for a new subagent's early job, and a fullscripts/check.shon the Android VM.