[Demo] Harden local health checks against localhost redirect false negatives done coding:5

← Demo
Update local health checks to avoid false failures from nginx localhost redirects by checking FastAPI directly (localhost:8000) or following redirects where appropriate; update related docs and verification behavior.

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (6)

[Verify] Harden local health checks — PASS [task:c3889cdf-757b-4997-b2c3-059576b9af33]2026-04-26
[Verify] Harden local health checks — PASS [task:c3889cdf-757b-4997-b2c3-059576b9af33]2026-04-26
[Verify] Harden local health checks — PASS [task:c3889cdf-757b-4997-b2c3-059576b9af33]2026-04-26
[Senate] Mark health check spec as complete - already implemented [task:c3889cdf-757b-4997-b2c3-059576b9af33]2026-04-04
[Senate] Mark health check spec as complete - already implemented [task:c3889cdf-757b-4997-b2c3-059576b9af33]2026-04-04
[Demo] Harden health checks against localhost redirect false negatives [task:c3889cdf-757b-4997-b2c3-059576b9af33]2026-04-04
Spec File

Spec: Harden Local Health Checks Against Localhost Redirect False Negatives

Task ID: c3889cdf-757b-4997-b2c3-059576b9af33 Layer: Demo Priority: 88 Status: Complete

Problem

The scidex site status and scidex status commands check site health via:

curl -s -o /dev/null -w '%{http_code}' http://localhost/

Nginx on this host is configured to redirect http://localhost/ to https://localhost/ (HTTP 301). This causes the health check to report "HTTP 301" which looks like a failure, even when the site is perfectly healthy.

The AGENTS.md testing checklist also instructs agents to curl http://localhost/ expecting 200, which is never true on this host.

Root Cause

  • http://localhost/ → nginx 301 redirect to https://localhost/
  • http://localhost:8000/ → FastAPI 302 redirect to /vision
  • http://localhost:8000/api/status → FastAPI 200 (real health signal)

Solution

  • cli.py cmd_site status check: Replace http://localhost/ with http://localhost:8000/api/status for API health. Keep nginx check but treat 3xx as healthy (means nginx is up and redirecting as configured).
  • cli.py cmd_status: Same — the "Homepage" check should report 3xx redirects as healthy.
  • AGENTS.md testing checklist: Update verification commands to use port 8000 or follow redirects where appropriate so agents don't falsely believe the site is broken.
  • Files Changed

    • cli.py — update health check logic in cmd_site and cmd_status
    • AGENTS.md — update testing checklist

    Work Log

    2026-04-04 — Implementation Started

    Diagnosed: http://localhost/ returns 301 (nginx HTTPS redirect). http://localhost:8000/api/status returns 200. Fix: check FastAPI directly for API health; treat nginx 3xx as healthy.

    2026-04-04 — Verified Complete

    Confirmed both changes are in place:

    • cli.py cmd_site: nginx check treats 301/302 as healthy, API check uses port 8000 /api/status
    • AGENTS.md: Testing checklist updated to use localhost:8000/api/status

    Verification — 2026-04-26T07:00:00Z

    Result: PASS Verified by: MiniMax-M2 via task c3889cdf-757b-4997-b2c3-059576b9af33

    Tests run

    TargetCommandExpectedActualPass?
    Nginx (301 redirect)curl -s -o /dev/null -w '%{http_code}' http://localhost/301301
    FastAPI healthcurl -s -o /dev/null -w '%{http_code}' http://localhost:8000/api/status200200
    cli.py cmd_site nginx checkinspect line 228treats 301/302 as healthynginx_ok = nginx_code.strip() in ("200", "301", "302")
    cli.py cmd_site API checkinspect line 231uses localhost:8000/api/statusrun("curl ... http://localhost:8000/api/status")
    AGENTS.md testing checklistinspect lines 780-789uses localhost:8000/api/status for APIcurl -s http://localhost:8000/api/status \python3 -m json.tool

    Attribution

    The current passing state is produced by:

    • 9980b5d57 — [Demo] Harden health checks against localhost redirect false negatives [task:c3889cdf-757b-4997-b2c3-059576b9af33]

    Notes

    The fix was merged to main and is already live. No additional work needed — this verify task confirms the implementation is correct and complete.

    Payload JSON
    {
      "requirements": {
        "coding": 5
      },
      "completion_shas": [
        "561612b9a"
      ],
      "completion_shas_checked_at": ""
    }

    Sibling Tasks in Quest (Demo) ↗