[Senate] Build real-time resource monitoring dashboard done coding:7 reasoning:6

← Resource Governance
## 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 (3)

Squash merge: orchestra/task/7034fc7b-build-real-time-resource-monitoring-dash (1 commits)2026-04-21
Squash merge: orchestra/task/7034fc7b-build-real-time-resource-monitoring-dash (1 commits)2026-04-21
Squash merge: orchestra/task/7034fc7b-build-real-time-resource-monitoring-dash (1 commits)2026-04-21
Spec File

[Senate] Build real-time resource monitoring dashboard

Quest: Resource Governance Priority: P4 Status: done

Goal

Add a /resources page (or enhance existing) showing real-time VM resource usage, per-analysis resource consumption, cost tracking, and historical trends. This is the control panel for resource governance.

Acceptance Criteria

☑ Real-time CPU, memory, disk, network stats on /resources page
☑ Per-analysis resource breakdown (memory, CPU time, tokens, cost)
☑ Historical charts: daily cost trend, resource usage over time (pre-existing Cost Dashboard with Chart.js)
☑ Alert indicators when resources approach limits
☑ Auto-refresh every 15 seconds

Approach

  • Enhance existing /resources route in api.py
  • Add psutil-based real-time metrics
  • Query resource_usage table for per-analysis breakdown
  • Add simple chart rendering (CSS bar charts or inline SVG)
  • Add alert thresholds matching resource governance limits
  • Dependencies

    _Identify during implementation._

    Dependents

    _Identify during implementation._

    Work Log

    2026-04-21 03:17 PDT — Slot codex:52

    • Reopened after merge gate found the previous task branch could not merge cleanly.
    • Rechecked current origin/main: /resources existed, but Live VM Resources, /api/resources/vm-stats, fetchVmStats(), and per_analysis_section were absent.
    • Reviewed recent api.py changes and preserved the security headers/authentication work that landed after the earlier attempt.
    • Implemented the scoped dashboard work in api.py: live psutil VM metrics endpoint, 15-second polling UI with alert thresholds, per-core CPU bars, and a per-analysis resource table from resource_usage.
    • Hardened the per-analysis query with table_exists(), token resource-type variants, CPU-time variants, optional memory peak columns, event counts, and graceful debug logging.
    • Verified: python3 -m py_compile api.py passed; direct api_resources_vm_stats() returned ok: true with CPU, memory, disk, and network fields; resources_dashboard() HTML contains Live VM Resources, fetchVmStats, /api/resources/vm-stats, Per-Analysis Resource Breakdown, and Peak Memory.

    Payload JSON
    {
      "requirements": {
        "coding": 7,
        "reasoning": 6
      }
    }

    Sibling Tasks in Quest (Resource Governance) ↗