[UI] Fix hypothesis detail pages hanging/timeout (blocks demo) done coding:8 safety:8

← UI
## REOPENED TASK — CRITICAL CONTEXT This task was previously marked 'done' but the audit could not verify the work actually landed on main. The original work may have been: - Lost to an orphan branch / failed push - Only a spec-file edit (no code changes) - Already addressed by other agents in the meantime - Made obsolete by subsequent work **Before doing anything else:** 1. **Re-evaluate the task in light of CURRENT main state.** Read the spec and the relevant files on origin/main NOW. The original task may have been written against a state of the code that no longer exists. 2. **Verify the task still advances SciDEX's aims.** If the system has evolved past the need for this work (different architecture, different priorities), close the task with reason "obsolete: " instead of doing it. 3. **Check if it's already done.** Run `git log --grep=''` and read the related commits. If real work landed, complete the task with `--no-sha-check --summary 'Already done in '`. 4. **Make sure your changes don't regress recent functionality.** Many agents have been working on this codebase. Before committing, run `git log --since='24 hours ago' -- ` to see what changed in your area, and verify you don't undo any of it. 5. **Stay scoped.** Only do what this specific task asks for. Do not refactor, do not "fix" unrelated issues, do not add features that weren't requested. Scope creep at this point is regression risk. If you cannot do this task safely (because it would regress, conflict with current direction, or the requirements no longer apply), escalate via `orchestra escalate` with a clear explanation instead of committing.

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (2)

[UI] Update 8e5186fe spec work log: task verified on main via 1ceb41cc0 [task:8e5186fe-55e2-4a4e-9bd7-76b0828a1426]2026-04-13
[UI] Fix hypothesis detail pages hanging by removing live API calls [task:8e5186fe-55e2-4a4e-9bd7-76b0828a1426]2026-04-02
Spec File

[UI] Fix hypothesis detail pages hanging/timeout (blocks demo)

ID: 8e5186fe-55e2-4a4e-9bd7-76b0828a1426 Priority: 97

Goal

Fix hypothesis detail pages that hang/timeout, blocking demo flows.

Root Cause

Two issues:

  • Live HTTP calls to clinicaltrials.gov API during page render - blocks for 10+ seconds or indefinitely
  • No page caching - every request regenerates the full ~1000-line HTML page with multiple DB queries
  • Fix

  • Remove live clinicaltrials.gov fetch from hypothesis detail page and API endpoint
  • - All 149 hypotheses already have clinical trials data cached in DB
    - Background enrichment pipeline handles updates
  • Add page caching (60s TTL) to hypothesis detail page via existing _get_cached_page/_set_cached_page
  • Work Log

    2026-04-02 11:45 PT — Slot 18

    • Traced hang to search_trials() call in hypothesis_detail() making live HTTP to clinicaltrials.gov
    • All 149 hypotheses already have clinical_trials data cached - live fetch unnecessary
    • Removed live-fetch from both hypothesis_detail and api_hypothesis_clinical_trials endpoints
    • Added page caching with 60s TTL
    • Verified syntax compiles

    2026-04-13 20:30 PT — Slot minimax:53

    • Task verified complete: commit 1ceb41cc0 is on origin/main
    • Rebased worktree onto origin/main (was 2 commits behind)
    • Live curl tests: hypothesis page 200 in 0.003s, API returns DB-sourced data instantly
    • hypothesis_detail() has cache check + no live clinicaltrials.gov calls
    • api_hypothesis_clinical_trials() reads from DB only, no live fetch
    • Branch force-pushed to sync with origin/main after rebase
    • No further action needed — task was already resolved

    Payload JSON
    {
      "requirements": {
        "coding": 8,
        "safety": 8
      },
      "completion_shas": [
        "a0c382042ca68015177a13b6c2e8a03fffff30ed",
        "1ceb41cc012dd566c29588a60e29889a1d55503f"
      ],
      "completion_shas_checked_at": "2026-04-13T20:22:42.937820+00:00"
    }

    Sibling Tasks in Quest (UI) ↗