Skip to content

fix(issues): derive queue prose from the row it cites, so a stale cell cannot misdirect - #1902

Merged
BigSimmo merged 5 commits into
mainfrom
claude/fix-231-queue-misdirection
Aug 13, 2026
Merged

fix(issues): derive queue prose from the row it cites, so a stale cell cannot misdirect#1902
BigSimmo merged 5 commits into
mainfrom
claude/fix-231-queue-misdirection

Conversation

@BigSimmo

@BigSimmoBigSimmo commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • The recommended-queue cell for #231, the top clinical P1, has been telling every session to pursue an approach that row itself records as refuted. It said "measure and fix the fast-route budget / generation timeout"; #231's detail records that the decisive 40-second probe completed generation in 25.272s (27.237s total) with route_deadline_exceeded=false and still failed generation quality, so the budget is not the binding cause. The queue and the row are independent copies of the same prose, and they drifted.
  • The drifted copy is the one that gets read..claude/hooks/issues-surface.sh prints the queue at every session start and scripts/issues-report.mjs serves it to /issues; the corrected row detail is only seen by someone who opens the file.
  • Re-correcting the cell cannot land, which is why this PR removes the duplication instead. The ledger inbox has no request type that reaches the queue's Outcome cell, and check:ledger-write-discipline rejects a direct canonical edit — I verified this by committing the corrected cell and watching the gate refuse it. SKIP_LEDGER_WRITE_GUARD=1 only bypasses the pre-push hook, not the CI check, so that route can push but never merge.
  • So both consumers now take each queue row's prose from the cited row's own Detail cell. The queue keeps order, acuity, capability, when and estimate — the metadata that exists nowhere else. A composite ID(s) row has no single row to speak for it and keeps its own text.
  • This fixes the class, not the instance. No future edit to a row's detail can leave the surfaced text behind, because there is no longer a second copy to leave behind. That is the resolution #314 argued for ("deriving is better").

Before / after, from the real ledger:

3. `#231` · A1 · Live answers degrade to source-only when `answerRouteBudgetMs.fast` (25000) binds… ← refuted approach
3. `#231` · A1 · PARTIAL 2026-08-12: This PR fixes the clinically consequential stale-fallback path… ← the row's own current text

Verification

  • npm run verify:pr-localcompleted: check:runtime, check:installed-lock-parity, format:changed, lint, typecheck, test, check:rag:fixtures, check:medication-interactions · failed: (none). Build skipped by the runner: "no build-affecting source, config, package, or container changes detected."
  • npm run check:ledger-write-disciplineLedger write discipline passed for a5f03ccc3390..HEAD (this PR makes no canonical ledger edit)
  • npx vitest run tests/issues-report.test.ts6 passed
  • bash -n .claude/hooks/issues-surface.sh — syntax OK; hook executed end-to-end against the real ledger and its output inspected
  • Mutation-tested: reverting the derivation (recommended: derivedrecommended: queue) fails the new test — Tests 1 failed | 5 passed. The assertion is known to catch what it is for, not merely known to pass.

UI verification not run: no UI surface is touched — the changes are a SessionStart hook, a report script, and a test.

Risk and rollout

  • Risk: Low, and confined to what agents read at session start. The one real trap is in the hook: the queue table is printed before## Open items, so a single forward awk pass reads every queue row while the lookup is still empty and silently falls back to the stale cell. That happened on my first attempt and looked like a working change until I checked the output. It now makes two passes, and the comment says why.
  • Rollback:git revert on the single commit. No data or ledger state changes.
  • Provider or production effects: None.

Notes

No ## Clinical Governance Preflight: classifyPullRequestFiles returns clinicalRisk: false, operationalRisk: false, ragRanking: false for this file list. The clinical relevance is indirect but real — the misdirected cell was steering work on the clinical answer path.

Follow-up this does not do: the queue's Outcome cells are now dead text that nothing renders. They should eventually be dropped from the table so there is no stale prose left to mislead a human reader, but that is a canonical ledger edit and has to go through a reconciliation branch. Worth folding into #314.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DuYJz8hauCsCdx8r4fXiZU


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Issue reports now use the latest detail associated with each single-issue queue entry, preventing stale summary text from appearing as the reported outcome.
    • Priority blockers, recommendations, and actionable results now reflect the corrected issue details.
    • Entries containing multiple issue IDs or unmatched details continue to use their existing queue outcome.

