chore: resolve issue #154 — surface narrative reviews in chat context - #156
Merged
Merged
Conversation
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>
|
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. |
5 tasks
There was a problem hiding this comment.
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
EmployeeContextretrieval to includereview_countandlatest_review_datefromperformance_reviewsfor 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.
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.
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/readperformance_ratingsand had zero references toperformance_reviews, andprompt.rsgated the whole Performance section onall_ratingsbeing 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.rs—EmployeeContextgainsreview_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
cargo test --manifest-path src-tauri/Cargo.tomlnpm run type-check(tsc --noEmit) cleanget_employee_contextprompt.rsgate alone makes the regression tests fail, so the lock is genuine rather than vacuousThe 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-touchhonored — no changes undersrc-tauri/src/people_map/orsrc-tauri/src/recruiting/bail-ifnot triggered: the system-prompt token-budget contract and provider payload shape are unchanged🤖 Generated with Claude Code