people_find hybrid mode pads grounded matches with semantic-only rows #90

Closed
opened 2026-11-04 22:18:32 +00:00 by svc-svd-writer · 3 comments
Collaborator

This was generated by AI during triage.

What happens

In hybrid mode, people_find returns every Person whose semantic score is at or above embed.min_score (0.55), in the same list as the lexical and organisation matches. The semantic-only rows are not dropped when grounded rows exist.

Seen on the live piers store (rc.10, 3,939 Persons, 2026-11-04):

  • A company name typed in capitals returned 15 rows: 1 organisation row and 14 semantic rows for unrelated people (Grok Q3 on #10, comment 32979).
  • A name that matches nothing returned 20 semantic rows (#86, comment 32987). A client cannot tell "nothing matched" from "20 vaguely related people".

Cause

src/people_mind_mcp/views.py, find, lines 168 to 180. The semantic tier is built first, as every Person with score >= cfg.embed.min_score. Lexical and organisation candidates are then merged over it with a boosted score. No rule removes the semantic-only rows when a candidate exists.

Human act

ruling: the operator chose rule A, hybrid people_find drops semantic-only rows when any lexical or organisation candidate matched, and the reason column keeps naming each row's match tier (ADR 0002, this issue)

The ruling was given on 2026-11-05 and is recorded here. Options considered and not taken: raising min_score (a tuning exercise with no clean stopping point) and a relative cut-off against the top row (a second tunable that leaves the no-match case unchanged).

What to change

  • In find, hybrid mode: when the merged lexical and organisation candidate set is non-empty, build ranked from those candidates only, each boosted by its semantic score as today. When the candidate set is empty, keep the current behaviour and return the semantic rows.
  • Do not change reason. A row keeps exact-handle, name, organisation or semantic as its match tier.
  • Do not change mode=semantic. An explicit semantic request keeps returning every row at or above min_score.
  • Do not change embed.min_score or any score.

Acceptance

  • A test with one organisation match and several Persons above min_score asserts that hybrid find returns the organisation row only, with reason=organisation.
  • A test with one name candidate and several Persons above min_score asserts that only the name row is returned.
  • A test with no lexical or organisation candidate asserts that hybrid find still returns the semantic rows, each with reason=semantic.
  • mode=semantic and mode=lexical tests are unchanged.
  • The footer total counts the rows returned under the new rule.
  • Run the suite with python3 -m pytest.

Out of scope

  • A floor on semantic-only results when nothing else matched, for example at most 5 rows above 0.60. The Grok run did not hit this case. File separately if the data shows a need.
  • The people_related hint on #85.

#10 (Grok Q3 record), #86 (live timings, the no-match case), #82 (organisation matches), ADR 0002 (Candidate tier), ADR 0006 (embeddings on by default).

Filed under: operator word "ruling: the operator chose rule A, hybrid people_find drops semantic-only rows when any lexical or organisation candidate matched, and the reason column keeps naming each row's match tier (ADR 0002, this issue)" sha256:794731a6ddef

> *This was generated by AI during triage.* ## What happens In hybrid mode, `people_find` returns every Person whose semantic score is at or above `embed.min_score` (0.55), in the same list as the lexical and organisation matches. The semantic-only rows are not dropped when grounded rows exist. Seen on the live piers store (rc.10, 3,939 Persons, 2026-11-04): - A company name typed in capitals returned 15 rows: 1 `organisation` row and 14 `semantic` rows for unrelated people (Grok Q3 on #10, comment 32979). - A name that matches nothing returned 20 `semantic` rows (#86, comment 32987). A client cannot tell "nothing matched" from "20 vaguely related people". ## Cause `src/people_mind_mcp/views.py`, `find`, lines 168 to 180. The semantic tier is built first, as every Person with `score >= cfg.embed.min_score`. Lexical and organisation candidates are then merged over it with a boosted score. No rule removes the semantic-only rows when a candidate exists. ## Human act ruling: the operator chose rule A, hybrid people_find drops semantic-only rows when any lexical or organisation candidate matched, and the reason column keeps naming each row's match tier (ADR 0002, this issue) The ruling was given on 2026-11-05 and is recorded here. Options considered and not taken: raising `min_score` (a tuning exercise with no clean stopping point) and a relative cut-off against the top row (a second tunable that leaves the no-match case unchanged). ## What to change - In `find`, hybrid mode: when the merged lexical and organisation candidate set is non-empty, build `ranked` from those candidates only, each boosted by its semantic score as today. When the candidate set is empty, keep the current behaviour and return the semantic rows. - Do not change `reason`. A row keeps `exact-handle`, `name`, `organisation` or `semantic` as its match tier. - Do not change `mode=semantic`. An explicit semantic request keeps returning every row at or above `min_score`. - Do not change `embed.min_score` or any score. ## Acceptance - A test with one organisation match and several Persons above `min_score` asserts that hybrid `find` returns the organisation row only, with `reason=organisation`. - A test with one `name` candidate and several Persons above `min_score` asserts that only the `name` row is returned. - A test with no lexical or organisation candidate asserts that hybrid `find` still returns the semantic rows, each with `reason=semantic`. - `mode=semantic` and `mode=lexical` tests are unchanged. - The footer total counts the rows returned under the new rule. - Run the suite with `python3 -m pytest`. ## Out of scope - A floor on semantic-only results when nothing else matched, for example at most 5 rows above 0.60. The Grok run did not hit this case. File separately if the data shows a need. - The `people_related` hint on #85. ## Related #10 (Grok Q3 record), #86 (live timings, the no-match case), #82 (organisation matches), ADR 0002 (Candidate tier), ADR 0006 (embeddings on by default). Filed under: operator word "ruling: the operator chose rule A, hybrid people_find drops semantic-only rows when any lexical or organisation candidate matched, and the reason column keeps naming each row's match tier (ADR 0002, this issue)" sha256:794731a6ddef
Author
Collaborator

⏸ SVD architect gate: dev/people-mind-mcp#90 people-find-hybrid-mode-pads-grounded-matches-with-semantic

Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity standard · dispatch effort medium

Run: 20261104T224040Z-dd61486d

Held because: CLEAN but 2 open risk(s) (1 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim:

Open risks:

  1. Should the agent-visible people_find tool description (server.py:108-116) also state the hybrid rule? The spec leans no: the reason column already names each row's tier, the issue's change list does not ask for it, and description lines cost tokens on every list_tools. If yes, add server.py and test_server.py (a description assertion mirroring test_find_description_explains_organisation_members at test_server.py:182-189) to Primary Files. [decision]
  2. Live behaviour on the piers store (rc.10) can only be shown after deploy. Check: with embedding on, people_find query="ACME" (default hybrid) returns only organisation rows and no semantic rows. A query matching no name or organisation still returns semantic rows, with footer total equal to the row count. [verification]

Change: In src/people_mind_mcp/views.py find(), replace lines 171-178. Today the code builds the semantic dict unconditionally and then overwrites it with the Candidates. Replace that with one branch: if effective == "hybrid" and candidates: sets ranked = {candidate.person_id: (candidate.score + sem.get(pid, 0.0), candidate.reason) for candidate in candidates}. The else branch is today's line 172 verbatim (every pid with score >= cfg.embed.min_score, reason "semantic"). candidates is the tuple of lexical and organisation Candidates already merged at 159-166. The sort, page and footer (179-184) are unchanged, so the footer total follows automatically through rows.page. In tests/test_embed.py, edit test_hybrid_blend_exact_handle_first_and_prefix_beats_weak_semantic lines 279-288: hybrid "Avery" now returns only the name-prefix row with total=1, and the padded-row paging assertions are dropped. Add test_hybrid_drops_semantic_only_rows_when_a_candidate_matches, mirroring the setup of test_find_matches_organisation_members (335-345). Its blocks: "ZENITH" returns the organisation row only; "Avery" returns the name row only; "plumber" returns 4 semantic rows with paging; mode=semantic and mode=lexical are unchanged. Add one sentence to the people_find cell at README.md:55, mirroring #83 (7421bfc).

Files: src/people_mind_mcp/views.py · tests/test_embed.py · README.md

Decision: accept the 2 open risk(s) above and dispatch this spec (svd:go), or park (svd:skip) / re-spec (svd:respec)?

Your call (when this issue is held at the gate via svd:hold):

  • add label svd:go — approve; Half-B dispatch accepts exactly this spec (open risks accepted)
  • add label svd:fire beside svd:go — approve AND authorise the Half-B fire from the phone; never on its own
  • add label svd:skip — park it; dispatch refuses it and the issue stays for a human
  • add label svd:respec — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context

Spec: /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-people-find-hybrid-mode-pads-grounded-matches-with-semantic.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-people-find-hybrid-mode-pads-grounded-matches-with-semantic.md

### ⏸ SVD architect gate: dev/people-mind-mcp#90 people-find-hybrid-mode-pads-grounded-matches-with-semantic **Status:** CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity `standard` · dispatch effort `medium` **Run:** `20261104T224040Z-dd61486d` **Held because:** CLEAN but 2 open risk(s) (1 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. Should the agent-visible people_find tool description (server.py:108-116) also state the hybrid rule? The spec leans no: the reason column already names each row's tier, the issue's change list does not ask for it, and description lines cost tokens on every list_tools. If yes, add server.py and test_server.py (a description assertion mirroring test_find_description_explains_organisation_members at test_server.py:182-189) to Primary Files. [decision] 2. Live behaviour on the piers store (rc.10) can only be shown after deploy. Check: with embedding on, people_find query="ACME" (default hybrid) returns only organisation rows and no semantic rows. A query matching no name or organisation still returns semantic rows, with footer total equal to the row count. [verification] **Change:** In src/people_mind_mcp/views.py find(), replace lines 171-178. Today the code builds the semantic dict unconditionally and then overwrites it with the Candidates. Replace that with one branch: `if effective == "hybrid" and candidates:` sets ranked = {candidate.person_id: (candidate.score + sem.get(pid, 0.0), candidate.reason) for candidate in candidates}. The else branch is today's line 172 verbatim (every pid with score >= cfg.embed.min_score, reason "semantic"). candidates is the tuple of lexical and organisation Candidates already merged at 159-166. The sort, page and footer (179-184) are unchanged, so the footer total follows automatically through rows.page. In tests/test_embed.py, edit test_hybrid_blend_exact_handle_first_and_prefix_beats_weak_semantic lines 279-288: hybrid "Avery" now returns only the name-prefix row with total=1, and the padded-row paging assertions are dropped. Add test_hybrid_drops_semantic_only_rows_when_a_candidate_matches, mirroring the setup of test_find_matches_organisation_members (335-345). Its blocks: "ZENITH" returns the organisation row only; "Avery" returns the name row only; "plumber" returns 4 semantic rows with paging; mode=semantic and mode=lexical are unchanged. Add one sentence to the people_find cell at README.md:55, mirroring #83 (7421bfc). **Files:** `src/people_mind_mcp/views.py` · `tests/test_embed.py` · `README.md` **Decision:** accept the 2 open risk(s) above and dispatch this spec (`svd:go`), or park (`svd:skip`) / re-spec (`svd:respec`)? **Your call** (when this issue is held at the gate via `svd:hold`): - add label `svd:go` — approve; Half-B dispatch accepts exactly this spec (open risks accepted) - add label `svd:fire` **beside** `svd:go` — approve AND authorise the Half-B fire from the phone; never on its own - add label `svd:skip` — park it; dispatch refuses it and the issue stays for a human - add label `svd:respec` — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context <sub>Spec: `/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-people-find-hybrid-mode-pads-grounded-matches-with-semantic.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-04-people-find-hybrid-mode-pads-grounded-matches-with-semantic.md`</sub>
Author
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#90 people-find-hybrid-mode-pads-grounded-matches-with-semantic completed integration verify.

  • PR: #91
  • Branch: feat/svd-dev-people-mind-mcp-90-people-find-hybrid-mode-pads-35c1bd73
  • Commit: 8e8942e58d
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/57/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: Local run was 451 passed, 5 skipped, 4 deselected, not the gate's 453 passed, 3 skipped: two model tests skip here, as the subagent reported.
  • Warning: Risk flag accepted at the gate: a weak fuzzy lexical hit now hides all semantic rows (ranking-semantics).
  • Warning: Post-deploy check owned by the architect: people_find query=ACME on the piers store returns no semantic rows.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261104T225947Z-35c1bd73 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#90 people-find-hybrid-mode-pads-grounded-matches-with-semantic completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/91 - Branch: feat/svd-dev-people-mind-mcp-90-people-find-hybrid-mode-pads-35c1bd73 - Commit: 8e8942e58d19e8bb2937d16d89415f1daa6add98 - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/57/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: Local run was 451 passed, 5 skipped, 4 deselected, not the gate's 453 passed, 3 skipped: two model tests skip here, as the subagent reported. - Warning: Risk flag accepted at the gate: a weak fuzzy lexical hit now hides all semantic rows (ranking-semantics). - Warning: Post-deploy check owned by the architect: people_find query=ACME on the piers store returns no semantic rows. - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261104T225947Z-35c1bd73 --confirm-merge`)
svc-svd-writer 2026-11-04 23:10:49 +00:00
  • closed this issue
  • removed the
    svd:go
    label
Author
Collaborator

This was generated by AI during triage.

Live check on 0.1.0-rc.11 (piers store, 2026-11-05)

rc.11 carries PR #91 (c88b60a). The pod rolled at 23:53:48Z (starbase/iac#341, sha256:b9cb17fe3719…). All three containers are ready, with 0 restarts. The checks are read-only. They give counts only.

  • peoplemind check: store=ok schema=10, 3,939 Persons, 1,516 organisations.
  • The embedder is loaded, so hybrid mode is live.
Query Mode Rows Footer total Reasons Result
Largest organisation (73 members) hybrid 20 75 organisation 20 Pass, no semantic rows
Second organisation (58 members) hybrid 20 58 organisation 20 Pass, no semantic rows
10 single-member organisations, in capitals (the Q3 shape) hybrid 1 to 6 each — no semantic rows in any of the 10 Pass
An occupation word with no name or organisation match (lexical 0 rows) hybrid 20 269 semantic 20 Pass, semantic fallback kept

On rc.10, Q3 returned the organisation match plus 14 semantic-only rows (comment on #10, 2026-11-04 22:12Z). On rc.11 a single-member organisation in capitals returns no semantic rows.

The post-deploy check named in the spec (Open Risk 2) used ACME as its example. The store holds no organisation by that name, and lexical mode returns 0 rows for it. Hybrid therefore falls back to semantic rows (20 rows, total 900), as rule A requires. The table above uses real organisation names from the store instead.

Note: run peoplemind check in the sync container. In the api container it returns secret=error code=secret-unreadable. This is by design. The prepare init container gives the api container only the read token (README, Kubernetes section; deploy/k8s/base/deployment.yaml, subPath: api). check reads the tombstone salt before it checks the store (cli.py:114), and only the sync container holds the salt.

> *This was generated by AI during triage.* ## Live check on 0.1.0-rc.11 (piers store, 2026-11-05) rc.11 carries PR #91 (`c88b60a`). The pod rolled at 23:53:48Z (starbase/iac#341, `sha256:b9cb17fe3719…`). All three containers are ready, with 0 restarts. The checks are read-only. They give counts only. - `peoplemind check`: `store=ok schema=10`, 3,939 Persons, 1,516 organisations. - The embedder is loaded, so hybrid mode is live. | Query | Mode | Rows | Footer total | Reasons | Result | |---|---|---|---|---|---| | Largest organisation (73 members) | hybrid | 20 | 75 | organisation 20 | Pass, no semantic rows | | Second organisation (58 members) | hybrid | 20 | 58 | organisation 20 | Pass, no semantic rows | | 10 single-member organisations, in capitals (the Q3 shape) | hybrid | 1 to 6 each | — | no semantic rows in any of the 10 | Pass | | An occupation word with no name or organisation match (lexical 0 rows) | hybrid | 20 | 269 | semantic 20 | Pass, semantic fallback kept | On rc.10, Q3 returned the organisation match plus 14 semantic-only rows (comment on #10, 2026-11-04 22:12Z). On rc.11 a single-member organisation in capitals returns no semantic rows. The post-deploy check named in the spec (Open Risk 2) used `ACME` as its example. The store holds no organisation by that name, and lexical mode returns 0 rows for it. Hybrid therefore falls back to semantic rows (20 rows, total 900), as rule A requires. The table above uses real organisation names from the store instead. Note: run `peoplemind check` in the `sync` container. In the `api` container it returns `secret=error code=secret-unreadable`. This is by design. The `prepare` init container gives the `api` container only the read token (README, Kubernetes section; `deploy/k8s/base/deployment.yaml`, `subPath: api`). `check` reads the tombstone salt before it checks the store (`cli.py:114`), and only the `sync` container holds the salt.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dev/people-mind-mcp#90
No description provided.