Repository navigation
feat(memos): call participants 3.3 — resolveSpeakers precedence, rejection and tests - #1567
Merged
Merged
Conversation
…achine answers `MemoSpeaker.source` gains `metadata` and `auto`, and `resolveSpeakers` reads the stored `SpeakerMatch` rows in one precedence under the uploader's own answer: confirmed > remembered > metadata > auto > suggested. A `null` choice is "not them" and suppresses every machine row for its label; a machine row naming someone who has left is not evidence and falls through; a `voice` row above both `SPEAKER_AUTO_*` lines becomes `auto`, and below either line it only fills `suggestedUserId`. A numbered voice takes metadata/auto/suggested and is still never remembered or read as a name. `readSpeakerMatches` moves from `participants.ts` to `speakers.ts` — `participants.ts` already imports `isNumberedVoice` from there, so the back import would be a module cycle — and `loadSpeakers` takes the two thresholds from its caller, keeping the resolver pure. Both write their own env values: `MemosService` reads them once in its constructor, the secretary per run. The thresholds keep their 1.0/1.0 defaults, so auto stays off until phase 5's labelled corpus sets them, and an old confirmed/remembered answer reads as before. The `SPEAKER_MIN_SECONDS` copy now names the sampler that reads it. Refs #1564
This was referenced Dec 4, 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.
Closes #1564
Refs #1404
Refs #1400
What
resolveSpeakersnow reads the machine answers phase 1 and 3.2 store, in one precedence under the uploader's own choice:confirmed>remembered>metadata>auto>suggested, first match wins.MemoSpeaker.sourcegains'metadata'and'auto'— additive on the wire; a storedconfirmed/rememberedrow reads exactly as today.trackandmetadatarows both read assource: 'metadata'. The wire keeps twoevidencevalues because the writer knows which exact rung answered;sourcesays how a name was decided, and both are source-provided facts.voicerow becomesautoonly whenconfidenceandmarginare both non-null and each reaches itsSPEAKER_AUTO_*line. Below either line, or with a null margin, the row only fillssuggestedUserIdand never auserId; the shipped1.0/1.0defaults keep auto off until phase 5.member()stays the one filter on every rung: a machine row naming someone who has left is not evidence and falls through, while a chosen id stays final (answeringuserId: nulland no suggestion) and a chosennull— "not them" — suppresses every machine row for its label.Speaker 1,Участник 2) takesmetadata,autoand a suggestion, and is still never remembered or read as a name.readSpeakerMatchesmoved fromparticipants.tstospeakers.ts, andloadSpeakerstakes the two lines from its caller so the resolver stays pure.MemosServicereads them once in its constructor; the secretary reads them per run fromsvc.config.The read is additive: no stored row changes, and no route, DTO, schema or migration.
memos.speakersis still never written by a machine. The web page's'remembered'hint needs no change — the chips are phase 4.Divergences
metadata;docs/features/89§ Matches statesconfirmed>remembered>metadata>auto>suggestedand names the omission, so the doc wins.readSpeakerMatchesmoved fromparticipants.tstospeakers.ts.participants.tsalready importsisNumberedVoicefromspeakers.ts, so importing back would be a module cycle. The reader sits besidereadChoices— both parse the memo's speaker-shaped JSON — andparticipants.tskeeps the exact-rung writerspeakerMatches().SPEAKER_MIN_SECONDS' JSDoc and.env.exampleline said no pipeline reads it until 3.2 wired the sampler; the sampler shipped in feat(memos): speaker sampling and per-label embeddings #1562, so both now namespeaker-sampling.ts. No value change.make api-clientmoved exactly theMemoSpeaker.sourceenum inopenapi.json,contract-schemas.jsonandschema.d.ts;reference.generated.jsondid not change because the endpoint and MCP-tool inventories did not. No earlier feature's rows were carried, so nothing had to be reverted.Acceptance (#1564)
apps/api/test/memo-speakers.spec.ts→resolveSpeakers precedence (3.3): the six ordering cases plusdrops someone who has left from every rungandreads a stale exact row as no evidencesource: 'auto'; below either or a null marginsuggestedUserIdwithuserId: nullmakes a voice row auto only above both lines, and a question below either— the lines are inclusive (0.85/0.1 clears), and0.84,0.09, a null margin and a null confidence each only suggest.99voice rowlets a track or metadata row beat a 0.99 voice row, and a track beat a metadata rowmetadata/auto/suggested, never remembered orbyNamelets a numbered voice take metadata, auto and a suggestion, but never remembers or reads its name; the fixture includes a member whose display name isSpeaker 1PUT /v1/memos/:id/speakerswithnullsuppresses its machine row on the next readapps/api/test/memos.spec.ts→MemosService speaker matches→answers a "not them" choice by suppressing the machine row on the next read— the route is a thin wrapper overmatchSpeakermake api-clientcommitted,make verifygreenmake api-clientexited 0 (contract schemas, API build, OpenAPI, docs reference, typed client, web + admin typecheck);make verifyexited 0 with@knowledge/api:testand@knowledge/api:typecheckcache misses: 357 files, 5574 passed, 1 skippedWhat #1404 gains
metadataoutranksautounconditionally, and only an exact row naming a non-member falls throughauto; "not them" suppresses itconfirmedand the machine row is never consulted; thematchSpeakercase pins the storednullReview
Independent review before opening this PR (spec + work, fresh context, five area slices: resolver, precedence spec, wiring, service spec, changelog).
apps/api/src/memos/speakers.ts:1— absent; loadSpeakers required-threshold signature unverified" on the wiring slice — that diff carries the call sites, not the callee.speakers.ts:210-218declaresthresholds: SpeakerThresholdsas a required third parameter, and the slice holding it passed. Re-dispatched with the callee'sfile:lineinline → pass.The first dispatch wave was interrupted provider-side ("waiting for model response", all children at the same wall-clock) and re-sent at the same slices; no verdict was read from an interrupted call.