Task-tool confirmations come from the store; replay skips the model
A fresh turn may call DeepSeek once to pick one task tool or plain text. The same request id and input hash replays the saved receipt with zero provider requests. A tool message comes from execute; plain text stays the model string.
Voice interfaces turn speech into a proposed task; text and record changes still need to agree. The fixture demonstrates a task lifecycle, rather than measuring how accurately every real voice request will be understood.
The README acceptance fixture uses synthetic speech and saves Review the proposal, then renames that row to Review the contract. The lowercase titles are direct execute arguments in test_create_correct_reopen_and_list, which also asserts the listed title review the contract. That test calls execute for add, rename, and list with no model. The README’s synthetic acceptance run is the journey that used DeepSeek for those three actions. Both chat routes require a UUID request_id. When the result is not an answer, chat_stream on /api/chat-stream streams the task receipt, then text and phrase events, while /api/chat returns one JSON body. On a fresh write, TaskStore.execute in tasks.py runs under BEGIN IMMEDIATE. Each receipt is stored with primary key request_id, and input_hash is a column checked after that lookup. A tool result’s message is the string execute returns.
The claim is that a tool result’s spoken message comes from execute, plain text remains the model string, and a repeated request_id with the same input_hash returns the saved receipt with zero provider requests; otherwise agent.run uses UsageLimits(request_limit=1). The task titles in the unit tests are ordinary strings; the README acceptance journey uses a synthetic speech fixture.
The argument
- Tool messages come from
execute. The prompt tells the model never to claim a task was saved, renamed, or on the list; a tool result’s spokenmessagecomes fromexecute, while plain text is still the model string. - Replay or one request. A repeated
request_idandinput_hashreturns the saved receipt with zero provider requests; otherwiseagent.runusesUsageLimits(request_limit=1). Model settings still setparallel_tool_callstoFalse. - Identity binds input to receipt. The same
request_idwith a differentinput_hashraisesValueError; an identical pair replays the saved JSON with zero provider requests. - Speech paths are workflows. Cartesia Ink-2 or optional local whisper.cpp/Kokoro move audio; DeepSeek chooses task actions only when chat is submitted—not from partial STT alone.
Who is allowed to decide
The design avoids letting the model both decide and narrate storage. Voice Lab separates who may touch tasks.sqlite3, who may call DeepSeek, and who may open the transcription WebSocket.
The dashed box is server.py on 127.0.0.1:8788, with a companion relay on port 8789. The operator sits in the browser with a per-turn request_id. do_POST allows a missing Origin plus http://127.0.0.1:8788 and http://localhost:8788; any other Origin gets HTTP 403 and does not reach task_response. That gate is not promptable—it is control flow in do_POST.
Inside the box, task_agent.py is the only model-driven step: one Pydantic AI request that picks plain text or one output tool. It constructs a Pydantic AI Agent with output_type listing plain str plus three ToolOutput wrappers for add_task, rename_task, and list_tasks. DeepSeek at deepseek-v4-flash chooses at most one of those outputs per agent.run, with openai_reasoning_effort: "none" and max_tokens: 400. Plain conversation stays operation: "answer"; a tool selection becomes the dict returned from execute. The prompt tells the model never to claim a task was saved, renamed, or on the list; a tool result’s spoken message comes from execute, while plain text is still the model string.
TaskContext.check_active bridges voice cancellation: if the client disconnects before a tool runs, execute is never reached. A write already committed stays saved; chat_stream then publishes the task receipt before phrase events so interruption cannot disguise that effect. SQLite lives under .local/tasks.sqlite3 with WAL mode; no external task service is connected per the README.
Speech is parallel, not authoritative. transcribe_socket relays PCM to Cartesia STT or, when provider=local, to local_speech.transcribe_socket. Local mode refuses missing assets via require_ready rather than falling back to the vendor. Recognition still ends as text the UI submits to chat; endpointing and VAD do not pick task tools.
The README’s voice-managed tasks section states the split plainly: native output tools let DeepSeek choose one task action per turn, while application-owned SQLite transactions execute that action and produce confirmation from saved readback. Plain conversation uses native text output only. That distinction matters when the whole surface is described as voice-first chat. Only task_agent.py is that bounded agent step. tasks.py is deterministic: parameterized SQL, with success text taken from selected rows and not_found, conflict, and empty-list messages built without a changed row. Changing providers in the header stops capture and playback before the next session; there is no automatic provider fallback.
What the evidence shows
It is easy to describe Voice Lab as “an assistant with tools” and treat every layer as equally proven. The repository actually mixes storage tests with mocked provider tests and README journey notes. The figure below is the mechanism the four test_tasks.py cases exercise: replay on identity match, refusal on hash mismatch, and no mutation on refused renames.
VlReceiptGate draws Incoming, saved_receipt, and Commit cards. saved_receipt returns a stored result, returns None, or raises ValueError; execute commits the fresh write. When request_id already exists in task_receipts, a matching input_hash returns the stored result JSON—run_task_agent reports requests: 0 and replayed: True. A mismatched hash raises ValueError("Request identity was reused for different input"), leaving prior rows untouched. Fresh input runs add_task, rename_task, or list_tasks inside BEGIN IMMEDIATE, inserts a receipt, and returns statuses like already_exists, not_found, conflict, or truncated with operator-facing message strings assembled in Python.
Duplicate titles are case-insensitive via title_key; empty or over-long titles fail TaskStore.title before insert. list_tasks reads at most 100 rows and marks truncated when COUNT(*) exceeds that window.
On the model boundary, test_chat_output.py drives run_task_agent with a synthetic HTTP transport: test_count_again_accepts_native_text expects operation: "answer" and zero tasks saved; test_task_tool_still_commits_and_confirms expects Added task: Review demo. to match the store. Those cases prove the output contract, not production network behavior. They also pin tool_choice to auto and assert exactly one HTTP request per run—matching request_limit=1 in production configuration.
test_duplicate_and_identical_request_are_idempotent shows replay at the storage layer without involving the agent: the store returns the saved receipt for the same id and hash, so the second add_task equals the first result, while a case-insensitive duplicate title yields already_exists with snapshot()["total"] still 1.
Local speech boundaries are separate. Missing setup is a path patch; sustained non-speech uses real speech_frame and asserts only connected; the voiced test mocks speech_frame and transcribe and asserts connected, turn.start, and turn.end with a transcript. README documents WebRTC VAD mode 3, 200 ms onset, 800 ms silence, and a 15-second utterance cap in local_speech.py—the figure summarises that pipeline without claiming room-acoustic certification.
What would falsify the central claim is a test where the assistant message says a task was renamed while snapshot() still shows the old title, or where a foreign Origin mutates storage. test_missing_task_and_rename_collision_do_not_mutate asserts not_found, conflict, and unchanged titles First and Second; a disallowed Origin is HTTP 403 in do_POST and never calls run_task_agent. What would strengthen it is a broader live matrix across speech providers; the README lists several journeys with real Cartesia and DeepSeek usage totals, but those notes sit outside the four test_tasks.py cases.
The scripted turn in the tests
The clearest scripted turn in the tree is test_create_correct_reopen_and_list in test_tasks.py, which walks the same create→correct→list story the README describes for task acceptance, without network or speech.
The test calls execute("add_task", {"title": "review the proposal"}, "add", "a") and receives a row with revision 1. It then calls rename_task with the exact previous title and a new title "review the contract", using request id "rename" and hash "b". The assertion that matters for the argument is identity: changed["tasks"][0]["id"] equals original["tasks"][0]["id"], so correction is an in-place update with revision bumped to 2, not a second row. A fresh TaskStore instance on the same file path runs list_tasks and the test expects a single title, review the contract.
That sequence is the happy path after gates the test file does not repeat: no model selects the titles, no speech relay participates, and each operation carries its own request id so receipts remain distinct. It still shows the product promise—reload-survivable list state with grounded list text—because list_tasks reads committed rows, matching the list_tasks tool docstring that forbids inferring the list from chat history alone.
Opening a fresh TaskStore on the existing database file models what the README’s reload step cares about: confirmation text after navigation must come from a new list_tasks read, not from whatever the model remembers in the prior tab’s transcript. The unittest compresses that into three execute calls and three assertions on ids, titles, and revision numbers.
The one check to copy
Copy the identity guard, not the task nouns. The chat POST carries a UUID request_id and messages; task_response fingerprints that normalized list before any provider call. Before any provider call, the store is asked for an existing receipt; on hash mismatch, it refuses rather than silently branching.
The regression to keep is test_reused_identity_and_invalid_title_are_refused in test_tasks.py. It adds "Review" under id "one" hash "a", then expects ValueError when the same id is reused with "Different" input, and again when the title is only whitespace. Finally it asserts snapshot()["total"] stays 1. That is the shape for any mutable assistant feature: one id per client turn, invalid arguments never reach INSERT, and replay stays idempotent for retries. input_hash is the SHA-256 of canonical JSON for the normalized message list, not the bytes of the provider request.
row = db.execute("SELECT input_hash, result FROM task_receipts WHERE request_id = ?", (request_id,)).fetchone()
if not row:
return None
if row["input_hash"] != input_hash:
raise ValueError("Request identity was reused for different input")Pair that with an Origin allowlist on the HTTP surface. A tool result’s message is what execute returned; when the output is plain text, that field is still the model string. Voice Lab’s task scope is intentionally narrow—no delete, complete, or multi-user features in the README—but the receipt pattern generalizes wherever a spoken UI must not lie about writes.
Close
Voice Lab is easy to describe as “DeepSeek with a microphone.” The evidence in this tree describes something tighter: on a fresh turn a bounded agent step picks among three storage tools or plain text, with UsageLimits(request_limit=1); a repeated request_id and input_hash returns the saved receipt and makes no provider request. The server owns origins, request identity, SQLite transactions, and streamed confirmations. Speech vendors and optional local whisper.cpp/Kokoro move audio; they do not authorize mutations. A tool result’s spoken message comes from execute; plain text remains the model string. Extend the experiment only when a new write path has its own receipt test, its own origin rule if exposed, and a spoken message that still comes from readback after commit.
How is this page?
Last updated on