[UI] Fix gaps page stale statuses

← All Specs

[UI] Fix gaps page stale statuses

Goal

All 20 gaps show status=investigating but 0 are open (contradicts the UI text). Fix: after analysis completes on a gap, mark partially_filled. Only resolved after 2+ analyses. Reset stale investigating back to open.

Acceptance Criteria

☑ Gaps page shows realistic mix of open/investigating/filled.

Approach

  • Read AGENTS.md and relevant source files
  • Understand existing code patterns before modifying
  • Implement changes following existing conventions (f-string HTML, SQLite, Bedrock Claude)
  • Test: curl affected pages, verify rendering, run scidex status
  • Commit atomically with descriptive message
  • Work Log

    2026-04-01 19:40 PT — Slot 2

    • Started task: Fix gaps page stale statuses
    • Investigated current state: All 20 gaps stuck in "investigating" status
    • Found root cause: agent.py:375 marks gaps as "investigating" but never updates after completion
    • Analysis counts: 1 gap with 2 analyses, most with 1, some with 0
    • Implemented: Added update_gap_statuses() function to post_process.py
    • Logic: 0 analyses+investigating→open, 1 analysis→partially_filled, 2+→resolved
    • Tested: All pages load (200), API shows 3 open / 23 total gaps
    • Result: ✓ Gaps page now shows realistic mix: 3 open, 19 partially_filled, 1 resolved
    • Committing and pushing...

    2026-04-25 15:15 PT — Slot 2 (bugfix)

    • Found bug: update_gap_statuses() called get_db() which uses local DB_PATH = /home/ubuntu/scidex/.sqlite-retired (retired SQLite)
    • Impact: function failed with "no such table: knowledge_gaps" because PostgreSQL schema wasn't on SQLite
    • Fix: Changed get_db() → get_db_write() at lines 4946 and 5085 to use PostgreSQL
    • Also fixed print statement at line 5081: updated['partially_filled'] → updated.get('partially_addressed', 0)
    • Verified: Ran update_gap_statuses() successfully, then checked DB - gaps now show realistic mix
    • Current status distribution: open:3105, partially_addressed:302, proposed:50, resolved:11
    • Note: The previous implementation was correct but broke when SQLite was retired on 2026-04-20

    Tasks using this spec (1)
    [UI] Fix gaps page stale statuses
    UI done P60
    File: aff65180_61d_fix_gaps_page_stale_spec.md
    Modified: 2026-04-25 23:40
    Size: 2.3 KB