Fix document cover preview reliability - #2391
Conversation
…iew-reliability-image-preview-reliability
…iew-reliability-image-preview-reliability
Warning Review limit reachedNext included review available in 30 minutes. View limit detailsLimit details: You’ve used the included review currently available. Your 93 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (10)
Comment |
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:a8b981ea8b
ℹ️ 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".
Uh oh!
There was an error while loading. Please reload this page.
BigSimmo
commented
Aug 26, 2026
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch codex/chat-image-preview-reliability-image-preview-reliability at starting commit a8b981e; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:codex/chat-image-preview-reliability-image-preview-reliability, then verify that the pull request head contains the published commit before reporting success. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #14008 (failure). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
This request affects authenticated document access and credential rotation, which the repository classifies as an auth/privacy high-risk path requiring Please select xhigh in the Cloud reasoning control and resubmit the same request with the exact marker:
No repository inspection, edits, tests, commits, pushes, PR creation, or review-thread actions were performed. |
A same-user token rotation while a cover lookup is pending must start a new request instead of inheriting a 401 from the old header. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # data/repo-awareness-snapshot.json
The merge brought in new review records from #2390, so the committed snapshot lagged review_state and would fail Static PR. Co-authored-by: Cursor <cursoragent@cursor.com>
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # data/repo-awareness-snapshot.json


Summary
Verification
npm run lint— passed after the final source fix (the later changes were a stable test mock and immutable review record)npm run typecheck— passed after the final source fixnpm run build— production compile, TypeScript, 1,990 static pages, and client secret scan passednpm run check:repo-awareness-snapshotnpm run check:branch-review-ledgernpm run check:medication-interactionsnpm run check:medication-lexicon-reportnpm run verify:pr-local— partial: runtime, installed-lock parity, changed-file formatting, lint, and typecheck passed. The full suite reported 10,489 passed / 75 skipped / 7 failed: six unchanged Windows-only Claude cloud provisioner failures (exit 127), plus one preview test whose unstable auth mock was then fixed and covered by the 79/79 focused rerun. Later offline Vitest selectors were admission-blocked by another worktree's Chromium lease.npm run verify:ui— not run; targeted Chromium coverage was used. Physical Safari/PWA remains unrun.Risk and rollout
Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
docs/branch-review-records/04098ccb23c407505308b9e046181f8b978d85a4122db061e5b56a5f3cc0d988.record.mdNote
Low Risk
Changes are limited to authenticated cover lookup and optional UI decoration; citation content and retrieval are unchanged, with conservative fail-closed cover selection when legacy data is ambiguous.
Overview
Improves optional document cover thumbnails in the answer source drawer without touching RAG or citation payloads.
The
/api/documents/[id]/coverlegacy path no longer delegates tofetchDocumentCoverImageIds. It queries boundedcover_pagerows, picks the single candidate matching the document’s committed index generation, and returns null when results are stale, ambiguous, or exceed the cap.useDocumentCoverImageIdnow sends the session Authorization header, keys cache and in-flight work by user + document, caches authoritativenullmisses but not transient errors or bad JSON, and exposesmarkCoverUnavailableso a settled signed-image failure drops the thumbnail without pinning “no cover” for the whole session.SignedImageadds optionalfailurePresentation="hidden"andonSettledFailure(after automatic retries). The drawer uses that to remove a failed cover only while keeping passage, pager, evidence images, and PDF link intact.Regression tests cover the cover route, hook auth/cache races, signed-image settlement, and drawer evidence preservation; a branch review ledger entry was added.
Reviewed by Cursor Bugbot for commit a8b981e. Configure here.