Skip to content

Clinical trust: unsigned DSM specifiers read as pending, Clozapine overview reword, faster consumer refusals - #3552

Merged
gitar-bot[bot] merged 21 commits into
mainfrom
claude/clinical-trust-fixes-tjkl77
Oct 15, 2026
Merged

gitar-bot[bot] merged 21 commits into
mainfrom
claude/clinical-trust-fixes-tjkl77

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

User description

Requested by Josh · project thread

Summary

Before: 71 DSM-5-TR specifier pages and 18 universal specifiers read "Definition reviewed by PsychSift" and showed their generated definition as clinician reviewed, although no named clinician signed them. The Clozapine overview read as if the adverse effects themselves require registration.

After: those 89 entries read "Pending qualified review" and their definitions are withheld until a named clinician signs them, the same rule the site-wide "Not signed off yet" line already uses. The Clozapine overview reads: "Antipsychotic for treatment-resistant schizophrenia. Treatment requires registration and blood monitoring through the clozapine monitoring service because of serious, potentially fatal adverse effects."

How: isSpecifierClinicianReviewed now requires isNamedPerson(reviewedBy) instead of any non-empty string. One sentence changed in data/medications-snapshot.json. The sign-off queue grows from 514 to 603 specifier rows. Each change is its own commit so either can be dropped.

Areas touched: Clinical reference content, Prototypes

Verification

  • Checks run:
    • npm run test:focused for the specifier change: 412 of 413 passed, the one failure was an outdated assertion, now fixed; the three specifier test files then passed 21 and 15 of 15.
    • npm run test:focused -- --files data/medications-snapshot.json: "Tests 825 passed (825)".
    • eslint on changed files clean, typecheck:internal pass.

Risk and rollout

  • Risk: clinical display. The change is more conservative only: fewer specifier definitions show until signed. Clinical Ask also stops treating those 89 as signed evidence (catalogue-evidence.ts reads the same helper).
  • Rollback: revert either commit.
  • Provider or production effects: None. No migration, no RAG ranking files.

Notes

  • Clinical text. Stays draft until Josh signs off the Clozapine wording.

🤖 Generated with Claude Code

https://claude.ai/code/session_016H8cG4UfVRH56goC9AVmL2

Generated by Claude Code

Summary by cubic

DSM specifiers stamped with the product name "PsychSift" instead of a named clinician now read as "Pending qualified review", and their definitions are withheld until a named clinician signs them, so the 71 DSM-5-TR specifier pages and 18 universal specifiers stamped by the 2026-09-26 reconcile no longer count as signed evidence. The review tool and sign-off queue apply the same named-clinician rule the site uses, and unsigned definition wording is no longer sent to Clinical Ask synthesis. The Clozapine overview now says treatment requires registration and blood monitoring because of serious adverse effects, and the medication import script preserves this wording on refreshes. Consumer questions the pattern guard already refuses skip the LLM classifier, keeping unsupported-route refusals under the 4 s latency gate.

  • The sign-off queue grows from 514 to 603 specifier rows; a product-stamped record now shows no reviewer fields until a real sign-off overwrites it.
  • The static manifest baseline now records those 71 specifiers as unverified (ineligible) rather than locally_reviewed, and the decision record is catalogued in the repo-awareness snapshot.
  • The classifier bypass only applies when every word in the query comes from a closed list of plainly non-clinical shopping-and-household words; anything else keeps the model in the loop.

Written for commit 46cefa0. Summary will update on new commits.

View guided diff Turn on auto-fix

Summary by Gitar

  • Retrieval behavior:
    • Consumer questions the pattern guard already refuses skip the LLM classifier in analyzeQueryWithClassifierFallback
  • Medication import:
    • scripts/import-medications-export.ts keeps the signed-off Clozapine overview wording on export refresh
  • Site-content manifest:
    • Baseline marks the specifier records validation_unverified and ineligible, with contentHash and digests refreshed

This will update automatically on new commits.

Summary by CodeRabbit

  • Clinical Information

    • Clarified that clozapine treatment requires registration and blood monitoring through the monitoring service because of serious, potentially fatal side effects.
    • Clinical definitions and notes are shown as reviewed evidence only after clinician review; other context remains available.
  • Review Status

    • Entries without a valid sign-off from a named clinician remain pending review. The reported pending-review count is now 585.
  • Search and Responses

    • Common non-clinical consumer questions are identified as unsupported without additional classification, while queries with psychiatric context continue through review.

CodeAnt-AI Description

Make clinical review status and medication guidance clearer, and speed up unsupported consumer-query refusals

What Changed

  • Specifier entries count as clinician-reviewed only when signed by a named person. The 89 entries attributed to “PsychSift” now show as pending, and their definitions are withheld until a clinician signs them.
  • The Clozapine overview now makes clear that treatment requires registration and blood monitoring because of serious adverse effects.
  • Everyday shopping and household questions already identified as unsupported skip the classifier and receive a refusal sooner. Questions with clinical context still reach the classifier.

Impact

✅ Unsigned specifier definitions stay hidden
✅ Clearer clozapine monitoring guidance
✅ Faster consumer-query refusals

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The approved line read as if the adverse effects themselves require
registration. Reworded so treatment requires registration and blood
monitoring because of those effects. Clinical text, pending Josh's sign-off.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016H8cG4UfVRH56goC9AVmL2
The 2026-09-26 reconcile stamped 71 specifier items and 18 universals
"clinician-reviewed" by "PsychSift". Those pages read "Definition reviewed
by PsychSift" and showed the generated definition as reviewed. The sign-off
test now requires a named person, the same rule the site-wide sign-off line
uses, so those 89 read as pending and their definitions are withheld until a
named clinician signs them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016H8cG4UfVRH56goC9AVmL2
@BigSimmo BigSimmo self-assigned this Oct 15, 2026
@supabase

supabase Bot commented Oct 15, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: BigSimmo/PsychSift/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 2707c6dd-5748-4dc7-99a4-b044e1473753
📥 Commits

Reviewing files that changed from the base of the PR and between f9bf148 and 46cefa0.

