Add voice-message transcript persistence and fix newest-N conversation range queries#5
Conversation
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/a58e6320-ec26-4c07-8b30-972656dcbd8a Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds end-to-end support for persisting and displaying voice-message transcripts across the DB layer, REST API, MCP tools, and the web UI so transcripts survive re-syncs and are visible to clients.
Changes:
- Extend
messagesschema + hydration to includetranscript,transcribed_at, andtranscript_model, and addStore.SetMessageTranscript(...). - Add a REST write endpoint (
POST /api/transcript) plus an MCP tool (set_message_transcript) to update transcripts for existing messages. - Render transcripts in the web UI under audio messages and append transcript text to MCP-formatted message output; add tests for DB + API flows.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/web/static/index.html | Adds transcript styling and renders transcript text beneath audio messages. |
| internal/web/api.go | Adds POST /api/transcript endpoint to persist transcripts and publish updates. |
| internal/web/api_test.go | Adds success-path coverage for the transcript API. |
| internal/tools/tools.go | Extends MCP message formatting to append transcript text. |
| internal/tools/tools_test.go | Updates tests for new formatter signature and adds transcript assertion. |
| internal/tools/story.go | Threads transcript through message formatting in story output. |
| internal/tools/set_message_transcript.go | Introduces MCP tool/handler for setting message transcripts. |
| internal/tools/search_messages.go | Threads transcript through message formatting in search output. |
| internal/db/messages.go | Adds transcript columns to selects/upserts and implements SetMessageTranscript. |
| internal/db/messages_test.go | Adds DB coverage for transcript set/overwrite and non-clobber on resync. |
| internal/db/db.go | Adds migrations + struct fields for transcript metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/1c368499-860a-4116-846b-1c47ced45e1d Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/1c368499-860a-4116-846b-1c47ced45e1d Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/1c368499-860a-4116-846b-1c47ced45e1d Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Applied the review-thread changes in 9c1f44e, 41c9f9f, and 498fb84: transcript writes now preserve timestamps on identical rewrites, clear stale metadata on empty transcripts, use a clearer message-specific not-found error, handle MCP reload errors explicitly, safely quote transcript text in MCP output, and cover the API 404 path. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Bug fix: GetMessagesByConversations[Range] returns oldest-N instead of newest-N The bug internal/db/messages.go has two query functions that take a conversation-ID list and a limit:
Both use ORDER BY timestamp_ms ASC LIMIT ?. When the matching rows exceed limit, SQLite returns the oldest N. Callers like The fix In both GetMessagesByConversations and GetMessagesByConversationsRange, wrap the SELECT in a subquery that picks newest-N then SELECT * FROM ( That keeps the API contract (chronological output) but selects from the recent edge. No call sites need to change. Files
Test In messages_test.go, add a test that:
Without the fix this test fails (returns 1,2,3). Same test pattern for GetMessagesByConversations. Acceptance
|
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/7856c62b-249f-43c0-b96d-e01676aba727 Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/7856c62b-249f-43c0-b96d-e01676aba727 Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Applied in 867fd9f and polished in ff68759. Both cross-conversation helpers now pick the newest matching rows in a descending subquery before re-sorting ascending for display, and I added DB regression coverage for both limited helpers. No UI changes for this DB-only fix. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/b7edb072-e887-4999-9c89-742a5ce51124 Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/b7edb072-e887-4999-9c89-742a5ce51124 Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Applied in 99fc57e and polished in 4a73b81. Transcript writes now distinguish omitted fields from explicit empty strings, preserve the stored model unless a caller explicitly replaces it or clears the transcript, and the newest-N cross-conversation queries now use deterministic Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/fc52076c-104f-4f2a-9ed1-b90d40a52e69 Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Applied in 449a9f2. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/33e37296-e1f2-4d84-9338-f6249ac2433a Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/33e37296-e1f2-4d84-9338-f6249ac2433a Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
Applied in e0f5836 (follow-up on 75218b2). Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Agent-Logs-Url: https://github.com/chz160/openmessage/sessions/a8d8a620-8381-49bf-a5ab-20366d4353c9 Co-authored-by: chz160 <3420276+chz160@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Uh oh!
There was an error while loading. Please reload this page.