Skip to content

Fix research cancellation and remaining-frame review - #87

Merged
TerminallyLazy merged 1 commit into
mainfrom
codex/study-review-state-fix
Sep 23, 2026
Merged

TerminallyLazy merged 1 commit into
mainfrom
codex/study-review-state-fix

Conversation

@TerminallyLazy

@TerminallyLazy TerminallyLazy commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

An active-series research request could cancel on a read-only viewer-state call when a localizer was visible beside it. Continue prepared a new run without submitting it, and restored coverage could appear beside a contradictory zero-image status. Whole-view sharing also exposed offscreen series capture.

Scope validation now filters read-only state and checks the targeted pane while keeping whole-view capture strict. Remaining-frame review submits the original request once, preserves the draft and cumulative coverage, and skips delivered frames. The sidebar separates model status from frames sent, clears old receipts on scope changes and shows the latest research result first. Known read failures no longer become uncertain mutations; cleanup preserves the original stop/pause reason.

PubMed accepts omitted/null limits and bounded counts up to ten, returns actionable validation/service errors and marks all-failed research honestly. Original failed arguments were unavailable, so this does not assert their exact cause.

Validation:

  • Focused backend, controller, native capture and lifecycle checks passed; viewer production build passed.
  • Isolated synthetic Electron Research: 8/34 then one-click continuation to 34/34; draft preserved; whole view 2 images and active viewport 1 image; two native actions, zero Realtime connections.
  • Real signed-in gpt-6-astra: public-only Research returned three PubMed sources. A separate real scoped Electron turn delivered all 34 generated frames, identified a random pixel-only marker, performed slice/window changes and returned a cited PubMed source with execution receipts.
  • Visual check at 280 px; no clinical images used, no diagnostic accuracy or exhaustive native-tool claim.

DOX and the study-exploration runbook were updated in the same change.

High-level PR Summary

This PR fixes critical issues in research request lifecycle management where active series research could incorrectly cancel during read-only viewer state calls when unshared panes (like localizers) were visible. The fix separates read-only state operations from scope validation, implements proper remaining-frame continuation that submits the original request once while preserving coverage and draft state, and improves PubMed error handling with actionable validation messages. The changes ensure whole-view capture remains strict while allowing filtered state reads, and preserve original stop/pause reasons during cleanup.

⏱️ Estimated Review Time: 30-90 minutes

💡 Review Order Suggestion
Order File Path
1 AGENTS.md
2 backend/clinical/AGENTS.md
3 backend/clinical/ai_exploration_contracts.py
4 backend/clinical/ai_exploration.py
5 backend/clinical/ai_exploration_coverage.py
6 backend/clinical/ai_codex.py
7 backend/clinical/ai_codex_tools.py
8 backend/clinical/ai_text.py
9 backend/clinical/ai_research_worker.py
10 backend/tests/AGENTS.md
11 backend/tests/test_ai_codex_exploration.py
12 viewer/assets/live/protocol.ts
13 viewer/assets/live/exploration.ts
14 viewer/assets/live/study-capture.mjs
15 viewer/assets/live/ohif.ts
16 viewer/assets/live/controller.ts
17 viewer/assets/live/exploration-panel.ts
18 viewer/assets/live/panel.ts
19 desktop/src/study-capture.mjs
20 desktop/tests/study-capture.test.mjs
21 viewer/assets/radsysx-viewer.css
22 desktop/AGENTS.md
23 desktop/scripts/ui-import-smoke.mjs
24 viewer/scripts/AGENTS.md
25 viewer/scripts/test-exploration.mjs
26 viewer/scripts/test-live.mjs
27 backend/clinical/ai_fixture_server.py
28 roadmap/ai-backend/CODEX_STUDY_EXPLORATION.md

Need help? Join our Discord

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c054183e-260a-42bf-9c3e-bad91e1dd73b


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@TerminallyLazy
TerminallyLazy merged commit b641efc into main Sep 23, 2026
6 of 7 checks passed
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