Files
roboco/roboco/api/routes/v1/flow_qa.py
T
Renn F 3441e37120 [sweep] strip Fxxx audit-ID tokens + trim bloated comments/docstrings + add behavior-change docs
Post-audit sweep over the 135 audit-fix commits since 19a474d3:

1. Stripped every # Fxxx: audit-ID token from comments AND every Fxxx token
   from docstring openings across 211 blocks / ~626 lines. The CEO flagged
   these twice: audit-issue IDs in code confuse future devs/agents. The
   descriptive text is preserved; only the Fxxx token is removed (and bloated
   narrative blocks trimmed to 1-3 lines keeping the one non-obvious invariant).
2. Trimmed bloated comments/docstrings to the concise standard (1-3 lines).
3. Added missing behavior-change docs for the audit-fix batch: prompts/roles
   (documenter, pr_reviewer, qa), user-facing docs (api auth, websockets,
   agent-gateway, megatask, merge-model, task-lifecycle, grok, resilience,
   conventions, panel, security, troubleshooting), and the RAG corpus (cell-pm,
   main-pm, pr-reviewer, qa roles; conventions; messaging-tools; escalation;
   megatask; task-claiming workflows).

Comment/docstring/prose ONLY — zero code-line edits (verified: the diff
contains no def/class/return/if/for/await/assignment/call lines). Gates green:
ruff format + ruff check clean, mypy clean on roboco/. The only pytest failures
are the pre-existing sync_branch tracing-decision gap (B1, 250be5c2) — not
sweep-caused and tracked separately.
2026-06-29 01:25:40 +02:00

129 lines
3.4 KiB
Python

"""QA intent-verb HTTP endpoints. Thin handlers; delegate to Choreographer."""
from typing import Annotated
from uuid import UUID
from fastapi import APIRouter, Depends, Header, Request
from roboco.api.deps import get_choreographer
from roboco.api.routes.v1._role_dep import envelope_to_response, require_qa
from roboco.api.schemas.v1.flow import (
ClaimReviewRequest,
FailReviewRequest,
GiveMeWorkRequest,
IAmBlockedRequest,
IAmIdleRequest,
PassReviewRequest,
ResumeRequest,
UnclaimRequest,
)
from roboco.services.gateway.choreographer import Choreographer
router = APIRouter(
prefix="/api/v1/flow/qa",
tags=["v1-flow-qa"],
dependencies=[require_qa],
)
_AgentIdHeader = Annotated[UUID, Header(alias="X-Agent-ID")]
_ChoreographerDep = Annotated[Choreographer, Depends(get_choreographer)]
@router.post("/give_me_work")
async def give_me_work(
request: Request,
_body: GiveMeWorkRequest,
x_agent_id: _AgentIdHeader,
choreographer: _ChoreographerDep,
) -> dict:
env = await choreographer.give_me_work(x_agent_id)
return envelope_to_response(env, request)
@router.post("/claim_review")
async def claim_review(
request: Request,
body: ClaimReviewRequest,
x_agent_id: _AgentIdHeader,
choreographer: _ChoreographerDep,
) -> dict:
env = await choreographer.claim_review(x_agent_id, body.task_id)
return envelope_to_response(env, request)
@router.post("/pass")
async def qa_pass(
request: Request,
body: PassReviewRequest,
x_agent_id: _AgentIdHeader,
choreographer: _ChoreographerDep,
) -> dict:
env = await choreographer.pass_review(
x_agent_id, body.task_id, body.notes, body.ac_verdicts
)
return envelope_to_response(env, request)
@router.post("/fail")
async def qa_fail(
request: Request,
body: FailReviewRequest,
x_agent_id: _AgentIdHeader,
choreographer: _ChoreographerDep,
) -> dict:
env = await choreographer.fail_review(x_agent_id, body.task_id, body.issues)
return envelope_to_response(env, request)
@router.post("/unclaim")
async def unclaim(
request: Request,
body: UnclaimRequest,
x_agent_id: _AgentIdHeader,
choreographer: _ChoreographerDep,
) -> dict:
env = await choreographer.unclaim(x_agent_id, body.task_id)
return envelope_to_response(env, request)
@router.post("/resume")
async def resume(
request: Request,
body: ResumeRequest,
x_agent_id: _AgentIdHeader,
choreographer: _ChoreographerDep,
) -> dict:
env = await choreographer.resume(x_agent_id, body.task_id)
return envelope_to_response(env, request)
@router.post("/i_am_idle")
async def i_am_idle(
request: Request,
_body: IAmIdleRequest,
x_agent_id: _AgentIdHeader,
choreographer: _ChoreographerDep,
) -> dict:
env = await choreographer.i_am_idle(x_agent_id)
return envelope_to_response(env, request)
@router.post("/i_am_blocked")
async def i_am_blocked(
request: Request,
body: IAmBlockedRequest,
x_agent_id: _AgentIdHeader,
choreographer: _ChoreographerDep,
) -> dict:
"""Surface the ``i_am_blocked`` route so a blocked QA agent's escape hatch
returns an envelope instead of a 404."""
env = await choreographer.i_am_blocked(
x_agent_id,
body.task_id,
body.reason,
blocker_type=body.blocker_type,
what_needed=body.what_needed,
)
return envelope_to_response(env, request)