Add warm transcribe recorder daemon#565
Conversation
782321f to
4b5356c
Compare
Greptile SummaryAdds
Confidence Score: 5/5Safe to merge; the new daemon code is well-structured with appropriate platform guards, error handling, and test coverage. The core recording and socket-dispatch logic is correct, platform portability is handled, and all previously reported issues have been addressed. The two remaining observations — an unbounded recording buffer if agent_cli/daemon/transcribe_recorder.py — specifically the WarmAudioBuffer recording list and the handle_client coroutine. Important Files Changed
Reviews (4): Last reviewed commit: "Fix Windows CI timeouts" | Re-trigger Greptile |
4b5356c to
3e699f9
Compare
| def _print_response(response: dict[str, Any], *, json_output: bool) -> None: | ||
| if json_output: | ||
| print(json.dumps(response)) | ||
| return |
There was a problem hiding this comment.
--json always exits 0, even when the daemon reports an error
_print_response prints the JSON response and returns unconditionally when json_output=True, so daemon-side errors (e.g. "Cannot reload while recording", "No audio captured") produce exit code 0. The --json flag is specifically designed for scripting, so a caller running stop --json; echo $? will see 0 even after a failed transcription. Transport-level errors (connection refused, timeout) do exit 1 — this inconsistency means callers have to parse ok for some failures but can rely on exit code for others, defeating the purpose of a uniform machine-readable interface.
| def _print_response(response: dict[str, Any], *, json_output: bool) -> None: | |
| if json_output: | |
| print(json.dumps(response)) | |
| return | |
| def _print_response(response: dict[str, Any], *, json_output: bool) -> None: | |
| if json_output: | |
| print(json.dumps(response)) | |
| if not response.get("ok"): | |
| raise typer.Exit(1) | |
| return |
Summary
agent-cli daemon transcribe-recorderfor a warm recorder daemon controlled over a Unix socket.serve,start,stop,toggle,status, andreload, plus focused tests for buffer/control behavior.Test Plan
origin/main.uv run ruff check agent_cli/daemon/transcribe_recorder.py agent_cli/daemon/cli.py tests/agents/test_transcribe_recorder.py tests/test_cli.pyuv run --all-extras pytest -q(1317 passed, 4 skippedlocally)uv run pre-commit run --files agent_cli/daemon/transcribe_recorder.py tests/agents/test_transcribe_recorder.pyserveon a temp Unix socket with--extra audio, thenstatus, idlestop, idlereload,start, duplicatestart, recordingstatus, and recordingreloadrejection through the CLI JSON client.AF_UNIXsocket and verifiedstatusand unknown-action responses.start, recorded briefly, sent raw-socketstop, and receivedstatus: transcribedwith transcript fields.stopreturnedstatus: transcribedwith a non-empty transcript, and wrote a 982 KB WAV file.status --jsonreturned the not-running error with exit code 1.