Skip to content

API Reference parrot.flows.dev_loop.dispatchers.mantle

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.flows.dev_loop.dispatchers.mantle

View source

MantleAdversarialReviewDispatcher — read-only counter-reviewer on Bedrock Mantle.

FEAT-486 Module 4 (spec goal G5). The configurable adversarial review pair defaults to Claude Opus 5 (write-enabled primary) plus gpt-5.6-sol as the counter-reviewer — and gpt-5.6-sol cannot run over the Codex CLI, so :class:~parrot.flows.dev_loop.code_review.CodexAdversarialReviewDispatcher is not a usable transport for it. AWS serves it over the OpenAI-compatible bedrock-mantle endpoint, which is what :class:~parrot.clients.amazon.nova.mantle.BedrockMantleClient speaks.

This module is a deliberate mirror of :class:~parrot.flows.dev_loop.dispatchers.nova.NovaAdversarialReviewDispatcher (dispatchers/nova.py:239) — same class shape, same registration idiom, same degrade-on-infra-error contract — differing only in the transport (Chat Completions over Mantle rather than Converse over Nova) and the default model. Nova's reviewer is kept for Converse-only models; this one serves every Mantle-hosted id.

Read-only BY CONSTRUCTION. The security property is structural, not procedural, in three independent layers:

  1. :class:MantleAdversarialReviewProfile is a fresh BaseModel with no tools / allowed_commands / sandbox field — a tool configuration cannot be expressed, let alone forgotten.
  2. The single client call passes use_tools=False explicitly and no tools kwarg.
  3. The returned verdict is rewritten with files_modified=[], matching CodexAdversarialReviewDispatcher (code_review.py:337) — an advisory seat never claims authorship of an edit.

Findings are advisory and must be triaged (CONFIRM / REJECT / ESCALATE) by the primary worker downstream.

Attribute MANTLE_DEFAULT_REVIEW_MODEL

Type: str

Class MantleAdversarialReviewDispatcher

Advisory, read-only counter-reviewer over the bedrock-mantle endpoint.

Defaults to gpt-5.6-sol (override with DEV_LOOP_MANTLE_REVIEW_MODEL). Like its Nova sibling there is no underlying DevLoopCodeDispatcher to delegate to: :meth:review drives :meth:BedrockMantleClient.ask directly and reproduces AbstractCodeReviewDispatcher.review()'s degrade-on-infra-error contract locally — an outage (including a missing BEDROCK_MANTLE_API_KEY / AWS_NOVA_API_KEY bearer key) degrades to a passing verdict carrying a nit-level finding rather than crashing the QA node. That is a known, intentionally inherited property of the review contract, not a bug in this class.

Parameter Type Default Description
model str | None None Mantle model id. Defaults to conf.DEV_LOOP_MANTLE_REVIEW_MODEL (gpt-5.6-sol). A NEW conf key — the existing DEV_LOOP_ADVERSARIAL_MODEL (the codex seat's) is deliberately NOT repointed.
review_scope str 'uncommitted' "uncommitted" (default), "base" or "commit".
review_base str '' Base ref, required for "base" scope.
review_commit str '' Commit SHA, required for "commit" scope.
max_diff_chars int | None None Deterministic diff truncation bound.
max_tokens int | None None Output token budget. Clamped to the model's verified Bedrock ceiling by effective_max_tokens — unknown ids (gpt-5.6-sol among them) pass through unclamped, since "unknown" is not "wrong".
client BedrockMantleClient | None None Pre-built client (tests / a shared per-run client).
event_registry_resolver Any | None None FEAT-479 — optional (run_id) -> EventRegistry | None. When supplied, the run's registry is bound onto the client's _events_registry before the call, so this seat's token usage reaches the run ledger exactly (the same documented injection point as dispatchers/llm.py:389-390; clients otherwise self-create an isolated registry).

Method MantleAdversarialReviewDispatcher.build_review_profile

Return this dispatcher's review profile (no tool fields exist).

build_review_profile() -> MantleAdversarialReviewProfile

Returns: MantleAdversarialReviewProfile

Method MantleAdversarialReviewDispatcher.review

Run the advisory review against BedrockMantleClient.ask().

review(*, brief: BaseModel, run_id: str, node_id: str, cwd: str, session_host: SessionHost | None = None, round: str = '', labels: DispatchLabels | None = None) -> CodeReviewVerdict

Parameter Type Default Description
brief BaseModel The review brief (diff context + acceptance criteria).
run_id str The dev-loop / dev-flow run id (FEAT-479 attribution).
node_id str The accounting seat label for the run ledger.
cwd str Worktree the diff is collected from.
session_host SessionHost | None None Unused — this seat opens no gates and publishes no envelopes; accepted for protocol parity.
round str '' Unused — accepted for protocol parity.
labels DispatchLabels | None None FEAT-496 — this seat has no development dispatch to stamp, so labels is accepted for protocol parity only; its judge_id (when present) enriches the usage-ledger seat below rather than any published event payload.

Returns: CodeReviewVerdict — The verdict, always with files_modified=[] and every finding tagged with this seat as its source. Any failure degrades to a passing verdict with a nit-level finding.

Class MantleAdversarialReviewProfile

Read-only by construction: NO tools are ever passed to the model.

Consumed by :meth:MantleAdversarialReviewDispatcher.build_review_profile. Deliberately a fresh BaseModel (not a subclass of any *DispatchProfile) so it structurally cannot carry tools / allowed_commands / sandbox fields — exactly the argument NovaAdversarialReviewProfile makes at models/nova.py:130-139.

Fields:

Field Type Default Description
model str MANTLE_DEFAULT_REVIEW_MODEL Bedrock Mantle model id for the counter-reviewer.
review_scope str 'uncommitted' Which diff the reviewer evaluates: uncommitted | base | commit.
review_base str '' Base ref/branch to diff against when review_scope == 'base'.
review_commit str '' Commit SHA to review when review_scope == 'commit'.
max_tokens int 8192 Output token budget for the review verdict.
max_diff_chars int 200000 Deterministic truncation bound for the diff sent to the model.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally