Defer speaker tagging until Tome finalizes the transcript body - #2
Open
nicw wants to merge 2 commits into
Open
Conversation
Tome live-writes the transcript to the vault from session start using a
placeholder speaker label ("Them", alongside the permanent "You") and only
rewrites it to diarized "Speaker N" labels when its finalizer runs, 1-3
minutes after the note is linked. pipeline_state can read "titled" before
that rewrite, so speaker tagging could run against the placeholder body:
auto-tagging cached proposals keyed on "Them" (which the finalizer never
retroactively fixes), and a manual Tag speakers during the window offered a
Them/You modal whose Apply would corrupt body + attendees + pipeline_state.
Add hasLiveLegLabels to the shared transcript utils and gate every consumer
on it: AutoSpeakerTagger.isEligible defers a still-live body without marking
it attempted (Tome's rewrite fires a metadataCache "changed" event that
re-arms the file), the pump re-checks eligibility before the LLM slot gate
so the slot-to-run span stays await-free, doTagSpeakers refuses early with a
Notice on the manual path, and writeSpeakerProposals refuses any mapping
keyed on the literal "Them" as a last line of defense.
Adds node:test coverage for the helper and both refusal paths, plus a test
script to run it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The link tail could enrich a transcript and set pipeline_state "titled"
while the body still carried Tome's live-call-leg placeholder ("Them") —
titling a body Tome was about to rewrite. The content-keyed guards in
AutoSpeakerTagger and writeSpeakerProposals already make an early title
harmless to speaker tagging, but this tail also runs on paths where nothing
else waits (service crash, unknown session status, next-load reconcile, the
legacy heuristics rung), so wait here too as defense-in-depth.
After the transcript file is found and the superseded-session check passes,
poll its body once per second (up to 2 minutes, covering Tome's usual
finalize window) until the placeholder clears. On timeout, surface a
"still finalizing" status and return without removing the in-flight
bookkeeping entry, so the next-load reconcile re-runs the tail once the
body has settled.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tome live-writes transcript bodies with a placeholder call-leg label (Them; You is a permanent mic-leg label) and only rewrites them to diarized "Speaker N" names when its finalizer runs, minutes after capture ends. Anything that reads speaker labels off the body in that window caches results the finalizer can never retroactively fix — auto-tagging cached "Them"-keyed proposals, and an Apply from the tag modal could permanently corrupt body, attendees, and pipeline state.
This PR adds one shared finalization signal and gates every consumer on it:
hasLiveLegLabels()inutils/transcript.ts— a single definition of "Tome isn't done yet".metadataCache"changed" event from Tome's rewrite re-queues it the moment the labels are real. (isEligiblebecomes async; the slot-wait countdown badge is cleared when an in-wait head goes ineligible so it can't leak.)writeSpeakerProposalsrefuses to cache any proposal keyed on the literal "Them" — belt-and-braces coverage of every proposal write path, including the manual modal.waitAndLinkwaits (bounded, 120 s) for the body to clear the placeholder before enriching and settingpipeline_state: titled; on timeout it bails without removing the persistence entry, so next-load reconcile retries. This is defense-in-depth for the crash/unknown-status/reconcile/legacy paths — the per-guid happy path may already be safe depending on when the service reports complete.Tests: 11 (transcript helper, tagger deferral, proposal refusal), plus an
npm testscript (jiti is already in devDependencies; no new deps).Notes for review:
waitAndLinkregion; whichever lands second I'll rebase. Once both land, itsfindReadyprobe could additionally gate onhasLiveLegLabels— small follow-up.Tested on this branch against v0.8.7:
npm run build,npm run lint,npm test(11/11).🤖 Generated with Claude Code