Files
roboco/roboco/foundation/policy/flow_timeouts.py
T
0bf0cd69b3 fix(release): close the 0.19.0 scan findings — sandbox mongo tag, flow-verb timeout walls, video hardening (#329)
- mongo:8-alpine → mongo:8 (tag never existed; a mongo-opted project could spawn no agents) + a Docker Hub tag-existence e2e guard for every sandbox engine
- flow-verb timeouts at both walls: shared SLOW_VERBS policy (i_am_done / submit_up / submit_root / open_pr / i_will_work_on get the 900s server budget); the MCP client now outlasts the server budget (+10s headroom, orchestrator-injected env) so agents receive the middleware's clean 504 envelope instead of dying at the old flat 30s client timeout
- cancellation safety: the quality gate kills+reaps its child on CancelledError; create_pr records the PR via a shield-with-wait-out helper so the write can neither be skipped nor race get_db's rollback
- video engine: renderer sidecar isolated on a render-only network, 2g/2cpu caps, 570s render watchdog with exit-on-hang, 512MB tar decompression cap, CEO notification on terminal render failure, reject under the approve mutex (fail-closed on Redis-down)
- dead python-jose dependency removed (drops ecdsa and its unfixable Minerva advisory PYSEC-2026-1325); panel --font-mono now a real monospace stack

Co-authored-by: Renn F <rennf93@users.noreply.github.com>
2026-07-08 03:26:12 +02:00

36 lines
1.6 KiB
Python

"""Flow-verb timeout budgets — single source for both timeout walls.
Two independent walls exist on every ``/api/v1/flow/*`` call: the server's
``FlowVerbTimeoutMiddleware`` (``roboco/api/middleware.py``) and the agent-side
MCP client's ``httpx.Client(timeout=...)`` (``roboco/mcp/flow_server.py``). The
client wall must always OUTLAST the server wall — otherwise the agent's httpx
client gives up with a raw transport error before the middleware ever gets to
return its clean, retryable 504 ``gateway_timeout`` envelope, and the agent
sees a Python exception instead of a directed remediation hint. Both sides
import ``SLOW_VERBS`` from here so they can never classify a verb differently.
"""
from __future__ import annotations
# Verbs whose own work routinely exceeds the default flow-verb budget:
# i_am_done (git push + the pre-submit quality gate), submit_up / submit_root
# / open_pr (a multi-step PR-create chain), i_will_work_on (workspace clone,
# up to 300s). Deliberately EXCLUDES i_will_plan / delegate: the slow budget
# also governs the server middleware wall, and i_will_plan is exactly the
# verb that wedged in #326 holding the SELECT FOR UPDATE task-row lock — a
# 900s budget would let a wedged planning verb block its task row for 15
# minutes instead of 2. Healthy planning verbs are DB writes that complete
# in seconds; their 30s+ production runs were contention symptoms.
SLOW_VERBS = frozenset(
{
"i_am_done",
"submit_up",
"submit_root",
"open_pr",
"i_will_work_on",
}
)
# Client-side margin added on top of the matching server budget.
CLIENT_HEADROOM_SECONDS = 10