Skip to content

[P1.5] Offload blocking sync work (pytest/ruff/LLM/installers) out of async handlers #732

Description

@frankbria

Severity: high | Category: infra | Phase: P1.5

Problem

Multiple async def endpoints call long-blocking core functions (full test-suite runs, LLM calls, tool installs) directly on the event-loop thread, freezing all other requests — SSE heartbeats, terminal/chat WebSockets, and /health — for minutes. The run_in_threadpool/to_thread pattern is already used elsewhere but not on the heaviest endpoints.

Evidence

codeframe/ui/routers/proof_v2.py:408, gates_v2.py:115, discovery_v2.py:270, diagnose_v2.py:166, environment_v2.py:217

Acceptance criteria

  • The listed handlers offload via run_in_threadpool/asyncio.to_thread or are declared plain def.
  • A proof run no longer blocks a concurrent /health request.

Dependencies

None


Filed from the SaaS launch-readiness audit. Atomic: one developer, one session. Work order: strictly P0.1 → P3.12 (no forward dependencies).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions