Repository navigation
The screen hook shares one pending start, a stop cancels it, and uploads wait for each other and for the server's backoff - #1825
Merged
Conversation
…hat cancels a pending start, and uploads that wait for each other and for the server's 429 Refs #1804. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…a stop cancels a pending start, and ticks wait for an upload in flight or a 429 pause (#1804) The screen hook takes the camera hook's loop guards. Concurrent starts share one pending start, so the picker opens once. Each stop advances an epoch that a pending start compares after the picker and after play(); a capture picked after a stop has its tracks stopped and sets no state, and a picker dismissed after a stop reports no error. A frame reads its epoch and session id before the encode and posts nothing when a stop came during it; an answer that arrives after a stop is not acted on. A tick returns while an upload is in flight, and each upload is aborted after 10 s. A 429 pauses the uploads for its Retry-After, else 1 s doubling up to 30 s, and a 200 ends the doubling; a 413 drops the frame. The exports keep their signatures. The new test file's marker becomes it. Refs #1804. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PROGRESS.md and DECISIONS.md entries; ledger regenerated. Refs #1804. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…measured for two rows, and DECISIONS.md records the campaign of record (#1804) The campaign of record ran the 14 rows on the M3 head: every mutant was killed, none survived. Rows W4 and W6 failed more cases than the contract named (15 and 3, where it named S4 and S6); the contract now lists the measured killers and why each extra case fails. Two line counts in its Verified Against Codebase section are corrected to the counts measured at the base (166 and 307). DECISIONS.md records the campaign. This commit changes the contract, DECISIONS.md and the two regenerated ledger files only; no source or test line changes. Refs #1804. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ves in flight and gains row W15, and DECISIONS.md records W15 (#1804) Review round 1 found that the contract said every held step is released by the test, while three cases (S6, S8 and S12) end with one upload still in flight. D4 and property 7 now say what holds: each case releases the steps its assertions wait on, and an upload left in flight is dropped with the fake clock. The deadline timer's clearing is checked by C3 to C5, so the contract gains row W15 (delete the clearTimeout), and DECISIONS.md records its run on the unchanged ui files. This commit changes the contract, DECISIONS.md and the two regenerated ledger files only; no source or test line changes. Refs #1804. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 17, 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.
Refs #1804
What changes
The screen hook takes the camera hook's loop guards.
ui/src/hooks/useScreenStream.ts(the only source file, +94/-6) never received the guards #1671 gave the camera hook:startScreenStreamcalls share one promise, so the picker opens once. Before, the second start overwrote the stream and the interval, and the first capture's tracks were never stopped.getDisplayMediaand afterplay(): a capture picked after a stop has its tracks stopped and sets no module or store state, and a picker dismissed after a stop reports no error. A start that no stop cancelled behaves as before.The exports keep their signatures and return shapes; the form fields (
file,session_id,source), the endpoint and the 503 handling are as before. UI only: no server, config, flag or persisted-state change.One new test file,
ui/src/hooks/__tests__/useScreenStream.bf973.test.ts(406 lines, 18 cases: 12 that fail on the base and 6 controls), uses vitest's fake clock only, so nothing waits on the wall clock. The rest of the diff is the contract (prompts/bf-973-screen-stream-guards.md, 968 lines),DECISIONS.md(+9),PROGRESS.md(+4) and the regenerated ledger pair.Six commits: the contract; M1 (the new tests, 12 of them
it.failsuntil built); M2 (the hook, and the marker becoming a plainit); M3 (the trackers and the ledger pair); and two review repairs, R1 (the contract's measured killers for rows W4 and W6, two line counts and the campaign record) and R2 (the contract's test-teardown sentence, row W15 and its record).Found by review and repaired on this branch
Round 1 (
gpt-6.1-sol, the whole candidate, 15 min) found the hook and every consumer sound and was NOT READY on one P3 about the new tests: the contract said every held step is released by the test, but three cases (S6, S8 and S12) end with one upload still in flight. I reproduced it (exactly those three leave one 10 s deadline timer after_testReset(); the other fifteen leave none) and checked the gap it points at: deleting the deadline'swindow.clearTimeoutis already killed by controls C3, C4 and C5. The Architect ranked a teardown that settles every held step against a wording change plus one mutation row, and chose the wording change: the leftover reaches no later case (each case installs a fresh fake clock andvi.restoreAllMocks()drops the held spy), and a new teardown would change the recorded campaign. R2 rewords D4 and property 7, adds row W15 to the contract and records its run. Round 2 (the delta, 10 min) verified all six of its properties and found nothing: READY.Limits recorded in the contract (section 6)
ProfileChatTab's cleanup stops the capture only whileactive; an unmount during the open picker does not cancel the pending start. Recorded as a Low item in the follow-up Follow-up: residual findings from the #1817/#1796 (BF-982, BF-965), #1803/#1806 (BF-972, BF-975), #1808 (BF-977), #1804 (BF-973), #1809 (BF-978) and #1807 (BF-976) waves #1820 (the app-root "screen live" indicator shows the capture and has a revoke button).screen disabled by server: ...and the stop that follows resets the error. Already tracked as the open item BF933-S1-L6 of Follow-up: residual findings from the #1722 / #1604 / #1723 / #1724 / #1736 / #1741 wave (reserves BF-954) #1754, which says "not run"; a comment there records the measured sequence of the store'serror,null, null, "screen disabled by server: screen_disabled", null, on the base hook and on this one._sessionIdafter its encode, so a stop during the encode posts the string "null". Already tracked as the open item BF933-S1-L5 of Follow-up: residual findings from the #1722 / #1604 / #1723 / #1724 / #1736 / #1741 wave (reserves BF-954) #1754; this change repairs only the screen hook's side.Review and the broad gate
Every review was a Diff Reviewer on
gpt-6.1-sol. The Architect drafted the contract and decided the round-1 repair and where the limits are filed; the Builder applied M1, M2, R1 and R2, each blob checked against a tool-applied oracle; the contract, M3 and the ledger pair were applied by tool.Broad gate, on
958309820318154496ee9aa4c151bedcb62ddcda: one run in the canonical wrapper at--workers 3:54111 passed, 184 skipped, 243 warnings, 7 subtests passed in 1:30:42, exit 0 (started 11:03Z). The receipt (logs/gates/screen-stream-guards.receipt.json) records 54,295 tests with 0 failures and 0 errors, binds this head and its treead27c6c29efc2f48102df519f894e31c56a48e6f, and validated four times (three after the run, once before the push). The live-data manifest was identical before and after the run (54,107 files). That is the same 54111 passed as the base's last gate: the change adds no Python test. A first run of the same head (started 10:02Z) showed one failure mark and was stopped at 70%, so its test was never named; this second run, on a host kept quiet for its whole length, is the record.Evidence
BF973_RUNXFAIL=1the 12 built cases fail at their own asserts and the 6 controls pass.ui/src/files are identical): every row killed, none survived, 13 by exactly the cases the contract first named; W4 (the cancelled start stays in flight, which fails every later case) fails 15 cases and W6 fails 3 where the contract first named one each, and the contract now names them. Round 1's reviewer replayed all 14 rows and got the same killers.npx tsc -bandnpm run buildexit 0; the gate wrapper's preflight-only exits 0; the ledger test passes (33).958309820318(python-tests-shard1, 2 and 3,python-testsandui-tests), 12:54Z.What this pull request does not do