📒 Files selected for processing: 10
  • data/repo-awareness-snapshot.json
  • docs/decisions/2026-10-15-specifiers-need-a-named-sign-off.md
  • docs/evidence/pr-3143-owner-signoff-confirmation.md
  • scripts/lib/clinical-record-review-contract.mjs
  • src/lib/rag/rag-classifier-fallback.ts
  • src/lib/rag/rag-query-guard.ts
  • tests/clinical-ask-catalogue-evidence.test.ts
  • tests/clinical-signoff-kinds.test.ts
  • tests/fixtures/site-content/static-manifest-baseline.json
  • tests/rag-classifier-memo.test.ts
🚧 Files skipped from review as they are similar to previous changes: 1
  • tests/fixtures/site-content/static-manifest-baseline.json

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

📝 Walkthrough

This pull request changes specifier clinician-review validation, pending counts, sign-off queue output, and evidence extraction. It adds a deterministic refusal check before classifier fallback for some non-clinical consumer queries. It also updates Clozapine overview text and medication import normalization.

Changes: Specifier review and evidence

Layer / File(s) Summary
Validate specifier sign-offs and pending counts
scripts/lib/clinical-record-review-contract.mjs, src/lib/specifiers-content.ts, data/specifiers-content.json, src/lib/developer-area/sign-off-queue.ts, tests/sign-off-queue.test.ts, tests/specifier-clinician-review.test.ts, tests/specifier-reference-review.dom.test.tsx, tests/clinical-signoff-kinds.test.ts, docs/decisions/*, docs/evidence/pr-3143-owner-signoff-confirmation.md, data/repo-awareness-snapshot.json, tests/fixtures/site-content/static-manifest-baseline.json
Specifier review requires a named-person reviewer and a valid UTC ISO timestamp. Invalid review details are hidden. Pending counts and queue inclusion use these checks. Counts, queue assertions, reviewer fixtures, sign-off tests, decision documentation, and manifest records are updated.
Gate specifier evidence by review status
src/lib/clinical-ask/catalogue-evidence.ts, tests/clinical-ask-catalogue-evidence.test.ts
Definition meaning and clinical-note text are included only for clinician-reviewed items. Unreviewed items are marked as needing review.

Deterministic consumer refusals

Layer / File(s) Summary
Bypass classifier for deterministic refusals
src/lib/rag/rag-query-guard.ts, src/lib/rag/rag-classifier-fallback.ts, tests/rag-classifier-memo.test.ts
A query guard identifies eligible non-clinical consumer refusals. Classifier fallback returns early for matching queries. Tests cover consumer queries and clinical-context queries.

Clozapine overview

Layer / File(s) Summary
Update Clozapine treatment overview
scripts/import-medications-export.ts, data/medications-snapshot.json
The importer replaces the Overview row for Clozapine records with the updated text. The text states that treatment requires registration and blood monitoring through the monitoring service.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Fallback as rag-classifier-fallback
  participant Guard as isDeterministicNonClinicalConsumerRefusal
  participant Classifier as Generative classifier
  Fallback->>Guard: Check query and analysis
  Guard-->>Fallback: Return refusal result
  Guard-->>Fallback: Return false for other queries
  Fallback->>Classifier: Classify when refusal is false
Loading
Merge Risk: 🟡 Moderate · up to 46cef

The Clozapine overview wording is clinically sensitive and still awaiting sign-off, and the import script may overwrite it from a separate repository. Confirm the approved wording is updated at its source before merging. The specifier sign-off and refusal changes look consistent.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 13 files. (4 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the three main changes: stricter DSM specifier sign-off, the Clozapine overview rewording, and faster consumer-query refusals. It is concise and directly related to the ch…
Description check Passed The description includes the required Summary, Verification, Risk and rollout, and Notes sections. It explains the clinical, medication, classifier, testing, rollback, and production-impact details. T…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 13 files. (4 skipped: 4 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

Comment @coderabbitai help to get the list of available commands.

@codeant-ai

codeant-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🏁 CodeAnt Quality Gate Results

Commit: 46cefa04
Scan Time: 2026-10-15 13:39:25 UTC

✅ Overall Status: PASSED

Quality Gate Details

Quality Gate Status Details
Secrets ✅ PASSED 0 secrets found
Duplicate Code ✅ PASSED 0.0% duplicated
SAST ✅ PASSED No security issues
Bugs ✅ PASSED Rating S: No bugs
IAC ✅ PASSED No IAC issues

View Full Results

Comment thread src/lib/specifiers-content.ts Resolved
Comment thread src/lib/specifiers-content.ts Resolved
@BigSimmo
BigSimmo marked this pull request as ready for review October 15, 2026 11:21

@greptile-apps greptile-apps Bot 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.

BigSimmo has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@codeant-ai

codeant-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 46cefa0 Oct 15, 2026 · 13:03 13:10
✅ Reviewed your PR 4751f96 Oct 15, 2026 · 11:21 11:27

@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@claude

claude Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T11:24:08.343052Z 4751f96 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Oct 15, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Require named clinician sign-off for specifiers and clarify Clozapine overview

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Treat product-attributed specifiers as pending, withholding their definitions until a named
 clinician signs off.
• Include 89 additional specifiers in the sign-off queue and cover the stricter rule with tests.
• Clarify that Clozapine treatment requires registration and blood monitoring because of serious
 adverse effects.
Diagram

graph TD
  Data[("Specifier catalog")] --> Gate["Named reviewer gate"] --> Page["Reference page"]
  Gate --> Queue["Sign-off queue"]
  Gate --> Ask["Clinical Ask"]
  Med[("Medication snapshot")] --> Loader["Snapshot loader"] --> Overview["Medication overview"]
Loading
High-Level Assessment

Keep the shared-predicate approach: it applies the existing named-person rule consistently across specifier consumers without rewriting review data or changing each display surface independently. The Clozapine correction is appropriately confined to its source text.

Files changed (5) +37 / -20

Bug fix (2) +9 / -6
medications-snapshot.jsonClarify Clozapine treatment requirements +1/-1

Clarify Clozapine treatment requirements

• Rewords the overview so registration and blood monitoring clearly apply to treatment, rather than to the adverse effects themselves.

data/medications-snapshot.json

specifiers-content.tsRequire a named reviewer for specifier sign-off +8/-5

Require a named reviewer for specifier sign-off

• Uses the existing named-person check instead of accepting any non-empty reviewer string. Product-attributed entries now fail the shared clinician-review test.

src/lib/specifiers-content.ts

Tests (3) +28 / -14
sign-off-queue.test.tsAccount for newly unsigned specifiers in the queue +9/-5

Account for newly unsigned specifiers in the queue

• Raises the expected specifier queue count from 514 to 603 and checks row membership against the shared review predicate, including universals whose stored status still says reviewed.

tests/sign-off-queue.test.ts

specifier-clinician-review.test.tsTest rejection of product and role reviewers +15/-7

Test rejection of product and role reviewers

• Adds cases confirming that product and role names read as pending. Updates valid sign-off fixtures to use a name accepted by the named-person check.

tests/specifier-clinician-review.test.ts

specifier-reference-review.dom.test.tsxKeep signed-page coverage with a valid reviewer +4/-2

Keep signed-page coverage with a valid reviewer

• Updates the signed fixture and expected attribution so the page test continues to verify definition display for a valid named reviewer.

tests/specifier-reference-review.dom.test.tsx

A question the consumer pattern guard already refuses ("best coffee machine
for my kitchen") still went to the LLM query classifier before the
short-circuit refused it. On the 13 Oct canary that wait made four refusals
take 1.6 to 6.4 s, putting the unsupported route p95 at 6,360 ms against its
4,000 ms gate. The classifier is now skipped for these, as it already is for
adversarial and outside-corpus medical queries. Queries with psychiatric or
clinical context, a medication, a threshold or a document title still reach
the model.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016H8cG4UfVRH56goC9AVmL2

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4751f967b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/specifiers-content.ts Resolved
@qodo-code-review

qodo-code-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

No findings for this group


Remediation recommended

No findings for this group


Informational

No findings for this group

Grey Divider


Resolved findings

1. Saved specifier sign-offs stay pending ✓ Resolved
Description
isNamedSpecifierReviewer() accepts attributions such as "Clinician Smith" because its
excluded-word list is narrower than the site's isNamedPerson() check. If that attribution is
entered in the review tool, the tool saves the specifier as signed off, but the site rejects the
attribution and continues to withhold its definition.
Code

scripts/lib/clinical-record-review-contract.mjs[R184-185]

+  const nameWords = words.filter((word) => !titles.has(word.toLowerCase()));
+  return nameWords.length >= 2 && !nameWords.some((word) => /^(?:psychsift|system|pending|placeholder)$/i.test(word));
Relevance

●●● Strong

Accepted precedent rejects automated or role attributions; aligning sign-off validation with the
site gate is a direct correctness fix.

PR-#2304

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The tool's new predicate excludes only four words, while the site's named-person check also excludes
clinician. The new sign-off guard uses the tool predicate; successful sign-offs are written and
reported as saved, whereas specifier rendering uses the site predicate.

scripts/lib/clinical-record-review-contract.mjs[176-195]
scripts/lib/clinical-record-review-contract.mjs[960-979]
scripts/review-clinical-record.mjs[869-880]
src/lib/admin/rule-sign-off.ts[84-136]
src/lib/specifiers-content.ts[81-87]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The specifier review tool accepts some reviewer attributions that the site's sign-off gate rejects, so a saved sign-off can remain pending on the site.

## Fix Focus Areas
- scripts/lib/clinical-record-review-contract.mjs[174-196]
- src/lib/admin/rule-sign-off.ts[84-136]

## Recommended Fix
Make the review tool enforce the same named-person rule as the site, including its role and system-name exclusions. Add a test that rejects a two-word attribution such as "Clinician Smith" before it can be saved.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Clinical searches can return no results ✓ Resolved
Description
isDeterministicNonClinicalConsumerRefusal() treats its clinical-word list as exhaustive and skips
classification when a query contains a consumer trigger but no listed rescue term. For example,
"holiday leave for akathisia" matches the consumer trigger but omits every rescue term, so the
bypass prevents classification and corpus grounding before the unsupported-search path returns no
results for a clinical topic present in the corpus.
Code

src/lib/rag/rag-classifier-fallback.ts[R190-192]

+    // A plainly non-clinical consumer question ("best coffee machine") with no clinical word the
+    // model could rescue it on: the classifier would only add latency before the same refusal.
+    isDeterministicNonClinicalConsumerRefusal(query, analysis)
Relevance

●●● Strong

Recent guard-pattern precedent accepted restoring omitted clinical terms; akathisia similarly needs
classifier rescue before refusal.

PR-#2698

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
holiday is a consumer trigger, but akathisia is absent from the new rescue pattern and is
documented as a psychiatric adverse-effect topic in the corpus. The new early return precedes corpus
grounding and classifier invocation; the unchanged unsupported-search path can then return an empty
result without retrieval.

src/lib/rag/rag-query-guard.ts[3-4]
src/lib/rag/rag-query-guard.ts[88-99]
src/lib/rag/rag-query-guard.ts[120-145]
src/lib/rag/rag-classifier-fallback.ts[186-205]
src/lib/rag/rag.ts[1330-1367]
data/differentials/differentials.json[1536-1545]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The consumer-refusal bypass can classify a query containing an unlisted clinical topic as plainly non-clinical, preventing both classifier recovery and corpus grounding.

## Fix Focus Areas
- src/lib/rag/rag-query-guard.ts[120-132]
- src/lib/rag/rag-classifier-fallback.ts[186-194]

## Recommended Fix
Limit the early bypass to queries that can be established as non-clinical without relying on an exhaustive clinical-term regex; keep ambiguous consumer-plus-topic queries eligible for classification or corpus grounding. Add a regression test using an in-corpus topic such as akathisia alongside a consumer trigger.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Unsigned definitions feed answers ✓ Resolved
Description
specifierEvidence() still puts definition.meaning and definition.clinicalNote into the
Clinical Ask extract when the revised isSpecifierClinicianReviewed() rejects the reviewer; it
changes only the evidence's review label. When a question matches a PsychSift-attributed specifier,
synthesis receives that unsigned text even if external corroboration is unavailable, so it can use
the withheld definition in an answer.
Code

src/lib/specifiers-content.ts[84]

+    isNamedPerson(review.reviewedBy) &&
Relevance

●●● Strong

Unsigned clinical text must be withheld from answer evidence; prior clinical governance fixes
accepted projection-level withholding.

PR-#2838
PR-#2811

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The clinical skill requires tracing clinical claims through generation and verifying conservative
failure behavior. The changed predicate marks these entries pending, but the catalogue evidence path
still forwards their definition text to synthesis rather than withholding it.

src/lib/specifiers-content.ts[81-86]
src/lib/clinical-ask/catalogue-evidence.ts[178-203]
src/lib/clinical-ask/orchestrator.ts[140-183]
Skill: clinical

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Clinical Ask still sends specifier definitions to synthesis after the updated sign-off check marks them pending.
## Fix Focus Areas
- src/lib/specifiers-content.ts[81-86]
- src/lib/clinical-ask/catalogue-evidence.ts[178-203]
- tests/specifier-clinician-review.test.ts[140-146]
## Recommended Fix
Keep structural specifier evidence available if appropriate, but omit definition meaning and clinical notes from Clinical Ask extracts unless the specifier passes the clinician-review gate. Add a focused test using a PsychSift-attributed entry to verify that its definition never reaches synthesis.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View resolved (4)
4. Clinicians cannot sign pending specifiers ✓ Resolved
Description
isSpecifierClinicianReviewed now rejects the 89 records attributed to PsychSift, but
specifierView still converts their stored clinician-reviewed status to reviewed without
checking the reviewer. When a record’s content pin is current, the clinical-review tool treats it as
already signed and unchanged, so it does not offer the record for the named-clinician sign-off
needed to clear its new pending state.
Code

src/lib/specifiers-content.ts[84]

+    isNamedPerson(review.reviewedBy) &&
Relevance

●●● Strong

Queue eligibility must share the named-reviewer predicate; prior sign-off work accepted fixes
keeping review state consistent.

PR-#3221
PR-#3081

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed predicate makes PsychSift-attributed records pending, while the tool derives its status
solely from the stored status. Its queue and eligibility checks accept reviewed records for
re-signing only when their content pin is stale.

data/specifiers-content.json[5065-5075]
scripts/lib/clinical-record-review-contract.mjs[488-511]
scripts/lib/clinical-record-review-contract.mjs[775-782]
scripts/lib/clinical-record-review-contract.mjs[873-905]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Product-attributed specifiers now display as pending, but the clinical-review tool still treats their stored status as a completed sign-off and excludes unchanged records from sign-off.

## Fix Focus Areas
- src/lib/specifiers-content.ts[81-86]
- scripts/lib/clinical-record-review-contract.mjs[488-510]
- scripts/lib/clinical-record-review-contract.mjs[873-905]

## Recommended Fix
Make the specifier review tool classify a stored `clinician-reviewed` record with a non-person reviewer as needing sign-off. Ensure its eligibility and queue handling allow a named clinician to replace that attribution without requiring a content edit, while retaining the existing content-pin checks for valid sign-offs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Contextual query test misses the call ✓ Resolved
Description
The contextual consumer test awaits analyzeQueryWithClassifierFallback without asserting that the
mocked classifier was invoked. A regression that incorrectly skips classification for this query
could therefore pass while the test only proves the predicate returned false.
Code

tests/rag-classifier-memo.test.ts[R297-300]

+    const query = "kitchen safety for a patient with dementia and depression";
+    const analysis = analyzeClinicalQuery(query);
+    expect(isDeterministicNonClinicalConsumerRefusal(query, analysis)).toBe(false);
+    await rag.analyzeQueryWithClassifierFallback(query, analysis);
Relevance

●●● Strong

Accepted precedents strengthen regression tests by asserting mocked behavior, matching this test's
stated model-call intent.

PR-#3535
PR-#2313

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed test describes a query that must still reach the model, but it never asserts the mock
call count. The testing skill requires regression coverage for fallback behavior, and this omission
leaves the intended behavior unverified.

tests/rag-classifier-memo.test.ts[297-300]
Skill: testing-review

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

Issue description
The contextual consumer-query regression test does not prove that classifier fallback actually runs; it only checks the helper predicate and awaits the function.

Fix Focus Areas
- tests/rag-classifier-memo.test.ts[297-300]

Recommended Fix
Add `expect(mock).toHaveBeenCalledTimes(1)` after the fallback call, preserving the existing predicate assertion so the test verifies both eligibility and actual classifier invocation.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Clozapine correction disappears on refresh ✓ Resolved
Description
The revised clozapine Overview exists only in PsychSift’s bundled snapshot; BigSimmo/Medications
still supplies different wording in its canonical record. When import-medications-export.ts
refreshes the snapshot from that record, it copies sections unchanged and replaces this
correction.
Code

data/medications-snapshot.json[79088]

+            "val": "Antipsychotic for treatment-resistant schizophrenia. Treatment requires registration and blood monitoring through the clozapine monitoring service because of serious, potentially fatal adverse effects.",
Relevance

●●● Strong

Canonical importer overwrite is a concrete refresh regression; medication snapshot provenance and
wording corrections are reviewed closely.

PR-#2704
PR-#3019

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PsychSift contains the revised value, but the canonical Medications record has different Overview
wording. The importer prefers that canonical snapshot and writes its records, including their
unchanged sections, over PsychSift’s bundled file.

PsychSift -> Medications
data/medications-snapshot.json[79085-79089]
scripts/import-medications-export.ts[22-53]
scripts/import-medications-export.ts[82-103]
External repo: BigSimmo/Medications, README.md [26-29]
External repo: BigSimmo/Medications, scripts/src/drugs-snapshot.json [81000-81007]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A medication snapshot refresh will replace the revised Clozapine overview with the different wording in Medications’ canonical record.

## Fix Focus Areas
- data/medications-snapshot.json[79085-79089]
- scripts/import-medications-export.ts[82-103]
- /cross_repos/Medications/scripts/src/drugs-snapshot.json[81000-81007]

## Recommended Fix
After clinical sign-off, update the canonical Clozapine Overview in BigSimmo/Medications and regenerate PsychSift’s bundled snapshot from that source, or establish an explicit override that the importer preserves.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. The review queue understates pending items ✓ Resolved
Description
isSpecifierClinicianReviewed now counts the 71 PsychSift-attributed catalogue items as pending,
but the export’s itemsPendingClinicianReview statistic remains 514. The sign-off queue therefore
lists 603 pending rows while its note reports 514 catalogue items plus 18 universals, understating
the catalogue count by 71.
Code

src/lib/specifiers-content.ts[84]

+    isNamedPerson(review.reviewedBy) &&
Relevance

●●● Strong

The displayed queue note must match predicate-derived rows; prior queue work accepted accurate
catalogue and universal counts.

PR-#2883
PR-#3221

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The queue uses the changed predicate to select rows but prints the export’s unchanged statistic in
its note; the updated test expects 603 rows, while the export reports 514 pending catalogue items.

data/specifiers-content.json[18-25]
src/lib/developer-area/sign-off-queue.ts[401-445]
tests/sign-off-queue.test.ts[44-50]
scripts/lib/clinical-record-review-contract.mjs[537-549]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The sign-off queue filters with the new named-reviewer rule, but its explanatory note reads a stored pending count computed under the old status-only rule.

## Fix Focus Areas
- src/lib/specifiers-content.ts[81-86]
- src/lib/developer-area/sign-off-queue.ts[401-445]
- data/specifiers-content.json[18-25]
- scripts/lib/clinical-record-review-contract.mjs[537-549]

## Recommended Fix
Derive the queue note’s catalogue count from its filtered item rows, and reconcile the export statistic with the new rule. Update the review writer’s pending-count calculation so subsequent sign-offs do not restore the old status-only count.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 9 rules
✅ Cross-repo context — repo relationships
  Explored: repo: BigSimmo/Medications (sha: f0fe3d04) — View relationship
Review mode: Auto: ⚖️ Balanced: Two behavioral changes affect clinical trust and query routing.
✅ Fix-loop round: fix loop

Grey Divider

Tip of the day
💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 46cefa0

Results up to commit 4751f96 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required

No findings for this group


Remediation recommended

No findings for this group


Informational

No findings for this group


Resolved findings

1. Clinicians cannot sign pending specifiers ✓ Resolved
Description
isSpecifierClinicianReviewed now rejects the 89 records attributed to PsychSift, but
specifierView still converts their stored clinician-reviewed status to reviewed without
checking the reviewer. When a record’s content pin is current, the clinical-review tool treats it as
already signed and unchanged, so it does not offer the record for the named-clinician sign-off
needed to clear its new pending state.
Code

src/lib/specifiers-content.ts[84]

+    isNamedPerson(review.reviewedBy) &&
Relevance

●●● Strong

Queue eligibility must share the named-reviewer predicate; prior sign-off work accepted fixes
keeping review state consistent.

PR-#3221
PR-#3081

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed predicate makes PsychSift-attributed records pending, while the tool derives its status
solely from the stored status. Its queue and eligibility checks accept reviewed records for
re-signing only when their content pin is stale.

data/specifiers-content.json[5065-5075]
scripts/lib/clinical-record-review-contract.mjs[488-511]
scripts/lib/clinical-record-review-contract.mjs[775-782]
scripts/lib/clinical-record-review-contract.mjs[873-905]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Product-attributed specifiers now display as pending, but the clinical-review tool still treats their stored status as a completed sign-off and excludes unchanged records from sign-off.

## Fix Focus Areas
- src/lib/specifiers-content.ts[81-86]
- scripts/lib/clinical-record-review-contract.mjs[488-510]
- scripts/lib/clinical-record-review-contract.mjs[873-905]

## Recommended Fix
Make the specifier review tool classify a stored `clinician-reviewed` record with a non-person reviewer as needing sign-off. Ensure its eligibility and queue handling allow a named clinician to replace that attribution without requiring a content edit, while retaining the existing content-pin checks for valid sign-offs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Unsigned definitions feed answers ✓ Resolved
Description
specifierEvidence() still puts definition.meaning and definition.clinicalNote into the
Clinical Ask extract when the revised isSpecifierClinicianReviewed() rejects the reviewer; it
changes only the evidence's review label. When a question matches a PsychSift-attributed specifier,
synthesis receives that unsigned text even if external corroboration is unavailable, so it can use
the withheld definition in an answer.
Code

src/lib/specifiers-content.ts[84]

+    isNamedPerson(review.reviewedBy) &&
Relevance

●●● Strong

Unsigned clinical text must be withheld from answer evidence; prior clinical governance fixes
accepted projection-level withholding.

PR-#2838
PR-#2811

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The clinical skill requires tracing clinical claims through generation and verifying conservative
failure behavior. The changed predicate marks these entries pending, but the catalogue evidence path
still forwards their definition text to synthesis rather than withholding it.

src/lib/specifiers-content.ts[81-86]
src/lib/clinical-ask/catalogue-evidence.ts[178-203]
src/lib/clinical-ask/orchestrator.ts[140-183]
Skill: clinical

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Clinical Ask still sends specifier definitions to synthesis after the updated sign-off check marks them pending.
## Fix Focus Areas
- src/lib/specifiers-content.ts[81-86]
- src/lib/clinical-ask/catalogue-evidence.ts[178-203]
- tests/specifier-clinician-review.test.ts[140-146]
## Recommended Fix
Keep structural specifier evidence available if appropriate, but omit definition meaning and clinical notes from Clinical Ask extracts unless the specifier passes the clinician-review gate. Add a focused test using a PsychSift-attributed entry to verify that its definition never reaches synthesis.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Clozapine correction disappears on refresh ✓ Resolved
Description
The revised clozapine Overview exists only in PsychSift’s bundled snapshot; BigSimmo/Medications
still supplies different wording in its canonical record. When import-medications-export.ts
refreshes the snapshot from that record, it copies sections unchanged and replaces this
correction.
Code

data/medications-snapshot.json[79088]

+            "val": "Antipsychotic for treatment-resistant schizophrenia. Treatment requires registration and blood monitoring through the clozapine monitoring service because of serious, potentially fatal adverse effects.",
Relevance

●●● Strong

Canonical importer overwrite is a concrete refresh regression; medication snapshot provenance and
wording corrections are reviewed closely.

PR-#2704
PR-#3019

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PsychSift contains the revised value, but the canonical Medications record has different Overview
wording. The importer prefers that canonical snapshot and writes its records, including their
unchanged sections, over PsychSift’s bundled file.

PsychSift -> Medications
data/medications-snapshot.json[79085-79089]
scripts/import-medications-export.ts[22-53]
scripts/import-medications-export.ts[82-103]
External repo: BigSimmo/Medications, README.md [26-29]
External repo: BigSimmo/Medications, scripts/src/drugs-snapshot.json [81000-81007]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A medication snapshot refresh will replace the revised Clozapine overview with the different wording in Medications’ canonical record.

## Fix Focus Areas
- data/medications-snapshot.json[79085-79089]
- scripts/import-medications-export.ts[82-103]
- /cross_repos/Medications/scripts/src/drugs-snapshot.json[81000-81007]

## Recommended Fix
After clinical sign-off, update the canonical Clozapine Overview in BigSimmo/Medications and regenerate PsychSift’s bundled snapshot from that source, or establish an explicit override that the importer preserves.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View resolved (1)
4. The review queue understates pending items ✓ Resolved
Description
isSpecifierClinicianReviewed now counts the 71 PsychSift-attributed catalogue items as pending,
but the export’s itemsPendingClinicianReview statistic remains 514. The sign-off queue therefore
lists 603 pending rows while its note reports 514 catalogue items plus 18 universals, understating
the catalogue count by 71.
Code

src/lib/specifiers-content.ts[84]

+    isNamedPerson(review.reviewedBy) &&
Relevance

●●● Strong

The displayed queue note must match predicate-derived rows; prior queue work accepted accurate
catalogue and universal counts.

PR-#2883
PR-#3221

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The queue uses the changed predicate to select rows but prints the export’s unchanged statistic in
its note; the updated test expects 603 rows, while the export reports 514 pending catalogue items.

data/specifiers-content.json[18-25]
src/lib/developer-area/sign-off-queue.ts[401-445]
tests/sign-off-queue.test.ts[44-50]
scripts/lib/clinical-record-review-contract.mjs[537-549]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The sign-off queue filters with the new named-reviewer rule, but its explanatory note reads a stored pending count computed under the old status-only rule.

## Fix Focus Areas
- src/lib/specifiers-content.ts[81-86]
- src/lib/developer-area/sign-off-queue.ts[401-445]
- data/specifiers-content.json[18-25]
- scripts/lib/clinical-record-review-contract.mjs[537-549]

## Recommended Fix
Derive the queue note’s catalogue count from its filtered item rows, and reconcile the export statistic with the new rule. Update the review writer’s pending-count calculation so subsequent sign-offs do not restore the old status-only count.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit b58bbbc 🚀 Fast


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required

No findings for this group


Remediation recommended

No findings for this group


Informational

No findings for this group


Resolved findings

1. Contextual query test misses the call ✓ Resolved
Description
The contextual consumer test awaits analyzeQueryWithClassifierFallback without asserting that the
mocked classifier was invoked. A regression that incorrectly skips classification for this query
could therefore pass while the test only proves the predicate returned false.
Code

tests/rag-classifier-memo.test.ts[R297-300]

+    const query = "kitchen safety for a patient with dementia and depression";
+    const analysis = analyzeClinicalQuery(query);
+    expect(isDeterministicNonClinicalConsumerRefusal(query, analysis)).toBe(false);
+    await rag.analyzeQueryWithClassifierFallback(query, analysis);
Relevance

●●● Strong

Accepted precedents strengthen regression tests by asserting mocked behavior, matching this test's
stated model-call intent.

PR-#3535
PR-#2313

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changed test describes a query that must still reach the model, but it never asserts the mock
call count. The testing skill requires regression coverage for fallback behavior, and this omission
leaves the intended behavior unverified.

tests/rag-classifier-memo.test.ts[297-300]
Skill: testing-review

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

Issue description
The contextual consumer-query regression test does not prove that classifier fallback actually runs; it only checks the helper predicate and awaits the function.

Fix Focus Areas
- tests/rag-classifier-memo.test.ts[297-300]

Recommended Fix
Add `expect(mock).toHaveBeenCalledTimes(1)` after the fallback call, preserving the existing predicate assertion so the test verifies both eligibility and actual classifier invocation.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit f67d43e 🧠 Deep


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required

No findings for this group


Remediation recommended

No findings for this group


Informational

No findings for this group


Resolved findings

1. Saved specifier sign-offs stay pending ✓ Resolved
Description
isNamedSpecifierReviewer() accepts attributions such as "Clinician Smith" because its
excluded-word list is narrower than the site's isNamedPerson() check. If that attribution is
entered in the review tool, the tool saves the specifier as signed off, but the site rejects the
attribution and continues to withhold its definition.
Code

scripts/lib/clinical-record-review-contract.mjs[R184-185]

+  const nameWords = words.filter((word) => !titles.has(word.toLowerCase()));
+  return nameWords.length >= 2 && !nameWords.some((word) => /^(?:psychsift|system|pending|placeholder)$/i.test(word));
Relevance

●●● Strong

Accepted precedent rejects automated or role attributions; aligning sign-off validation with the
site gate is a direct correctness fix.

PR-#2304

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The tool's new predicate excludes only four words, while the site's named-person check also excludes
clinician. The new sign-off guard uses the tool predicate; successful sign-offs are written and
reported as saved, whereas specifier rendering uses the site predicate.

scripts/lib/clinical-record-review-contract.mjs[176-195]
scripts/lib/clinical-record-review-contract.mjs[960-979]
scripts/review-clinical-record.mjs[869-880]
src/lib/admin/rule-sign-off.ts[84-136]
src/lib/specifiers-content.ts[81-87]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The specifier review tool accepts some reviewer attributions that the site's sign-off gate rejects, so a saved sign-off can remain pending on the site.

## Fix Focus Areas
- scripts/lib/clinical-record-review-contract.mjs[174-196]
- src/lib/admin/rule-sign-off.ts[84-136]

## Recommended Fix
Make the review tool enforce the same named-person rule as the site, including its role and system-name exclusions. Add a test that rejects a two-word attribution such as "Clinician Smith" before it can be saved.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Clinical searches can return no results ✓ Resolved
Description
isDeterministicNonClinicalConsumerRefusal() treats its clinical-word list as exhaustive and skips
classification when a query contains a consumer trigger but no listed rescue term. For example,
"holiday leave for akathisia" matches the consumer trigger but omits every rescue term, so the
bypass prevents classification and corpus grounding before the unsupported-search path returns no
results for a clinical topic present in the corpus.
Code

src/lib/rag/rag-classifier-fallback.ts[R190-192]

+    // A plainly non-clinical consumer question ("best coffee machine") with no clinical word the
+    // model could rescue it on: the classifier would only add latency before the same refusal.
+    isDeterministicNonClinicalConsumerRefusal(query, analysis)
Relevance

●●● Strong

Recent guard-pattern precedent accepted restoring omitted clinical terms; akathisia similarly needs
classifier rescue before refusal.

PR-#2698

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
holiday is a consumer trigger, but akathisia is absent from the new rescue pattern and is
documented as a psychiatric adverse-effect topic in the corpus. The new early return precedes corpus
grounding and classifier invocation; the unchanged unsupported-search path can then return an empty
result without retrieval.

src/lib/rag/rag-query-guard.ts[3-4]
src/lib/rag/rag-query-guard.ts[88-99]
src/lib/rag/rag-query-guard.ts[120-145]
src/lib/rag/rag-classifier-fallback.ts[186-205]
src/lib/rag/rag.ts[1330-1367]
data/differentials/differentials.json[1536-1545]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The consumer-refusal bypass can classify a query containing an unlisted clinical topic as plainly non-clinical, preventing both classifier recovery and corpus grounding.

## Fix Focus Areas
- src/lib/rag/rag-query-guard.ts[120-132]
- src/lib/rag/rag-classifier-fallback.ts[186-194]

## Recommended Fix
Limit the early bypass to queries that can be established as non-clinical without relying on an exhaustive clinical-term regex; keep ambiguous consumer-plus-topic queries eligible for classification or corpus grounding. Add a regression test using an in-corpus topic such as akathisia alongside a consumer trigger.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread src/lib/specifiers-content.ts Resolved
Comment thread src/lib/specifiers-content.ts Resolved
Comment thread src/lib/specifiers-content.ts Resolved
Comment thread data/medications-snapshot.json Resolved
@BigSimmo BigSimmo changed the title Clinical trust: unsigned DSM specifiers read as pending, Clozapine overview reword Clinical trust: unsigned DSM specifiers read as pending, Clozapine overview reword, faster consumer refusals Oct 15, 2026
Comment thread src/lib/rag/rag-classifier-fallback.ts Resolved
@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

1 code suggestion

1. This now marks 71 PsychSift-attributed catalogue entries pending, but the queue note still uses the unchanged 514 count and understates pending items by 71.

Logic error · src/lib/specifiers-content.ts:84

Copy link
Copy Markdown
Owner Author

Status of the red checks on this PR.

  • Static PR checks / PR required: scripts/build-site-content-manifest.ts --check fails because the specifier change moves 71 specifier records out of the eligible site-content set (the local diff shows 71 changed, 0 added, 0 removed). The Clozapine edit does not affect the manifest. This failure is caused by this PR.
  • Why it is not fixed yet: Codex pointed to docs/evidence/pr-3143-owner-signoff-confirmation.md, where the owner confirmed that the PsychSift attribution on these sign-offs stands for him. That conflicts with the 13 Oct handover instruction to relabel them "Not signed off yet". I have asked the owner to decide in the project thread.
    • If he keeps the relabel, I will regenerate the manifest baseline. I will also fix the review tool so a named clinician can re-sign these records (Qodo 1, Gitar), derive the queue note from the listed rows (Qodo 3, Gitar), and withhold unsigned definitions from Clinical Ask extracts (Qodo 2), all in one push.
    • If he keeps them as signed, I will drop the specifier commit and the manifest check will pass again.
  • Qodo 4 (Clozapine wording replaced on the next snapshot import): this is correct. The canonical record lives in the separate Medications repo, which this session cannot reach. The owner-approved wording needs to be made there as well before the next import.

Generated by Claude Code

@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo Fixer

✅ Committed (4) · ☑ Fixed (4)

Grey Divider

Commits pushed directly to this PR — no separate fix PR opened.

Process — 4 fixed
  • ☑ Fixed: Unsigned definitions feed answers
  • ☑ Fixed: Clinicians cannot sign pending specifiers
  • ☑ Fixed: Clozapine correction disappears on refresh
  • ☑ Fixed: The review queue understates pending items

@gitar-bot
gitar-bot Bot enabled auto-merge (squash) October 15, 2026 11:58
gitar-bot[bot]
gitar-bot Bot previously approved these changes Oct 15, 2026

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gitar has auto-approved this PR (configure)

The review contract's specifier reviewer check accepted role names such as
"Clinical Team" that the site's isNamedPerson rejects. It now mirrors the
same rule and role-word list, pinned by a parity test.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016H8cG4UfVRH56goC9AVmL2
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016H8cG4UfVRH56goC9AVmL2
Comment thread src/lib/rag/rag-classifier-fallback.ts Resolved
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit f67d43e

A list of clinical words to watch for can never be complete, so a query
such as "holiday leave for akathisia" could still be refused unchecked.
The bypass now requires every word to come from a closed list of everyday
shopping and household words; anything else keeps the classifier.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016H8cG4UfVRH56goC9AVmL2
@cubic-dev-ai

cubic-dev-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Auto-fix: 2 checks fixed. View session →

  • PR required: Fixed. This gate failed only because static-pr failed (browser lanes were deferred); coverage and build were already green. The snapshot fix in 0c814d3 clears the only failing static step, so it should pass on the re-run. (0c814d3)
  • Static PR checks: Fixed. The committed repo-awareness snapshot didn't list the new docs/decisions/2026-10-15-specifiers-need-a-named-sign-off.md, so check:repo-awareness-snapshot failed. I regenerated it with npm run snapshot:repo-awareness; the check now passes locally and the neighbouring docs and instruction checks pass too. (0c814d3)

The committed data/repo-awareness-snapshot.json did not list
docs/decisions/2026-10-15-specifiers-need-a-named-sign-off.md, so
`check:repo-awareness-snapshot` reported documentation differing from the
repository. Regenerated with `npm run snapshot:repo-awareness`; the only change
is that one catalogued decisions entry.
gitar-bot[bot]
gitar-bot Bot previously approved these changes Oct 15, 2026

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gitar has auto-approved this PR (configure)

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gitar has auto-approved this PR (configure)

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 7057a28

@qodo-code-review

qodo-code-review Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

No code changes since the last review — review skipped

Qodo Logo

@codeant-ai codeant-ai Bot added size:XL This PR changes 500-999 lines, ignoring generated files and removed size:M This PR changes 30-99 lines, ignoring generated files labels Oct 15, 2026
@gitar-bot

gitar-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor
Code Review ✅ Approved 4 closed / 4 findings

🟡 Medium risk · Changing specifier sign-off gating and bypassing classification for consumer queries could hide definitions awaiting review or prematurely refuse ambiguous questions.

Requires a named clinician sign-off before DSM specifier definitions show as reviewed, and rewords the Clozapine overview to state that treatment requires registration and blood monitoring because of serious adverse effects. Resolved this session: the clinical review tool now rejects the same reviewer names the display treats as pending, the specifier family note reports the full pending count, a syntax issue after applyClinicalReview is fixed, and the classifier bypass no longer skips clinical queries that contain consumer words. No issues found.

✅ 4 closed
✅ Bug: clinical:review still accepts reviewers the display now treats as pending

📄 src/lib/specifiers-content.ts:81-87
isSpecifierClinicianReviewed now requires isNamedPerson(reviewedBy): at least two name words after a title, and none of them in the role/system list. The tool that writes these sign-offs (npm run clinical:review -- --kind specifier, in scripts/review-clinical-record.mjs) still checks only reviewerAttributionProblem → publicReviewerAttributionProblem, which accepts single-word or title-plus-surname names such as "Josh" or "Dr Smith". Nothing in scripts/ other than sign-today-rules.ts calls isNamedPerson.

So a clinician can run the tool, see it succeed, and commit a clinician-reviewed stamp. The entry then still renders "Pending qualified review", its definition stays withheld, and it stays in the queue, with nothing telling them why. Fix: in the specifier branch of the review script, reject any reviewer that fails isNamedPerson (or the same rule ported to the .mjs contract), so the write side and the read side agree.

✅ Quality: Specifier family note still reports only the export's pending count

📄 src/lib/specifiers-content.ts:84 📄 tests/sign-off-queue.test.ts:203-210
The specifiers family note in src/lib/developer-area/sign-off-queue.ts still reads "The export's own stats record ${content.stats.itemsPendingClinicianReview} specifier items pending … and a further ${universals.length} … universal specifiers carry the same pending status". After this change the queue lists 585 items, but the note still says 514, because itemsPendingClinicianReview doesn't count the 71 "PsychSift"-stamped items. The note also says all 18 universals are clinician-review-pending, while their status is actually clinician-reviewed by a product name (the test regex was loosened to allow this). So the page describes records that differ from the rows it shows, which is the mismatch that code comment says the queue must never have. Fix: build the note from items.length, and say that some rows are product-attributed stamps rather than pending ones.

✅ Bug: Leftover text after applyClinicalReview breaks the review contract

📄 scripts/lib/clinical-record-review-contract.mjs:993-1001
A leftover piece of the old applyClinicalReview body (tions: nextRecords.length, ... return next; }) was appended after the function's closing brace at lines 993-1001. node --check scripts/lib/clinical-record-review-contract.mjs fails with SyntaxError: Unexpected token ':' at line 994. Because of that, every importer of this module fails to load, including clinical:review, the sign-off tooling and the tests that use the contract. This is also the kind of truncation leftover that check:diff-integrity is meant to catch. Fix: delete lines 993-1001 so the file ends at the real closing brace of applyClinicalReview.

✅ Bug: Skipping classifier removes its rescue of clinical queries with consumer words

📄 src/lib/rag/rag-classifier-fallback.ts:189-194 📄 src/lib/rag/rag-query-guard.ts:121-123 📄 tests/rag-classifier-memo.test.ts:292-301
The new comment says the consumer refusal fires "whatever the model says". The code shows otherwise. Before this change, applyClassifierVerdict (rag-classifier-fallback.ts:143-166) could take a confident non-unsupported_or_general verdict and rewrite queryClass, adding a classifier_fallback reason. After that, unsupportedSoftTailEligible returns false and shouldShortCircuitUnsupportedSearch does not refuse. So the classifier was the only way back for psychiatric questions that contain a word from clearlyNonClinicalConsumerPattern (kitchen, gaming, holiday, restaurant, recipe, phone...) but no word from the fairly narrow psychiatricOrClinicalContextPattern. That pattern has no dementia, ADHD, autism, eating disorder, anorexia, addiction, alcohol, insomnia and so on. For example, "kitchen safety in dementia" or "gaming addiction in teenagers" are now refused without any check, where the model could previously have rescued them. The added test only passes because its query also contains depression/patient. To fix this, either limit the bypass to queries the classifier provably cannot rescue, or widen psychiatricOrClinicalContextPattern before adding the bypass. Also correct the comment. The second test should assert expect(mock).toHaveBeenCalled(), because right now it never checks that the model was asked, which is what its title says it tests.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Approved

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Important

Your trial ends in 6 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.

Was this helpful? React with 👍 / 👎 | Gitar

@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; specifier sign-offs without a named reviewer fail closed, and unsigned definitions are excluded from clinical-ask synthesis.
  • The classifier bypass uses a closed word allowlist, so unlisted or clinical terms retain the classifier fallback.
  • Tests cover the sign-off gate, withholding unsigned definitions, and both the bypass and fallback paths.

Assessed commit: 46cefa041ad5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔴 Large blast radius size:XL This PR changes 500-999 lines, ignoring generated files 🕐 20-40 Minutes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants