Skip to content

chore(discord-voice): record turns to conversation.sqlite, drop JSONL writers - #974

Merged
sonichi merged 3 commits into
mainfrom
chore/discord-voice-sqlite-recording
May 21, 2026
Merged

sonichi merged 3 commits into
mainfrom
chore/discord-voice-sqlite-recording

Conversation

@liususan091219

@liususan091219 liususan091219 commented May 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

#791 migrated voice + phone session logging to conversation.sqlite but left discord-voice still writing per-session JSONL (discord-voice-*.jsonl) plus discord-voice-metrics.jsonl. This finishes that migration — the piece #791 left undone.

  • discord-voice-server.ts now calls recordConversation / recordSession from src/conversation-store.ts (which already declares 'discord-voice' as a session source).
  • The two JSONL writers and the now-unused logLine / LOG_PATH helper are removed.

Net: +8 −28, one file. No behaviour change beyond the logging sink.

Closes #792.

Test plan

  • tsc --noEmit passes
  • Verified on Lucy's machine — discord-voice sessions record turns into conversation.sqlite; no new discord-voice-*.jsonl written

🤖 Generated with Claude Code

liususan091219 and others added 2 commits May 21, 2026 13:40
… writers

#791 migrated voice + phone session logging to conversation.sqlite but left
discord-voice still writing per-session JSONL (discord-voice-*.jsonl) plus
discord-voice-metrics.jsonl. This finishes that migration — the piece #791
left undone.

discord-voice-server.ts now calls recordConversation / recordSession from
src/conversation-store.ts (which already declares 'discord-voice' as a
session source); the two JSONL writers and the now-unused logLine/LOG_PATH
helper are removed.

Closes #792.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nel id

Addresses review on #974:
- Mirror discord-voice turns into logs/conversation.log alongside the
  conversation.sqlite write, matching the phone path. Without the text-log
  copy, `import-conversation-log.py --reload` (which rebuilds the sqlite
  `conversation` table from conversation.log) would silently drop
  discord-voice rows.
- Encode guild + channel id into the session id so channel-level
  diagnostics survive into the sessions table (recordSession has no
  guild/channel field).
- SKILL.md: correct the stale "metrics land in JSONL" line.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@liususan091219

Copy link
Copy Markdown
Collaborator Author

Pushed b413a60 addressing the review:

  1. Reload-safety — discord-voice now also writes turns to logs/conversation.log alongside the conversation.sqlite write (mirroring the phone path). import-conversation-log.py --reload rebuilds the sqlite conversation table from conversation.log, so the text-log copy keeps discord-voice rows recoverable after a reload.
  2. Channel diagnostics — guild + channel id are now encoded into the session id (discord_voice_<guild>_<channel>_<ts>), so channel-level info survives into the sessions table even though recordSession has no guild/channel field.
  3. Docs — SKILL.md updated; the stale "metrics land in JSONL" line now describes the conversation.sqlite + conversation.log sinks.

On the tsc point: confirmed tsconfig.json only includes src/, so the standard tsc --noEmit doesn't cover this skills/ file — verified the change with a targeted tsc run on the file directly instead. (Adding skills/ to the typecheck scope is worth a separate follow-up.)

Addresses re-review on #974:
- Add discord-voice-server.ts to _LIVE_WRITER_PATTERNS in both
  import-conversation-log.py and import-session-metrics.py. discord-voice
  is now a live conversation.sqlite writer, so the --reload live-writer
  guard must detect it or a reload could race (and drop) its rows.
- Write conversation.log before the sqlite mirror so a turn never exists
  in sqlite without its conversation.log line — matches the primary-log
  contract the reload importer depends on.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@liususan091219

Copy link
Copy Markdown
Collaborator Author

Pushed d3be3c8 for the re-review:

  1. --reload guard — added discord-voice-server.ts to _LIVE_WRITER_PATTERNS in both import-conversation-log.py and import-session-metrics.py. discord-voice is now a live conversation.sqlite writer, so --reload's live-writer guard must detect it. (Added to the session-metrics importer too — discord-voice's recordSession writes the sessions table on the same race.)
  2. Write order — conversation.log is now written before the conversation.sqlite mirror in the turn loop, so a turn never exists in sqlite without its log line.

@sonichi
sonichi merged commit d42a032 into main May 21, 2026
2 checks passed
@sonichi
sonichi deleted the chore/discord-voice-sqlite-recording branch May 21, 2026 18:35
liususan091219 added a commit to liususan091219/sutando-fork that referenced this pull request May 28, 2026
… writers (sonichi#974)

* chore(discord-voice): record turns to conversation.sqlite, drop JSONL writers

sonichi#791 migrated voice + phone session logging to conversation.sqlite but left
discord-voice still writing per-session JSONL (discord-voice-*.jsonl) plus
discord-voice-metrics.jsonl. This finishes that migration — the piece sonichi#791
left undone.

discord-voice-server.ts now calls recordConversation / recordSession from
src/conversation-store.ts (which already declares 'discord-voice' as a
session source); the two JSONL writers and the now-unused logLine/LOG_PATH
helper are removed.

Closes sonichi#792.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(discord-voice): mirror turns to conversation.log; preserve channel id

Addresses review on sonichi#974:
- Mirror discord-voice turns into logs/conversation.log alongside the
  conversation.sqlite write, matching the phone path. Without the text-log
  copy, `import-conversation-log.py --reload` (which rebuilds the sqlite
  `conversation` table from conversation.log) would silently drop
  discord-voice rows.
- Encode guild + channel id into the session id so channel-level
  diagnostics survive into the sessions table (recordSession has no
  guild/channel field).
- SKILL.md: correct the stale "metrics land in JSONL" line.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(discord-voice): guard --reload against the discord-voice writer

Addresses re-review on sonichi#974:
- Add discord-voice-server.ts to _LIVE_WRITER_PATTERNS in both
  import-conversation-log.py and import-session-metrics.py. discord-voice
  is now a live conversation.sqlite writer, so the --reload live-writer
  guard must detect it or a reload could race (and drop) its rows.
- Write conversation.log before the sqlite mirror so a turn never exists
  in sqlite without its conversation.log line — matches the primary-log
  contract the reload importer depends on.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord conversation log: sqlite mirror missing (Discord turns absent from conversation.sqlite after #603)

2 participants