Skip to content

chore: resolve issue #154 — surface narrative reviews in chat context - #156

Merged
matthewod11-stack merged 1 commit into
mainfrom
chore/orchestrator-issue-154-2026-07-16
Jul 17, 2026
Merged

chore: resolve issue #154 — surface narrative reviews in chat context#156
matthewod11-stack merged 1 commit into
mainfrom
chore/orchestrator-issue-154-2026-07-16

Conversation

@matthewod11-stack

Copy link
Copy Markdown
Owner

Auto-generated by portfolio-orchestrator nightly run on 2026-07-16. Resolves #154.

The bug

Chat told the user "I don't have Maya's performance data in my system—no ratings, feedback, or review history." Immediately after, Prep Brief rendered ~18 grounded facts from that same employee's reviews, out of the same database.

The model wasn't wrong — it was reporting exactly what it was given. src-tauri/src/context/ read performance_ratings and had zero references to performance_reviews, and prompt.rs gated the whole Performance section on all_ratings being non-empty. An employee with narrative reviews but no numeric ratings therefore rendered nothing, and the user experiences it as the assistant lying about what it knows.

The fix

  • retrieval.rsEmployeeContext gains review_count + latest_review_date, populated on both the single-employee and batch paths. The batch query groups per employee, mirroring the existing ratings/eNPS batch pattern.
  • prompt.rs — the Performance section now renders when either ratings or reviews exist.

Existence is stated, not content. The narrative text is deliberately not loaded (the employee-context section is token-budgeted), and the rendered line says so explicitly, so the model can't swing from a false negative ("no review history") to a false positive (claiming it read the reviews).

This delivers the issue's stated minimum bar — the context builder must tell the model reviews EXIST so it never claims otherwise. The richer inclusion-shape question (full narratives vs. summary vs. FTS excerpts) is a product decision the issue explicitly asks a human to make, so it's left open.

Verification

  • 858 Rust tests pass (854 baseline + 4 new), 0 failing — cargo test --manifest-path src-tauri/Cargo.toml
  • npm run type-check (tsc --noEmit) clean
  • No new compiler warnings — 45 on clean main, 45 with this change
  • The new DB-backed test exercises both SQL paths against the real migrated schema, covering the previously untested single-employee get_employee_context
  • Red-checked: reverting the prompt.rs gate alone makes the regression tests fail, so the lock is genuine rather than vacuous

The issue's second verification item — the live chat repro against scripts/dev-seed-people-map-fixtures.sql — needs a human at the app and is not covered here.

Safety

  • scope: src-tauri/src/context/ honored — 2 files changed (cap 5)
  • do-not-touch honored — no changes under src-tauri/src/people_map/ or src-tauri/src/recruiting/
  • bail-if not triggered: the system-prompt token-budget contract and provider payload shape are unchanged

🤖 Generated with Claude Code

Chat claimed "no performance data" for employees who had written reviews
but no numeric ratings, while Prep Brief cited those same reviews from the
same DB. The context module read `performance_ratings` exclusively and had
zero references to `performance_reviews`, and prompt.rs gated the entire
Performance section on `all_ratings` being non-empty — so a reviews-only
employee rendered nothing and the model correctly reported it saw nothing.

Retrieval now carries `review_count` + `latest_review_date` on
EmployeeContext, populated on both the single-employee and batch paths
(the batch path groups per employee, mirroring the existing ratings/eNPS
pattern). prompt.rs renders the Performance section when EITHER ratings or
reviews exist.

Existence is stated, not content: the narrative text is deliberately not
loaded (the employee-context section is token-budgeted), and the line says
so explicitly so the model does not claim to have read the reviews. Per the
issue's minimum bar — the model must never claim "no review history" when
one exists. The richer inclusion-shape question (full narratives vs FTS
excerpts) is left for the human decision the issue asks for.

Verification: 858 Rust tests pass (854 baseline + 4 new), tsc --noEmit
clean, no new compiler warnings (45 before, 45 after). The new DB-backed
test exercises both SQL paths against the real migrated schema and covers
the previously untested single-employee path. Reverting the prompt.rs gate
alone makes the regression tests fail, confirming the lock is real.

do-not-touch honored: no changes under src-tauri/src/people_map/ or
src-tauri/src/recruiting/. Token-budget contract and provider payload
shape unchanged (bail-if not triggered).

Resolves #154

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 16, 2026 08:23
@cursor

cursor Bot commented Jul 16, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes issue #154 by ensuring chat context acknowledges when an employee has narrative performance reviews even if they have no numeric ratings, preventing the assistant from incorrectly claiming “no review history” in those cases.

Changes:

  • Extend EmployeeContext retrieval to include review_count and latest_review_date from performance_reviews for both single-employee and batch paths.
  • Update prompt rendering so the “Performance” section appears when either ratings exist or narrative reviews exist, and explicitly states that review text is not loaded.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src-tauri/src/context/retrieval.rs Adds review metadata (count + latest date) to EmployeeContext and populates it in both single and batch SQL retrieval paths, with a regression test covering both paths.
src-tauri/src/context/prompt.rs Changes the Performance section gate to include review existence and renders an explicit “reviews on file; narrative text not loaded” line, with regression tests for pluralization and null dates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@matthewod11-stack
matthewod11-stack merged commit 8863823 into main Jul 17, 2026
8 checks passed
@matthewod11-stack
matthewod11-stack deleted the chore/orchestrator-issue-154-2026-07-16 branch July 17, 2026 16:38
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.

Chat context never includes performance review narratives — chat claims 'no performance data' while Prep Brief cites 18 items from the same DB

2 participants