Repository navigation
egocap: required devices, studio correction in place, calibration provenance and a live check - #1639
NVshawnhwang wants to merge 3 commits into
Conversation
…venance and a live check Start of day - A station can require its tracking devices: headset, each controller, each glove. A required device that is not delivering data fails its setup item and holds recording, with the reason. A station that requires nothing behaves as before, and a requirement the software does not know fails closed. While the saved stations file cannot be read, recording is held until it is replaced from the Station tab. - A camera that arrives over LiveKit passes its setup item only while an operator's page reports frames arriving in its preview; otherwise it warns. A page's word never holds a take. End of day - A session's studio can be corrected in place: the label is rewritten in every finalized take, the session's own record and the time-aligned copy, and the files stay where they are. The day's report and counts read the corrected label. - A correction of either label checks every file before its first write and puts back what it wrote if a later write fails. It takes the recorder's own session lock, and is refused while a take whose filing depends on the labels is not settled. Calibration - Each calibration file states what produced it, the grade and rule it was installed under, and what it replaced. Files without these keys read as before; a file in a newer layout is refused by every reader, the time-aligner included, and such a take is aligned once the software can read it. - The headset tool can check the installed head calibration live, without solving or recording: with the board still and the head moving it reports the error in pixels and grades the camera offset and lag the views imply, once the head has turned about two axes. For a camera that arrives over LiveKit the backend joins the video room for the length of the check only. - Before a calibration take, a note says when the camera's picture size differs from the installed lens file's. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Shawn Hwang <shhwang@nvidia.com>
…ure checks The end-of-day label corrections, a station's required tracking devices and the calibration follow-ups were built without the capture checks. This joins the two where each had settled the same thing, keeping one authority for each. The session lock. A correction took the recorder's lock class, which now writes a marker once a second for as long as it is held. A correction, refused or made, therefore left a recorder's marker in the session's lock file: the reader of takes left behind took the session for open, stopped listing its waiting takes and refused Recover and Discard for a watch time. A correction now asks the recording coordinator (hold_closed_session, which is OutputScan.held_closed): the session's marker unchanged between two looks a watch time apart, then its lock, held by SessionHold, which has no marker and writes nothing. A session a recorder has by its lock or by its marker is refused. What the reader knew of the session before the hold is what it knows after, so a correction is taken for a recorder only while it holds the lock. The lock file is opened without following a link and judged by what was opened. Takes that wait. takes_left_behind is the one rule for which takes wait, used by the page's list and by the correction's guard. A take whose discard was started still holds a correction; a take rejected with its data kept is settled and holds none; a folder that holds a record written for another session is refused in a sentence of its own; a take still to be set apart holds a correction of its session's quarantine folder. The refusal names the card that offers Recover and Discard. Take records. scan_session is the one reader of a session's records. A sidecar that cannot be listed is a problem, never an empty session, and such a session is not remembered as finished. Every line is in fixed words: no path, and nothing the system said. The day report reads a quarantined take's studio from the folder it was set apart in, which a correction of the session does not reach. The end-of-day dialog keeps focus when the last waiting take's card leaves it. Tests cover each place where the two meet: the hold and the rule in the recorder's own suites; corrections over the real coordinator against an open session, a waiting take and the page's two commands; a required device and an unreadable stations file refusing Record and a tool's take in one sentence; a tool's take held only by its own devices and kept unjudged; the aligner's two rules on one session; where a quarantined take, a corrected group and a recovered take end; the dialog with the card and both forms. Expectations that were sentences the other side replaced are compared with the new sentences, exactly. The READMEs, the design and the agent rules say the same. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Shawn Hwang <shhwang@nvidia.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
🤖 Agent-generated (Claude Code · claude-sonnet-5-5) Summary This PR does six things at once: required tracking devices on a station, a LiveKit "frames arriving" item on the start-of-day checklist, an in-place studio-label correction for finished sessions, calibration provenance keys in every calibration file, a live check of the installed head-camera calibration, and a note when the camera's picture size differs from the lens file's. I read all non-test source. The label-correction write path is carefully built: every file is read and checked before the first write, each file is replaced through a temporary file and synced, a failed write puts the earlier ones back from the bytes found, and the correction runs under both the in-process session lock and the recorder's own lock. I could not find a way for a failed correction to lose data. The remaining risks are contract questions (what the new keys and the label/folder split mean for other readers) and the amount of machinery for the problem. I read the code and did not run the tests or the live check. Suggested split. The six features share almost no code and have different risk. Separate PRs would review faster: (1) required devices and the checklist items, (2) the studio correction with its locks and refusal rules, (3) calibration provenance and the newer-layout refusal, (4) the live check, (5) the picture-size note. Legend: 🚫 Blocker · 💡 Suggestion · 🔍 Nit
Questions for Shawn
Actionables (for bots — copy-paste-ready for AI)
|
gareth-morgan-nv
left a comment
There was a problem hiding this comment.
🤖 Agent-generated (Claude Code · claude-sonnet-5-5)
Approved. Please address the comments in my review as you see fit.
…egocap_day_followups Both sides added tests of the watched LiveKit source; both are kept. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Shawn Hwang <shhwang@nvidia.com>
NVdejung
left a comment
There was a problem hiding this comment.
🤖 Automated first-pass review (Claude, for Dejun) — I'll follow up personally where needed.
Summary — This PR adds six things:
- per-station required tracking devices;
- an in-place studio correction for finished sessions. It runs under the recorder's own lock, with a guard for unsettled takes, and either fully succeeds or puts everything back;
schema_version/provenancein every calibration file, with every reader refusing a newer layout;- a live check of the installed head calibration, which joins LiveKit only while it runs;
- a LiveKit preview row on the checklist, reported by the page;
- a note when a camera's picture size differs from its lens file.
I read every non-test source change and found no blocker. The live check's room join and yield to a take hold up, and so do the correction's locks and put-back. Tests (about 9k lines) and the maths in live_check.py were only skimmed, and I ran nothing, so my confidence is moderate to high. The earlier review's suggestion to split the PR still stands and is not repeated here.
Must fix
None found.
Internal-name scan: no HARD hits. The two SOFT hits (tests/backend/test_setup_routes.py:323, :377) are a generic private placeholder address in a test fixture. The same file already uses it. It is not internal, so no action is needed.
Suggestions
backend/egocap_web/calibration_service.py:1964— The shared install moment is now taken beforestation_store.installholds the directory.station_store.py:385says exactly this must not happen. If a command-line install races the page, one can be stamped (valid_fromand archive name) earlier than the file it supersedes, so asupersedeschain can run backwards in time. This is rare. The fix is to take the moment under_exclusivefor a multi-file install, or at least update that comment.backend/egocap_web/session_locks.py:26—acquire()now callsos.staton the directory.auto_align.py:181calls it on the event loop every 0.2 s while a correction holds the lock. A stalled recordings mount would then likely block the loop that carries capture frames. Compute the identity in theto_threadthat already resolvesgroupand pass it in.backend/egocap_web/day_report_routes.py:321— If a group's stamp has an empty or missing session part, its owner resolves to the recording root. The recorder hold, the unsettled-take guard and the route drop then quietly do nothing. No recorder writes such a stamp, but everything else here fails closed, so refuse it with_NOT_A_SESSION.frontend/src/StationsCard.tsx:353— While an unknown stored requirement is still ticked, any other tick sends it back.stations.py:140then refuses the whole save, and nothing tells the operator to untick it first. Either let an update keep names already stored on that station, or say so in the editor.- Comments that no longer match the code:
stations.py:132says "None for none", but the function returns().StationsCard.tsx:66says "Null when…", but it returns[].recording/README.md:188says the route callsupdate_session_studio(). It actually callsplan_session_studio()thenapply(), with the route drop in between.livekit_sightings.py:7,livekitSightings.ts:9andCameraGrid.tsx:197still say the backend joins the room only during a take. It now also joins during a live check.
- Some deliberate behaviour changes affect existing stations with no config change, so they deserve a line in the upgrade notes:
- An unreadable
stations.jsonnow holds recording (station_service.py:115). - Every LiveKit camera row now warns unless a page that has the control token is in view (
setup_checks.py:237). - Offline
update_episode_task_description()now raises on a badconfig.yamlinstead of skipping it (:101). - The launcher (
tools/start_system.py) now refuses a lens file written in a newer layout (files.py:171).
- An unreadable
Conflicts
- With
nvShawnHwang/egocap_quality_control: 0 commits behind and the local 3-way merge is clean, so no rebase is needed. This PR is stacked on#1638, so it lands after that one and after#1634–#1637. - With open PRs:
#1634–#1638(stack parents) and#1640–#1646(stack children), all by NVshawnhwang: no textual conflicts.#1644(NVshawnhwang, S3 upload), semantic: it should read the studio throughsession_studio(), per the new AGENTS.md rule. It also needs to decide what a later in-place correction means for a session that was already uploaded, and whether an upload may read a session while a correction holds it.#1586(gareth-morgan-nv, basemain, conflicts not computed): shareslivekit_recording.py,capture_status.py,recording_session.pyandapp.py. Its per-session camera delivery test and this PR's page-reported row judge the same LiveKit camera, and this PR also changesLiveKitRecordingSource.stop()/stage. Agree which signal decides the row; whichever PR lands second rebases.#1625(Yunjuliii, draft, basemain): its wrist calibration tools must stampprovenanceand callrefuse_newer_layoutforwrist_calibration_offsets.json. Its gloves must also report under/hand/<side>, ortracking_device_kindwill not recognise them.#1591(fvaloppi-nv, basemain): shares onlytest_episode_store.py, so the risk is trivial.
Change-by-change (114 files)
| File / area | What changed | Makes sense? |
|---|---|---|
AGENTS.md, DESIGN.md, CALIBRATION_TOOLS.md, LIVEKIT_PREVIEW.md, backend/README.md, frontend/README.md, recording/README.md, recording_service/README.md |
Contracts for required devices, studio correction, provenance and the newer-layout refusal, the live check and preview reports; "not verified on hardware" sections | ✅ thorough; recording/README.md:188), and some API-table cells are now very long. Skimmed, not read line by line |
backend/egocap_web/app.py |
Wires LiveCheckService/VideoRoom and LiveKitSightings, connects before_join to yield_to_take, adds reported devices, closes the check at shutdown |
✅ |
auto_align.py, recording/tools/align_episode.py, recording/.../aligned_writer.py |
NewerLayoutError gives exit 3, which is retried at every start with no .refused marker |
✅ |
calibration_check.py (new), calibration_check_pictures.py (new), calibration_routes.py |
Live check: start/poll/stop, 20 s lease, 10 min cap, yields to a take; LiveKit pictures come through the recorder's own source | ✅ the lock, watcher and yield timeout read correctly |
calibration_frames.py, livekit_receiver.py, livekit_recording.py |
DecodedFrame.capture_time, NotingIngress, before_join; the room is left in a finally; stage reports join progress |
✅ stop() stays idempotent, so a double leave is safe |
calibration_service.py, calibration_common.py, glove_offset_session.py, capture_status.py |
TOOL_DEVICES, picture-size notes, video_room, layout problems, unchanged ledger rows, one install moment; file_holds ignores validity; glove fits recorded in provenance |
✅ / |
day_report_routes.py |
POST /api/day-report/studio; recorder hold, unsettled-take guard, route drop and put-back, left_changed |
✅ / |
recording_session.py, recording_service/{__init__,output_scan,recording_service}.py, episode_layout.py, route.py |
held_closed + SessionHold (flock, no beat); takes_left_behind as the single rule for which takes wait; an unlistable sidecar is reported; forget_group |
✅ thread-safe through _guard |
session_locks.py |
Locks keyed by (dev, inode) | |
livekit_sightings.py (new), setup_routes.py, setup_checks.py, setup_service.py |
Page preview reports; required-device rows that fail closed (only CALIBRATION_FAILED counts as delivering while degraded); newer-layout files; evaluation keyed by requirements; calibration takes ignore devices their tool does not use |
✅ |
stations.py, station_service.py |
required_devices (strict on the wire, lenient and round-tripped from the file); an unreadable registry holds recording; unreported_devices |
✅ / |
App.tsx, CameraGrid.tsx, LiveKitCameraTile.tsx, livekitSightings.ts |
Each tile's sight is reported every 2 s while the page is in view and has the token | ✅ (stale comment) |
CalibrationRecorder.tsx, HeadsetCalibrationDialog.tsx, calibrationApi.ts, calibrationTypes.ts |
Live check card, picture-size note, "already installed" ledger line | ✅ |
StationsCard.tsx, stationsApi.ts, DevicesTab.tsx |
Required-devices editor and warnings; "Advisory" note on warning rows | ✅ / |
WrapUpDialog.tsx, dayReportApi.ts |
Studio form and column, CorrectionRefused.leftChanged, focus kept in the dialog |
✅ |
styles.css, *TestDoubles.ts |
Styles and fixtures | ✅ |
analytics/count_daily_trajectories.py, analytics/day_report.py, studio/session_studio.py (new) |
Studio is read from the session's metadata first, with the folder name as fallback | ✅ |
calibration/provenance.py (new), files.py, grading.py, camera_pipeline.py, station_store.py, wrist_offset.py |
Provenance stamp; every loader refuses a newer layout; valid_from/supersedes; a no-op reinstall is noted as unchanged |
✅ / |
calibration/live_check.py (new) |
Fixes the board's position from still views, then measures the prediction error per picture; least-squares estimate of camera offset and lag; rules for when a verdict is given | ✅ skimmed; thresholds match the doc table |
data_processing/update_episode_task_description.py |
Task correction is checked in full before any write, studio plan/apply, put-back verified from disk, cleanup of stray staging files | ✅ |
| Tests (39 Python, 10 frontend files) | New suites for the check, the room join, corrections against a real recorder, locks, sightings, provenance | ✅ skimmed; four tests were rewritten for the intended behaviour changes, none dropped without a replacement |
Reviewed at a34ceb3 · 114 files · 2026-12-01 13:45 PST
Branch:
nvShawnHwang/egocap_day_followups, opened againstnvShawnHwang/egocap_quality_control.Commits in this pull request:
egocap: required devices, studio correction in place, calibration provenance and a live checkegocap: label corrections and device requirements agree with the capture checksSummary
Start of day
not delivering data fails its setup item and holds recording, with the reason. A station that requires nothing
behaves as before; a requirement the software does not know fails closed.
in its preview; otherwise it warns. A page's word never holds a take.
End of day
record and the time-aligned copy, and the files stay where they are. The day's report reads the corrected label.
recorder's own session lock, and is refused while a take whose filing depends on the labels is not settled.
Calibration
Files without these keys read as before. A file in a newer layout is refused by every reader, the time-aligner
included (exit status 3), and such a take is aligned once the software can read it.
still and the head moving it reports the error in pixels and grades the camera offset and lag the views imply.
For a camera that arrives over LiveKit the backend joins the video room for the length of the check only.
The second commit
egocap: label corrections and device requirements agree with the capture checksjoins this work with quality control where each had settled the same thing:the list of takes waiting for a decision is unchanged by it. A session a recorder has open, by its lock or by its
marker, is refused.
card that offers Recover and Discard.
session's marker twice before it holds it.
What to know before relying on it
write that fails part-way is put back, so the session keeps one studio. A backend that is killed part-way leaves
the session with two studios until the correction is repeated, which completes it. An independent reviewer
attacked it in two rounds with its own scripts (each write failing in turn, a kill at every rename, a second
process holding the session, a take still waiting).
calibration check; what a check by the backend itself would take is written in
LIVEKIT_PREVIEW.md.How it was tested
tests/recordingat 100% line and branch coverage;tests/tools;tests/backendwith the new modules at 100%;the page's lint, tests and build.
Not yet verified on hardware
Degraded, starting and switched-off device states from a real device (the mock reports connected or unavailable
only); a correction over a session with recorded video, on a second backend process sharing one output, or across
a power cut; the live check against a real board and headset, and in a real LiveKit room; no calibration file of a
newer layout exists yet, so every refusal of one ran on a file a test wrote.
🤖 Generated with Claude Code