minutes icon indicating copy to clipboard operation
minutes copied to clipboard

feat(speaker-mapping): surface mapping health + `minutes redo-speaker-mapping` recovery (follow-up to #382)

Open silverstein opened this issue 5 months ago • 0 comments

Follow-up to #382 (fixed in #383). The core hang is resolved — speaker mapping now runs lean (no MCP/no tools), with a dedicated clamped timeout and subprocess-tree kill. Two pieces were deliberately deferred from that PR because they carry design risk that deserves its own contract.

A. Surface speaker-mapping health (frontmatter + minutes status)

Today a failed/incomplete mapping is only visible in ~/.minutes/logs/minutes.log. Users discover anonymized meetings by reading the transcript. Even with the #383 fix, mapping can still come back empty (1 speaker, no attendees, invalid JSON, timeout), and that should be machine-readable.

Add structured health to meeting frontmatter (and expose via minutes status / the dashboard):

speaker_mapping:
  status: ok | degraded | timed_out | skipped | invalid_output
  engine: "agent:claude"        # which path ran
  diarized_speakers: 6
  mapped_speakers: 5
  unmapped_labels: [SPEAKER_5]
  attempts: 1
  duration_ms: 1840
  reason: "..."                  # when not ok

Notes / constraints:

  • Record raw diarization count vs mapped count vs unmapped labels separately, so "map exists" is never mistaken for "all clusters mapped" (codex: validate completeness separately from confidence).
  • Degraded deterministic attribution (e.g. stem-based recorder self-attribution) must record provenance source: deterministic, distinct from model-derived entries, so later correction layers (#365 participant pool) don't treat them as equally confirmed.
  • A one-line nudge to re-run when status != ok.

B. minutes redo-speaker-mapping <meeting.md>

Re-run ONLY naming against an existing meeting's transcript + attendees + diarization labels, rewrite the speaker map, no audio reprocessing. Cheap recovery for meetings already shipped anonymous (speaker_map empty/<=1 with raw_diarization_num_speakers > 1), including historical ones.

This is more dangerous than it looks — it must be surgical, idempotent, and have a clear source-of-truth contract (codex review of #382 plan):

  • Surgical: rewrite only the speaker map metadata and any display labels strictly downstream of it. Do NOT reflow the meeting body, alter transcript text, regenerate summary sections, or reorder unrelated frontmatter.
  • Source-of-truth contract: require raw diarization labels, transcript segments, attendee list, and prior attribution metadata to be recoverable from the file. If any are missing (transcript hand-edited, labels normalized away, schema drift), FAIL with a clear message rather than guess.
  • Never overwrite a better existing map: if a non-empty higher-confidence map already exists and the inputs are unchanged, do not let a transient mapping failure erase it.
  • Re-entrancy guard: redo invokes the lean claude (no MCP) from inside minutes; even so, set a guard env var (e.g. MINUTES_SPEAKER_MAPPING_CHILD=1) so any local MCP/server path can refuse recursive work, avoiding minutes -> claude -> minutes-MCP -> minutes.
  • Flags: --dry-run (show what would change), --engine, --no-agent. Keep the stem-only self-attribution gate intact.

Out of scope

The hang fix itself (done in #383). This issue is the visibility + recovery layer.

silverstein avatar Jun 30 '26 00:06 silverstein