Loading…
Reference in a new issue
No description provided.
Delete branch "fix/565-520-recording-path"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two independent bot-only fixes, bundled because both touch
cogs/recording.pyand would otherwise conflict on the same function.#565 — the live panel reported every track six times too short
recording_status.pydivided both of its byte counters by a private_BYTES_PER_SECOND = 192_000(48 kHz stereo). Since #176 the sink converts to 16 kHz mono in the capture path, sobytes_written()andspeech_bytes_written()have both counted 32,000 bytes/second since v4.1.0.Every track therefore read at a sixth of its true length, and the panel's tripwire (
track_seconds < elapsed_seconds - 60, judged past two minutes) fired for every speaker on every session — telling a GM to stop and report a healthy recording, and making a real clock loss (#320, #327) indistinguishable from the false alarm.The conversion now takes its rate from
rec.sink.BYTES_PER_SECONDrather than restating it, so the status helper cannot drift from the sink that produced the bytes. No API contract change — field names and meanings are as documented, only the numbers become right. Three docstrings left stale by #176 are corrected alongside.#520 — a failed conversion deleted the audio it never reached
_processunlinked every remaining entry ofraw_track_filesin afinally. On the success path that list is already empty (each track is released as its WAV is written, or when it is dropped as silent), so the sweep only ever ran after a failure — and deleted exactly the raw tracks that failure had left unconverted. Those files are the only copy of that speaker's audio.Keeping them was not sufficient on its own, because the two startup passes would then have fought over the same session:
_retry_pending_handoffs(setup_hook) runs first and would have posted the half-converted directory as though it were whole, with noduration_secondson it to drive the backend's coverage guards (#421);recover_interrupted_recordingswould then have found the handoff marker and dropped the surviving raw tracks as already submitted — so the audio kept would have been deleted on the next start anyway.So a half-converted directory is now marked not-to-retry, leaving recovery as the only pass that will touch it, and it records the two things only the interrupted run knows: the session's true length (the surviving tracks understate it whenever the longest one had already converted) and the names of the speakers already converted, who have no raw track left to be named from. Recovery reads both back, adds to the directory rather than replacing it, and marks itself the same way while it is filling it.
Behaviour change worth a second look
A session left half-converted is no longer auto-posted in its partial form by the handoff retry; it waits for the next bot start, when recovery completes it and posts the whole thing. That is a deliberate trade — a partial transcript that #397's guard would then refuse to replace is worse than a short wait — but it is a change in when a failed session reaches the backend.
Tests
439 passed(bot suite). Each new test was confirmed to fail against the pre-fix source:One test drafted for this PR was dropped because it passed against the unfixed source too — it asserted nothing this change affects.
Closes #565
Closes #520
🤖 Generated with Claude Code