Skip to content

fix(rag): retry unverified numeric answers safely - #1861

Closed
BigSimmo wants to merge 5 commits into
mainfrom
codex/rag-numeric-grounding-231
Closed

fix(rag): retry unverified numeric answers safely#1861
BigSimmo wants to merge 5 commits into
mainfrom
codex/rag-numeric-grounding-231

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Treats deterministic unverifiedNumericTokens as the specific provider-safe reason numeric_faithfulness_gap rather than flattening the failure into a generic generation-quality token.
  • Feeds that signal into the existing fast-to-strong retry with bounded instructions requiring exact source digits and units.
  • Does not add a provider attempt, extend any timeout, weaken a quality gate, alter retrieval or ranking, or change the conservative extractive fallback.
  • Adds allowlisted failure parsing plus focused regression coverage for an unsupported 500 mg fast answer repaired to the cited 250 mg.

Conflict-resolution note

Current main was merged at a5f03ccc3390803a2b9de1d91701cf3a9d0455a8 in commit 4760b5e8c0d2a41043a7a947555e40bd9255cccd. The canonical docs/branch-review-ledger.md and docs/outstanding-issues.md mutations were deliberately not replayed over newer repository history. The post-resolution diff contains five implementation and test files; task #231 remains open and current-main ledger state remains authoritative.

RAG impact: no retrieval behaviour change. This modifies generation-quality classification and the existing fast-to-strong synthesis retry only. Retrieval, ranking, selection, ordering, provider-attempt count, route budgets, caching, and fallback authority are unchanged.

Verification

  • Prior identical implementation: tests/rag-generation-failure.test.ts and tests/rag-answer-fallback.test.ts passed 93/93 tests.
  • Prior identical implementation: offline RAG validation passed 23/23 files, 575/575 tests, and 36 golden cases.
  • Prior current-main-based checks: lint and typecheck passed. Formatting and repository ledger guards passed before the stale canonical-ledger files were removed from the final diff.
  • Fresh conflict check: GitHub reports head 4760b5e8c0d2a41043a7a947555e40bd9255cccd mergeable against current main.
  • Fresh hosted checks: Secret Scan passed. SAST and CI are running on the conflict-resolution head.
  • Full release verification and provider-backed evaluations were not run. This remains a draft PR and no release-confidence claim is made.

Risk and rollout

  • Risk: This changes answer-generation behaviour when a fast model introduces an unverified number. The strong retry receives stricter source-verbatim numeric instructions. If generation still fails or times out, the existing grounded extractive fallback remains authoritative.
  • Rollback: revert this PR. The independently merged generation-fallback cache exclusion remains unaffected.
  • Provider or production effects: none during this conflict-resolution sweep.

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo and synthetic content remain separated from real clinical sources
  • Source metadata, review status, and unknown-source behaviour remain conservative
  • Deployment classification and TGA SaMD impact were checked

Notes

This remains a draft because the deterministic repair is proven offline, while the normal-budget live canary timed out before model synthesis and did not validate the repaired live synthesis path. Do not repeat the unchanged canary, increase route or provider timeouts, add provider attempts, weaken numeric-quality gates, or cache generation fallbacks.

@supabase

supabase Bot commented Aug 12, 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 Aug 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a6fd0560-29b0-4309-88fc-50e7d09a7b88

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Copy link
Copy Markdown
Owner Author

Adjudication against PR #1899 (claude/lithium-generation-quality-debug-ji1vce), per the operator's request on ledger #231:

This draft is superseded for Phase 1 and is being closed. Rationale:


Generated by Claude Code

BigSimmo pushed a commit that referenced this pull request Aug 13, 2026
…ate PR #1861

- scripts/probe-generation-quality.ts: one cache-bypassed live answer reporting
  the structured generation_quality_gate_reasons (provider-backed, refuses demo
  mode, never caches or logs the probe)
- ledger: record the #1861 adjudication (superseded for phase 1, close
  recommended; numeric-retry half deferred to phase 2 pending probe evidence)
- issues #231: operator approvals recorded; probe blocked in this container
  (no provider env), ready-to-run command documented

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017SncTkA9eTQfRE6dL462xZ
Resolve the stale-base conflicts while preserving the bounded numeric-faithfulness retry, provider-safe failure parsing, and regression coverage. Keep the canonical branch-review and outstanding-issues ledgers at current main; feature-branch ledger state is not replayed over newer repository history.
@BigSimmo BigSimmo closed this Aug 13, 2026
BigSimmo pushed a commit that referenced this pull request Aug 14, 2026
…s instrument now exists

Four corrections, queued as immutable inbox requests.

#235, #237 and #238 each had a `done` queued in PR #1940 and cancelled on
review. The cancellations were right: all three ask for visual or browser
proof and were closed on executable evidence. Each row now records the
attempt, the reason it was refused, and a Stop rule naming the evidence
class that must not be used again — so the next reader does not repeat it:

- #235: section 7.1 opens with "records executable evidence RATHER THAN
  committing image baselines", so the section that looks like the evidence
  says in its first line that it is not
- #237: jsdom does not lay out text, so a 320px assertion proves the string
  is present, not that it fits
- #238: the risk is ancestor-scoped CSS/contain/transform on five specific
  host surfaces, which no Sheet component test can see

All three also drop their IN FLIGHT do-not-start prefix; PRs #1841 and
#1842 have merged, so the warning was blocking rather than protecting.

#231's "Next: instrument and reproduce" is stale — commit a3bc4da added
scripts/probe-generation-quality.ts and adjudicated PR #1861 as superseded
for phase 1. The row now says so, so nobody reviews #1861 as the live fix
or rebuilds the probe. Next is running it where credentials exist.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017paT42ZVMf8jaLtkjFxdy5
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.

1 participant