Drop board snapshots that arrive out of order
Les mainteneurs répondent en général sous 1 jour
@AchlysChang y travaille déjà.
Depuis le 19/11/2026.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 77/100
Piste de recherche
Start at livekit::board::record and trace how the browser sends board streams and how HintAttempt.board_revisions uses recorded revisions. Then read tests/unit/livekit/board.rs and add the reverse-order delivery case described in the issue. Done means the older snapshot is dropped and the test observes one revision.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Board snapshots reach livekit::board::record (src/livekit/board.rs:469) in the order their readers finish, not the order the browser sent them. Each byte stream is drained on its own spawned task (handle_board_event, src/livekit/board.rs:333) and the finished boards enter the room loop's queue in whatever order those tasks call tx.send. The browser sends one board at a time (board.publishing in web/interview.js, uploading in web/example-board.js), so the agent sees two streams back to back rather than overlapping, but with two drain tasks on a multi-threaded runtime the later stream can still finish first. record compares a board only with the previous one, so the older board is then taken as a new change: HintAttempt.board_revisions (#707) counts it, a Candidate-led hint held for lack of an attempt can be released by a board the candidate drew before the clue, and the interviewer and read_board are left on the older drawing.
Proposal
Number every board on the wire and have the agent drop a board that is not newer than the last one it recorded from the same page.
Where the sequence goes on the wire
boardStreamOptions (web/lib.js) already takes the sequence the page keeps (board.sequence in web/interview.js, st.boardSequence in web/task.js) and puts it only in the stream name, board-<n>.jpg, which the agent does not read. The proposal adds it to the stream attributes as sequence, a decimal string, beside strokes and checkpoint, because the attributes are the only part of the header the agent reads (strokes_from_attributes and checkpoint_from_attributes, src/livekit/board.rs:302 and :313). A new sequence_from_attributes reads it the same way, at the same place in handle_board_event, and BoardSnapshot carries it to record. The name keeps the number for logs.
A page reload
board.sequence starts at 0 on every page load, so after a reload the new page's boards are numbered below the old page's and would all be dropped. The ordering therefore has to restart with the page. Resetting the agent's last sequence when the candidate's participant reconnects is not enough on its own: a board the old page finished sending can still be waiting in the queue when the reconnect is handled, and recorded after the reset it would set the last sequence high again and drop the new page's boards until it caught up; the reset would also need a hook in each of the three room loops that read boards (src/livekit.rs, src/livekit/recovery.rs, src/livekit/tasks.rs). Instead the page generates a random id once per load and sends it as a second attribute, page, and the agent compares sequences only within one page id. A board from a different page id than the last one recorded starts a new page and is recorded; a board from the page id that was just replaced is dropped, which covers an old page's board that finishes after the new page's first one. The id is an opaque random string, not a timestamp, so no clock on either side is involved, and a client that lies about it can only cause its own boards to be dropped or kept.
What record does with a dropped board, and with one that carries no sequence
A dropped board changes nothing: not board_snapshots, hint_attempt.board_revisions, board_strokes, board_drawn, last_board_at_ms, latest, unsent or the phase checkpoints, and record returns false as it does for an unchanged board. The same check runs in keep (src/livekit/board.rs:501), the variant for a room with no interview state, and in keep_board in src/livekit/tasks.rs, which currently copies the stroke count before calling keep and has to make that copy only for a board that was kept. A dropped board is logged once to stderr with both sequences.
A board whose sequence or page is missing or does not parse is recorded exactly as today and does not move the last sequence. That follows the rule strokes_from_attributes already states: the picture is the message, and a board is still worth showing when an attribute beside it did not survive. Only a client that is not the browser sends such a board, and it can only lose ordering for its own boards.
Wire fixture and tests
tests/fixtures/board-stream.json is generated from boardStreamOptions by scripts/gen-wire-fixtures.mjs and read by reads_the_attributes_the_browser_sent (tests/unit/livekit/board.rs:136). Regenerating it puts sequence and page on its three cases, and that test also asserts the sequence and page each case parses to, so a browser that renames or stops sending either attribute fails there. The page id in the fixture is a fixed string passed in by the generator, so the fixture stays deterministic. tests/browser/lib.test.js asserts the new attributes in its boardStreamOptions case. Unit tests in tests/unit/livekit/board.rs: two boards recorded newest first count one revision and leave the newer image as latest; a board from a new page id after a high sequence is recorded; a board from the replaced page id after that is dropped; a board without a sequence is recorded and does not move the last sequence; and keep drops a stale board the same way.
The comment in web/interview.js
The comment on board.sequence says the agent reads the name for nothing, deliberately, and keeps the newest board it finished reading rather than the highest number. That is the behavior this issue changes, so the comment is rewritten to say the number is now on the wire as sequence and the agent drops a board numbered at or below the last one from the same page, while board.publishing remains what keeps the page itself from opening two streams at once.
Contract
This changes no prompt, score anchor or report shape, so per docs/interview-contract-versions.md ("Changing it") it opens no bundle and adds no row. The board_image wire description in docs/task-mode.md names the stroke count as the stream's attribute, so it gains sequence and page and the drop rule.
Out of scope
Run results and other packets travel on the reliable data channel in order and are not affected. Who sends a board and how large it may be stay as they are.
- Langage dominant
- Rust
- Étoiles
- 236
- Forks
- 153
- Merge moyen
- 1 j 9 h
- PR mergées (30 j)
- 187
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de sysprog21/codetrial
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
Unify Java harness validation error messagesPeut-être pris @weichieh0204 l’a pris aujourd’hui. Ouverte
sysprog21/codetrial#872 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Inferred void class operations are never checked against the starter's return typePeut-être pris @papaya0112 l’a pris aujourd’hui. Ouverte
sysprog21/codetrial#871 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Edge Thumbnail Store accepts a store that does not refresh a key on overwritePeut-être pris @BOBOGUAGUA428 l’a pris aujourd’hui. Ouverte
sysprog21/codetrial#869 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de sysprog21/codetrial
Issues similaires
-
BUG: WebGPU finds no adapter on Linux when a DRM card has no vendor file (ONNX Runtime 1.24.4)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
CyberTimon/RapidRAW#2303 ·
Les mainteneurs répondent en général sous 1 jour
-
[bug] NSIS installer reads its flags from $CMDLINE, so an unquoted forward-slash path (e.g. C:/Projects/...) triggers passive mode and skips the licence pagePeut-être pris @YusufMntm l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
tauri-apps/tauri#16660 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
manaflow-ai/cmux#59692 ·
Les mainteneurs répondent en général sous 1 jour
-
Retire stale Python-parity labels in Rust ingress and auth testsPeut-être pris @github-actions l’a pris aujourd’hui. Ouvertefactory factory:building factory:unowned ralph-status:in-progress via:opencode-free/hy4-flash-free
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
JoshCLWren/comic-pile#5874 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
status:ready unit
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
nonagenticai/conveyor#787 ·
Les mainteneurs répondent en général sous 1 jour