Files
roboco/roboco/services/gateway/choreographer/_protocol.py
T
Renn F 05a5852bb5 [F044] pr_pass gate remediation points the reviewer at pr_fail, not i_am_blocked
The pr_pass gate runs the toolchain + conventions guards on the REVIEWER's
workspace, but their remediation text said 'call i_am_blocked' — a verb the
PR reviewer does not have. The reviewer would chase a verb they cannot call
instead of rejecting the PR.

Make the guards reviewer-aware: a reviewer=True flag (passed by _pr_pass_blocked)
switches the remediation to pr_fail(issues=[...]) — the reviewer's reject
lever, sending the PR back to needs_revision for the dev to fix the
environment / validator. The dev (i_am_done) path keeps i_am_blocked, which a
dev does have. _conventions_guard (the pr_pass path) now passes reviewer=True
through to _conventions_rejection.
2026-06-28 11:30:55 +02:00

133 lines
3.7 KiB
Python

"""Typed stub mixins inherit from for static analysis.
The role mixins (`board.py`, `doc.py`, `qa.py`, …) call methods like
``self.task.get(...)`` and ``self._emit_rejection(...)`` that live on
the legacy ``Choreographer`` class in ``_impl.py``. Without a typed
reference, mypy resolves those as ``Any`` (via ``# type: ignore[attr-defined]``)
which then bubbles up as ``no-any-return`` errors at every Envelope-returning
verb.
This module gives mypy a typed view of those helpers. ``ChoreographerHelpers``
is **not** a Protocol — Protocol with abstract members causes the
composed ``Choreographer`` class to be flagged as instantiating an
abstract class. Instead it's a plain class with stub signatures used
ONLY under ``TYPE_CHECKING``; at runtime mixins inherit from ``object``
so there's no abstract-method baggage. The real implementations live
on ``_LegacyChoreographer`` and are picked up by Python's MRO when the
composed ``Choreographer`` runs.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from uuid import UUID
from roboco.services.gateway.choreographer._verb_runner import VerbRunner
from roboco.services.gateway.envelope import Envelope
class ChoreographerHelpers:
"""Typed stub of attributes + helpers role mixins call on ``self``.
Stub bodies (``...``) are never executed; the real methods live on
``_LegacyChoreographer`` and resolve via MRO at runtime.
"""
task: Any
work_session: Any
git: Any
a2a: Any
journal: Any
audit: Any
evidence_repo: Any
async def _emit_rejection(
self,
env: Envelope,
*,
agent_id: UUID,
task_id: UUID | None,
verb: str,
) -> Envelope:
raise NotImplementedError
async def _toolchain_broken_guard(
self, agent_id: UUID, task: Any, *, reviewer: bool = False
) -> Envelope | None:
raise NotImplementedError
async def _conventions_guard(
self, agent_id: UUID, task: Any, briefing: dict[str, Any]
) -> Envelope | None:
raise NotImplementedError
@classmethod
def _free_text_soup(
cls, checks: tuple[tuple[str, Any, int], ...]
) -> Envelope | None:
raise NotImplementedError
@staticmethod
def _soup_or_decision_env(
soup: Envelope | None, decision: Any, briefing: dict[str, Any]
) -> Envelope | None:
raise NotImplementedError
async def _guard_free_text(
self,
*,
checks: tuple[tuple[str, Any, int], ...],
task: Any,
agent_id: UUID,
role_str: str,
verb: str,
) -> Envelope | None:
raise NotImplementedError
async def _briefing_for(
self,
agent_id: UUID,
task_id: UUID | None,
*,
task: Any | None = None,
include_ac_coverage: bool = False,
) -> dict[str, Any]:
raise NotImplementedError
async def _project_slug_for(self, t: Any) -> str | None:
raise NotImplementedError
@staticmethod
def _with_briefing(
env: Envelope,
briefing: dict[str, Any],
) -> Envelope:
raise NotImplementedError
async def _run_claim_guards(
self,
*,
agent_id: UUID,
task: Any,
role_str: str | None = None,
) -> Envelope | None:
raise NotImplementedError
async def _touch(self, task_id: UUID | None) -> None:
raise NotImplementedError
def _verb_runner(self) -> VerbRunner:
raise NotImplementedError
async def _build_tracing_gap(
self,
agent_id: UUID,
task_id: UUID,
missing: list[str],
*,
task: Any | None = None,
) -> Envelope:
raise NotImplementedError