…l cannot misdirect
The recommended-queue entry for #231, the top clinical P1, told every session to
"measure and fix the fast-route budget / generation timeout". #231's own detail
records that approach as tested and rejected: the decisive 40-second probe
completed generation in 25.272s (27.237s total) with route_deadline_exceeded
false and still failed generation quality, so the budget is not the binding
cause. The queue and the row had drifted, and the queue is the copy that gets
read — .claude/hooks/issues-surface.sh prints it at every session start and
scripts/issues-report.mjs serves it to /issues, while the corrected row detail
is only seen by someone who opens the file.
Re-correcting the cell was tried and cannot land. The ledger inbox has no
request type that reaches the queue's Outcome cell, and
check:ledger-write-discipline rejects a direct canonical edit, so the
correction is unlandable by construction — verified by committing it and
watching the gate refuse. SKIP_LEDGER_WRITE_GUARD only bypasses the pre-push
hook, not the CI check, so that route pushes but can never merge.
So the duplication is removed instead of re-synced, which is what #314 argued
for: both consumers now take each queue row's prose from the cited row's own
Detail cell. The queue keeps order, acuity, capability, when and estimate —
the metadata that exists nowhere else. A composite ID(s) row has no single row
to speak for it and keeps its own text.
This fixes the whole class, not just #231: no future edit to a row's detail can
leave the surfaced text behind, because there is no longer a second copy.
The hook needed two passes over the file. The queue table is printed BEFORE
"## Open items", so the obvious single forward pass reads every queue row while
the lookup is still empty and silently falls back to the stale cell — which it
did, on the first attempt, and looked like a working change.
tests/issues-report.test.ts pins both halves and was mutation-tested: reverting
the derivation fails it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DuYJz8hauCsCdx8r4fXiZU
@supabase

supabaseBot commented Aug 13, 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

coderabbitaiBot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in:56 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 00396927-0eef-48f3-a2c0-dd4c8fd84e18

📥 Commits

Reviewing files that changed from the base of the PR and between 2ec1096 and 10bd720.

📒 Files selected for processing (2)
  • scripts/issues-report.mjs
  • tests/issues-report.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: caebfffb-cb0c-4056-ac83-0074d20f53bd

📥 Commits

Reviewing files that changed from the base of the PR and between 87865bf and 2ec1096.

📒 Files selected for processing (4)
  • .claude/hooks/issues-surface.sh
  • docs/branch-review-records/f37513763ecace3c1eeca5c8977abe2b890cbde5f09f3f5566f432fbd5f675e0.record.md
  • scripts/issues-report.mjs
  • tests/issues-report.test.ts

📝 Walkthrough

Walkthrough

The queue parser and issue report now use matching open-item details for single-issue entries. Composite and unmatched entries retain queue text. Regression coverage verifies outcomes, metadata, and priority blockers.

Changes

Issue detail propagation

Layer / File(s)Summary
Queue detail resolution and report derivation
.claude/hooks/issues-surface.sh, scripts/issues-report.mjs
The hook performs two ledger passes and resolves single-issue summaries from matching Detail cells. buildIssuesReport derives single-issue outcomes from open-item details while preserving composite and unmatched queue text.
Regression coverage and review record
tests/issues-report.test.ts, docs/branch-review-records/...record.md
Tests verify corrected single-issue outcomes, preserved queue metadata, priority blockers, and composite outcomes. The branch record documents verification results.

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

Mergeability Score:⚪ Minimal · up to 2ec10

The change makes surfaced queue prose follow the cited row’s current detail, preventing stale guidance without changing ledger data or production configuration; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly summarizes the main change: deriving issue queue prose from the cited row to prevent stale guidance.
Description check✅ PassedThe description covers the change, verification results, risks, rollback, production effects, and the reason the governance preflight was not required.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-231-queue-misdirection

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

@chatgpt-codex-connectorchatgpt-codex-connectorBot 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:315199c16f

ℹ️ 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 threadscripts/issues-report.mjs
@BigSimmo
BigSimmo enabled auto-merge August 13, 2026 05:27
@BigSimmo
BigSimmo merged commit 82b9c1e into mainAug 13, 2026
24 checks passed
@BigSimmo
BigSimmo deleted the claude/fix-231-queue-misdirection branch August 13, 2026 05:51
Sign up for freeto 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.

2 participants

@BigSimmo@claude