Repository navigation
Lab channel: write Lab/state.json for the lab server (#131 Slice 1) - #481
Merged
Merged
Conversation
The lab channel now writes Lab/state.json beside the legacy Lab/state, version 1 of the lab server's app_state contract (fork #478): instance UUID, pid and profile, panel, program state, the last start or stop and where it came from (ui, lab with the request's id, program, error), the controller, the newest video frame's sequence and capture time, and unknown observations. It is rewritten at every poll as a heartbeat; the legacy file is unchanged. A request may carry the lab server's id on a "request <uuid>" line. LabTransitionTracker names the source of each start and stop from the program's state changes; LabConsoleCommands gains video() so the channel can count frames. Tests: LabStateJson checks the writer against the contract's goldens byte for byte, and the transition sources; LabChannel covers the request id and the UUIDs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…lice 1) "snapshot LABEL [TIMEOUT_MS]" waits for the first frame of the selected console's video that arrives after the line starts, saves it as <request>_<LABEL>.png and prints its instance id, frame_seq and capture time, the same numbers Lab/state.json uses. It reads only: no owner token, and no program state or controller check, so it works on a stopped panel with no controller. No newer frame in time fails the line with "snapshot timeout ..."; no video, a panel change, app shutdown or a failed save fail it with "snapshot unavailable ... reason=...". LabFrames takes over the frame counting from LabChannel's listener and keeps a frame only while a snapshot waits for one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine
added a commit
that referenced
this pull request
Nov 14, 2026
shot now sends `snapshot frame <timeout_ms>` at once and returns the exact frame_seq / captured_at from the `snapshot saved` line. The panel and controller refusals are gone; the app's timeout and unavailable replies map to timeout, video_stale and app_unavailable (evidence.reason), and a reply from another instance is instance_replaced. Only the expected outbox path is opened. The fake app answers snapshot requests as LabChannel does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine
added a commit
that referenced
this pull request
Nov 14, 2026
Moves the seven open questions to settled with their recommended answers, writes the nine answers from the 2026-11-14 implementation review into the resources, lease, tool and slice text, corrects the legacy Lab/state fields and what 7c44e72 does, and records Slices 0-3 as built (#478, #481, #482, #483) and Slice 4 as approved on PokemonAutomation#1881's branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
This was referenced Nov 14, 2026
dayfine
marked this pull request as ready for review
November 15, 2026 00:16
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.
Follows #131 Slice 1 (app observation seam). Base:
lab/tooling(#107); the diff shows only this change. Contract: #478'sapp_stategoldens at ff209b3.The lab channel now writes
Lab/state.jsonbeside the unchanged legacyLab/state, so the lab server (#478) has a versioned state to read: instance UUID, pid and profile, panel, program state, the last start/stop and its source (ui,labwith the request id,program,error), controller, the newest frame's sequence and capture time, andunknownobservations. It is rewritten at every 500 ms poll as the heartbeat. Program code is untouched; the seam isLabChannelplus one newLabConsoleCommands::video().A new channel command,
snapshot LABEL [TIMEOUT_MS], gives the server a frame newer than its call: it waits for the first frame that arrives after the line starts (100 to 60000 ms, default 5000), saves it as<request>_<LABEL>.pngand printssnapshot saved instance=<uuid> frame_seq=<n> captured_at=<time> after=<n> path=<path>. It needs no owner token, program state or controller, only the panel's video. Otherwise the line fails after printingsnapshot timeout instance=<uuid> after=<n> timeout_ms=<ms>orsnapshot unavailable instance=<uuid> reason=no_video|panel_changed|app_closing|save_failed. The contract has no document for a shot result yet, so these lines are the channel's format (Lab.md).Where #131's doc and #478 differ, this follows #478's goldens; other choices for #131's owner:
channelobject (last_request,last_error,owner_claimed) andinstance.profile: in the goldens, not in the doc's example. Written as the goldens have them.request <uuid>header line to request files (Lab.md); a request without one gets an app-made UUID, sincesource: labneeds a non-null id.ui. Instead the channel listens to the program's state changes and marks its own start/stop on the UI thread just before calling it, so anything else (the Start/Stop button, the Discord integration's stop) reads asui. No change toProgramSessionor the widget.frame_seq: the doc says thread the video cache's sequence. The cache's counter is private to the camera backends, so this counts frames atVideoSession's frame listener: per app instance and increasing, but not the cache's number.program=is empty for a non-program panel; the app writes that panel's identifier, and this keeps it (byte-compatible).panel.idinstate.jsonisnullfor those.video.stateisliveup to 2 s after the newest frame (shot's defaultmax_age_ms).pausedis supported by the writer but not written:lab/toolinghas no breakpoints.(instance, seq)changes (needs console B).Testing: new
CommonFramework::LabStateJsonunit tests check the writer against the threeapp_stategoldens byte for byte (copied into the test from #478), plus field mapping, video state and transition sources;CommonFramework::LabChannelgains request-id and UUID tests; newCommonFramework::LabSnapshottests cover the snapshot's arguments, its wait for a newer frame and its reply lines. Compiled the touched files locally and ran these tests in a scratch driver; fork CI runs the full build and suite.🤖 Generated with Claude Code
https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss