Skip to content

[None][feat] Import agent-flow and modeling bringup agent into TensorRT-LLM#16543

Open
WeiHaocheng wants to merge 3 commits into
NVIDIA:mainfrom
WeiHaocheng:feat/import-agent-flow
Open

[None][feat] Import agent-flow and modeling bringup agent into TensorRT-LLM#16543
WeiHaocheng wants to merge 3 commits into
NVIDIA:mainfrom
WeiHaocheng:feat/import-agent-flow

Conversation

@WeiHaocheng

@WeiHaocheng WeiHaocheng commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

[None][feat] Import agent-flow and modeling bringup agent into TensorRT-LLM

PR description:

Description

This PR vendors agent-flow — a lightweight, torch-like framework for composing agent-backed
"layers" — into the repository under a new top-level agent-flow/ directory, together with
ready-to-run multi-agent workflows aimed at automating TensorRT-LLM development, most notably a
modeling bring-up agent for onboarding new models.

Summary by CodeRabbit

  • New Features

    • Added the Agent Flow framework for composing sequential and interactive AI agent workflows.
    • Added Claude Code and Codex backend support with streamed responses, tool calls, usage metrics, and session handling.
    • Added human-in-the-loop prompts and improved activity displays.
    • Added Agent Team, Modeling Bring-up, and PR Review workflows with resume, checkpoint, feedback, and validation support.
    • Added command-line entry points and practical examples.
  • Documentation

    • Added setup guides, quick starts, workflow instructions, and sample task configurations.

Signed-off-by: Fred Wei <20514172+WeiHaocheng@users.noreply.github.com>
@WeiHaocheng
WeiHaocheng requested a review from a team as a code owner July 17, 2026 09:40
@WeiHaocheng
WeiHaocheng requested review from BowenFu and brnguyen2 July 17, 2026 09:40
Signed-off-by: Fred Wei <20514172+WeiHaocheng@users.noreply.github.com>
@WeiHaocheng
WeiHaocheng requested a review from kaiyux July 17, 2026 09:53
@WeiHaocheng WeiHaocheng changed the title Feat/import agent flow [None][feat] Import agent-flow and modeling bringup agent into TensorRT-LLM Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Agent Flow foundation

Layer / File(s) Summary
Core runtime and backend contracts
agent-flow/agent_flow/{config.py,types.py,module.py,runtime.py}, agent-flow/agent_flow/backends/*
Adds configuration types, event models, module composition, background execution, backend interfaces, and Claude Code/Codex implementations.
Agent execution and console behavior
agent-flow/agent_flow/{layers.py,console.py,hooks.py,logger.py,utils.py}
Adds streaming layer execution, persistent sessions, human-input tools, stop hooks, usage rendering, logging, and skill probing.
Agent-team workflow
agent-flow/agent_flow/workflows/agent_team/*
Adds checkpointed plan/build/QA orchestration, progress and status tools, CLI flags, prompts, feedback handling, and optional QA replanning.
Modeling-bringup workflow
agent-flow/agent_flow/workflows/modeling_bringup/*
Adds task-schema validation, CLI wiring, TensorRT-LLM prompt extensions, Slurm/container guidance, Stage/Goal replan prompts, examples, and documentation.
PR-review workflow
agent-flow/agent_flow/workflows/pr_review/*
Adds sourcing, local VCS context generation, reviewer/coder discussion and progress tools, checkpointing, two-stage convergence, CLI support, prompts, and documentation.
Packaging, examples, and tests
agent-flow/pyproject.toml, agent-flow/examples/*, agent-flow/tests/*
Adds packaging metadata, console entry points, runnable examples, test doubles, backend tests, workflow tests, and contribution/tooling configuration.

Estimated code review effort: 5 (Critical) | ~120 minutes

Suggested reviewers: bowenfu

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is on-topic but missing the required Test Coverage and PR Checklist sections from the template. Add the missing Test Coverage and PR Checklist sections, and briefly summarize the key tests and any checklist items relevant to this import.
Docstring Coverage ⚠️ Warning Docstring coverage is 31.83% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is related to the main change: importing agent-flow and the modeling bringup workflow.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Note

Due to the large number of review comments, Critical severity comments were prioritized as inline comments.

🟠 Major comments (31)
agent-flow/agent_flow/console.py-104-106 (1)

104-106: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Remove the process-global stream mutation at import time.

_console_write already recovers after BlockingIOError; eagerly forcing stdout and stderr into blocking mode merely by importing this library can break asynchronous embedding applications.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/console.py` around lines 104 - 106, Remove the
import-time invocation of _ensure_blocking_streams() so importing the library
does not mutate process-global stdout or stderr state. Keep _console_write’s
existing BlockingIOError recovery behavior unchanged.
agent-flow/agent_flow/config.py-14-38 (1)

14-38: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Use StrictBaseModel for the exported configuration classes.

BackendConfig, SessionConfig, and AgentLayerConfig are public user inputs, but dataclasses provide no runtime validation for literals or nested fields. Convert them to strict Pydantic models with field descriptions and constrained types.

As per coding guidelines, “User-facing configuration classes must inherit from StrictBaseModel and use Pydantic validation, typed fields, and Field descriptions.”

Also applies to: 62-73

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/config.py` around lines 14 - 38, Convert the public
configuration classes BackendConfig, SessionConfig, and AgentLayerConfig from
dataclasses to StrictBaseModel subclasses. Replace dataclass fields with
Pydantic-typed fields using constrained types where appropriate and Field
descriptions, while preserving existing defaults and configuration behavior;
ensure nested configuration values and literal fields are validated at runtime.

Source: Coding guidelines

agent-flow/agent_flow/backends/claude_code.py-385-400 (1)

385-400: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Do not make unrestricted host execution the default.

Both backends disable sandboxing and approvals; Codex also accepts every current or future approval method. Model-controlled repository or PR content can therefore trigger shell and file operations with developer or CI privileges.

  • agent-flow/agent_flow/backends/claude_code.py#L385-L400: default to sandboxing and explicit approval; gate bypass mode behind an unsafe opt-in.
  • agent-flow/agent_flow/backends/codex.py#L846-L866: do not blanket-accept every */requestApproval.
  • agent-flow/agent_flow/backends/codex.py#L895-L905: replace danger_full_access and never approval defaults with restricted settings.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/backends/claude_code.py` around lines 385 - 400,
Restrict unrestricted host execution by default: in
agent-flow/agent_flow/backends/claude_code.py lines 385-400, update
ClaudeAgentOptions to enable sandboxing and require explicit tool approval,
allowing bypass mode only through an explicit unsafe opt-in; in
agent-flow/agent_flow/backends/codex.py lines 846-866, replace blanket handling
of every */requestApproval with an explicit allowlist of supported approval
methods; in agent-flow/agent_flow/backends/codex.py lines 895-905, replace
danger_full_access and never defaults with restricted sandbox and approval
settings.
agent-flow/agent_flow/backends/base.py-20-26 (1)

20-26: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Propagate backend failure results instead of reporting completion.

Both backends populate is_error, errors, and permission denials, but AgentLayer._execute only consumes text and usage, then reports success.

  • agent-flow/agent_flow/backends/base.py#L20-L26: define how failed results must be surfaced.
  • agent-flow/agent_flow/backends/claude_code.py#L245-L262: raise or return a failure the layer consumes when is_error is true.
  • agent-flow/agent_flow/backends/codex.py#L511-L517: ensure collected errors and denials cannot be silently treated as completion.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/backends/base.py` around lines 20 - 26, Ensure backend
failures propagate through the execution layer instead of being reported as
successful completion: in agent-flow/agent_flow/backends/base.py lines 20-26,
define the ResultEvent failure contract using is_error, errors, and
permission_denials; in agent-flow/agent_flow/backends/claude_code.py lines
245-262, make the backend raise or return a failure that AgentLayer._execute
consumes when is_error is true; and in agent-flow/agent_flow/backends/codex.py
lines 511-517, propagate collected errors and permission denials so they cannot
be treated as completion.
agent-flow/agent_flow/console.py-113-119 (1)

113-119: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Escape dynamic values before composing Rich markup.

Model and SDK strings containing brackets can alter rendered output or raise markup errors.

  • agent-flow/agent_flow/console.py#L113-L119: escape the raw layer name and suffix components.
  • agent-flow/agent_flow/console.py#L130-L136: escape the agent label before applying badge markup.
  • agent-flow/agent_flow/console.py#L320-L329: render exception text as escaped text.
  • agent-flow/agent_flow/console.py#L345-L351: use Text or escape thinking content before wrapping it in a style.
  • agent-flow/agent_flow/console.py#L401-L416: escape skill, plugin, and agent names.
  • agent-flow/agent_flow/console.py#L548-L568: escape tool descriptions and auxiliary values.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/console.py` around lines 113 - 119, Escape all dynamic
values before composing Rich markup. In agent-flow/agent_flow/console.py lines
113-119, update _layer_title to escape the raw layer name and suffix; lines
130-136, escape the agent label before badge markup; lines 320-329, render
exception text as escaped text; lines 345-351, use Text or escape thinking
content before styling; lines 401-416, escape skill, plugin, and agent names;
and lines 548-568, escape tool descriptions and auxiliary values.
agent-flow/agent_flow/backends/codex.py-783-809 (1)

783-809: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Don’t mark the SDK patch complete if a rebuild fails agent-flow/agent_flow/backends/codex.py:783-809

_SDK_PATCHED is set even when cls.model_rebuild(force=True) fails, so a partial patch can be treated as complete and never retried. Let the rebuild error surface, or track per-model success before setting the flag.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/backends/codex.py` around lines 783 - 809, The SDK
patch must not be marked complete when any model rebuild fails. Update the
rebuild logic used by _relax_service_tier_on_module so failures propagate or are
recorded, and only set _SDK_PATCHED in _patch_codex_sdk_service_tier after every
affected model rebuild succeeds, allowing later calls to retry an incomplete
patch.
agent-flow/CLAUDE.md-1-1 (1)

1-1: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add the required NVIDIA copyright header to every new file.

  • agent-flow/CLAUDE.md#L1-L1: prepend the repository-standard Markdown header.
  • agent-flow/agent_flow/hooks.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/layers.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/logger.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/module.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/runtime.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/types.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/utils.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/workflows/__init__.py#L1-L1: prepend the Python header.
  • agent-flow/tests/workflows/agent_team/__init__.py#L1-L1: prepend the Python header.
  • agent-flow/tests/workflows/agent_team/test_status.py#L1-L1: prepend the Python header.

As per coding guidelines, “Add the NVIDIA copyright header to all new files.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/CLAUDE.md` at line 1, All listed new files are missing the
required NVIDIA copyright header. Prepend the repository-standard Markdown
header to agent-flow/CLAUDE.md and the standard Python header to
agent-flow/agent_flow/hooks.py, layers.py, logger.py, module.py, runtime.py,
types.py, utils.py, agent-flow/agent_flow/workflows/__init__.py,
agent-flow/tests/workflows/agent_team/__init__.py, and test_status.py; no other
changes are required.

Source: Coding guidelines

agent-flow/agent_flow/hooks.py-164-179 (1)

164-179: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Complete the required function annotations.

  • agent-flow/agent_flow/hooks.py#L164-L179: annotate the hook arguments and async return value.
  • agent-flow/agent_flow/layers.py#L164-L268: annotate _build_ask_human_tool and the nested ask_human handler.
  • agent-flow/agent_flow/module.py#L10-L83: type _run_async, lifecycle methods, attribute values, and modules().
  • agent-flow/agent_flow/runtime.py#L60-L79: type the callable, arguments, and generic return values for _invoke, call, and acall.
  • agent-flow/agent_flow/utils.py#L30-L36: replace bare dict with a precise mapping type.
  • agent-flow/tests/workflows/agent_team/test_status.py#L11-L157: annotate helpers, fixtures, callbacks, and test returns.

As per coding guidelines, “Annotate every function” and use precise types rather than unnecessary Any.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/hooks.py` around lines 164 - 179, Complete function and
value annotations across agent-flow/agent_flow/hooks.py:164-179,
agent-flow/agent_flow/layers.py:164-268, agent-flow/agent_flow/module.py:10-83,
agent-flow/agent_flow/runtime.py:60-79, agent-flow/agent_flow/utils.py:30-36,
and agent-flow/tests/workflows/agent_team/test_status.py:11-157. Annotate
_stop_hook, _build_ask_human_tool, ask_human, _run_async, lifecycle methods,
module attributes, modules(), _invoke, call, acall, test helpers, fixtures,
callbacks, and test returns with precise non-Any types; replace the bare dict
annotation in utils.py with an explicit mapping type while preserving existing
behavior.

Source: Coding guidelines

agent-flow/agent_flow/module.py-85-92 (1)

85-92: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Make resource teardown exception-safe.

A single close failure currently prevents subsequent resources from being released and leaves stale lifecycle state.

  • agent-flow/agent_flow/module.py#L85-L92: continue closing remaining children and the parent, preserve the first failure, and set _closed in finally.
  • agent-flow/agent_flow/layers.py#L320-L325: clear persistent-client references even when AsyncExitStack.aclose() raises.
  • agent-flow/agent_flow/layers.py#L461-L465: ensure backend __aexit__ runs even when persistent-client cleanup fails.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/module.py` around lines 85 - 92, Make resource teardown
exception-safe across agent-flow/agent_flow/module.py:85-92,
agent-flow/agent_flow/layers.py:320-325, and
agent-flow/agent_flow/layers.py:461-465. In _aclose_tree, continue closing all
children and the parent after failures, preserve and re-raise the first failure,
and set _closed in a finally block. In the persistent-client cleanup at
layers.py:320-325, clear client references in finally even if
AsyncExitStack.aclose() fails. In the backend teardown at layers.py:461-465,
ensure __aexit__ runs even when persistent-client cleanup raises.
agent-flow/agent_flow/layers.py-129-133 (1)

129-133: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Assign the backend only after __aenter__ succeeds.

Line 131 preserves a partially initialized backend when entry raises. The next persistent invocation then skips __aenter__ and reuses that invalid instance.

Proposed fix
 async def _ensure_backend(self) -> Backend:
-    if self._backend is None:
-        self._backend = create_backend(self.config.backend)
-        await self._backend.__aenter__()
-    return self._backend
+    if self._backend is not None:
+        return self._backend
+
+    backend = create_backend(self.config.backend)
+    await backend.__aenter__()
+    self._backend = backend
+    return backend
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/layers.py` around lines 129 - 133, Update
_ensure_backend so the newly created backend is entered before assigning it to
self._backend; only persist the instance after __aenter__ succeeds, while
preserving reuse of an already initialized backend.
agent-flow/agent_flow/logger.py-35-40 (1)

35-40: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Make session-log creation collision-safe.

Lines 37-39 can race during first use, while separate processes started in the same second select the same truncating path. This can split or overwrite session logs. Protect singleton creation with a lock and include a PID/UUID or microseconds in the filename.

Proposed fix
+from os import getpid
+from threading import Lock
+
+_LOGGER_LOCK = Lock()
+
 def get_logger() -> Logger:
     global _logger
-    if _logger is None:
-        timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
-        _logger = Logger(_LOG_DIR / f"session-{timestamp}.log")
-        atexit.register(_logger.close)
+    with _LOGGER_LOCK:
+        if _logger is None:
+            timestamp = datetime.now().strftime("%Y%m%d-%H%M%S-%f")
+            _logger = Logger(_LOG_DIR / f"session-{timestamp}-{getpid()}.log")
+            atexit.register(_logger.close)
     return _logger
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/logger.py` around lines 35 - 40, Update get_logger to
make first-use singleton initialization thread-safe by guarding the _logger None
check and creation with a lock, while preserving a single shared logger and
atexit cleanup. Make the session filename unique across concurrent processes by
adding the process ID, UUID, or microsecond-resolution component to the existing
timestamp-based name.
agent-flow/agent_flow/runtime.py-31-40 (1)

31-40: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Always signal the waiting caller if the worker exits on BaseException.
runner.run() can raise asyncio.CancelledError and other BaseException subclasses, which skips the result_queue write and leaves call() blocked on result_queue.get().

Proposed fix
-                except Exception as exc:
+                except BaseException as exc:
                     result_queue.put((False, exc))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/runtime.py` around lines 31 - 40, Update the worker
loop around runner.run() in the visible queue-processing method to catch
BaseException, not only Exception, and always enqueue a failure result
containing the raised exception before the worker exits or continues. Preserve
the existing success signaling and sentinel handling while ensuring call() is
never left waiting when runner.run() raises asyncio.CancelledError or another
BaseException.
agent-flow/tests/workflows/pr_review/test_discussion.py-8-16 (1)

8-16: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add annotations to every helper and test function.

Annotate helper parameters/returns and add -> None to each test. As per coding guidelines, “Annotate every function.” <coding_guidelines>

Also applies to: 19-24, 27-39, 42-46, 49-55

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/tests/workflows/pr_review/test_discussion.py` around lines 8 - 16,
Annotate every helper and test function in test_discussion.py, including _call
and _tool and the functions in the referenced ranges. Add explicit parameter
types and return types to helpers, and add -> None to each test function, using
appropriate existing types without changing behavior.

Source: Coding guidelines

agent-flow/agent_flow/workflows/agent_team/prompts/qa.py-1-32 (1)

1-32: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Exclude task-irrelevant dimensions from the weighted score.

Every task is scored on performance and systems-programming sophistication, even when task.yaml does not require either. With the default 8.0 floor, a correct documentation, configuration, or simple scripting task can loop indefinitely. Allow N/A dimensions and remove their weights from the denominator, or derive scoring dimensions from the task.

Also applies to: 151-168

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/agent_team/prompts/qa.py` around lines 1 -
32, Update EVALUATION_CRITERIA and the QA scoring logic to support task-specific
dimensions: mark criteria such as Performance and Technical Sophistication as
N/A when task.yaml does not require them, exclude their weights from the
weighted-score denominator, and apply the same behavior to the additional
scoring path noted in the comment. Preserve scoring for applicable dimensions so
simple documentation, configuration, and scripting tasks can reach the required
threshold.
agent-flow/agent_flow/workflows/agent_team/cli.py-15-24 (1)

15-24: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Allow checkpoint resumes without --task.

The documented resume command supplies only --workspace, but required=True makes argparse reject it before checkpoint detection. Make --task optional when resuming and require it only for a fresh run, with corresponding workflow validation/tests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/agent_team/cli.py` around lines 15 - 24,
Update the CLI argument handling in the agent_team workflow so --task is not
argparse-required, allowing resume commands that provide only --workspace.
During workflow validation, require --task for fresh runs but permit its absence
when a checkpoint is detected; preserve task-file handling for fresh runs and
add or update tests covering both paths.
agent-flow/agent_flow/workflows/agent_team/README.md-1-1 (1)

1-1: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add the NVIDIA copyright header to every new file.

  • agent-flow/agent_flow/workflows/agent_team/README.md#L1-L1: prepend the canonical Markdown header.
  • agent-flow/agent_flow/workflows/agent_team/__init__.py#L1-L1: prepend the canonical Python header.
  • agent-flow/agent_flow/workflows/agent_team/cli.py#L1-L1: prepend the canonical Python header.
  • agent-flow/agent_flow/workflows/agent_team/progress.py#L1-L1: prepend the canonical Python header.
  • agent-flow/agent_flow/workflows/agent_team/prompts/__init__.py#L1-L1: prepend the canonical Python header.
  • agent-flow/agent_flow/workflows/agent_team/prompts/coder.py#L1-L1: prepend the canonical Python header.
  • agent-flow/agent_flow/workflows/agent_team/prompts/plan_drafter.py#L1-L1: prepend the canonical Python header.
  • agent-flow/agent_flow/workflows/agent_team/prompts/plan_reviewer.py#L1-L1: prepend the canonical Python header.
  • agent-flow/agent_flow/workflows/agent_team/prompts/qa.py#L1-L1: prepend the canonical Python header.
  • agent-flow/tests/workflows/modeling_bringup/__init__.py#L1-L1: prepend the canonical Python header.
  • agent-flow/tests/workflows/pr_review/test_discussion.py#L1-L1: prepend the canonical Python header.

As per coding guidelines, “Add the NVIDIA copyright header to all new files.” <coding_guidelines>

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/agent_team/README.md` at line 1, The listed
new files are missing the NVIDIA copyright header. Prepend the canonical
Markdown header to agent-flow/agent_flow/workflows/agent_team/README.md (lines
1-1), and prepend the canonical Python header to
agent-flow/agent_flow/workflows/agent_team/__init__.py (lines 1-1), cli.py
(lines 1-1), progress.py (lines 1-1), prompts/__init__.py (lines 1-1),
prompts/coder.py (lines 1-1), prompts/plan_drafter.py (lines 1-1),
prompts/plan_reviewer.py (lines 1-1), prompts/qa.py (lines 1-1),
agent-flow/tests/workflows/modeling_bringup/__init__.py (lines 1-1), and
agent-flow/tests/workflows/pr_review/test_discussion.py (lines 1-1), preserving
each file’s existing content after the header.

Source: Coding guidelines

agent-flow/agent_flow/workflows/agent_team/progress.py-748-751 (1)

748-751: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Give PlanReviewer build-progress access during replan review.

The PlanReviewer prompt requires detecting criteria softened after a QA failure, but this bundle exposes only plan_stage. In plan_drafter_replan_on_qa mode, also provide read_latest_build_progress; otherwise the reviewer must trust the drafter’s summary and cannot enforce the gate independently.

Proposed fix
+    plan_reviewer_tools = [
+        append_plan_reviewer_progress,
+        _make_read_tool("plan_reviewer"),
+    ]
+    if plan_drafter_replan_on_qa:
+        plan_reviewer_tools.append(_make_build_read_tool("plan_reviewer"))
+
     return {
         "plan_drafter": plan_drafter_tools,
-        "plan_reviewer": [
-            append_plan_reviewer_progress,
-            _make_read_tool("plan_reviewer"),
-        ],
+        "plan_reviewer": plan_reviewer_tools,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/agent_team/progress.py` around lines 748 -
751, Update the plan_reviewer tool bundle to include read_latest_build_progress
when the workflow is in plan_drafter_replan_on_qa mode, while preserving the
existing append_plan_reviewer_progress and plan_reviewer read-tool entries.
Ensure the PlanReviewer can independently inspect the latest build progress
during replan review.
agent-flow/agent_flow/workflows/agent_team/workflow.py-1296-1305 (1)

1296-1305: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not reject documented, criteria-compliant plan deviations.

The reviewer system contract explicitly permits documented deviations when task.yaml and all acceptance criteria still hold, but this invocation says to reject runtime behavior that contradicts the plan. That conflict can cause unnecessary rejection loops. Gate on task.yaml and acceptance criteria instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/agent_team/workflow.py` around lines 1296 -
1305, Update the reviewer instructions in the agent-team workflow prompt to
evaluate implementation results against task.yaml and all acceptance criteria,
rather than rejecting every documented deviation from the plan. Preserve
rejection for failed builds/tests, contradictory runtime behavior, or unmet
criteria, while allowing documented deviations that remain criteria-compliant.
agent-flow/agent_flow/workflows/agent_team/workflow.py-686-724 (1)

686-724: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Restore the checkpointed iteration budget on resume.

load_state() returns the saved num_iterations, but execution continues using the constructor value. For example, resuming iteration 150 of a 200-iteration checkpoint with the default 100 produces an empty loop and lines 420-424 silently mark the unfinished workflow done. Restore or explicitly reconcile the saved budget before entering the loop.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/agent_team/workflow.py` around lines 686 -
724, Restore the checkpointed iteration budget immediately after
load_state(self.state_path) in the resume flow, assigning the saved
state.num_iterations to self.num_iterations before any completion or build-loop
decisions. Ensure the existing feedback-extension logic in the resume branch
still extends that restored budget when needed, so unfinished workflows continue
from state.next_iteration_index instead of being marked complete by an empty
loop.
agent-flow/agent_flow/workflows/modeling_bringup/prompts/qa_extra.py-128-138 (1)

128-138: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reserve Status: ACCEPT for terminal workflow acceptance.

In replan mode, QA can APPROVE an intermediate Stage, so this rule writes a terminal-looking ACCEPT report while later Stages remain pending. Use an in-progress status for intermediate approvals and emit ACCEPT only after the final Stage passes.

Also applies to: 268-269

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/modeling_bringup/prompts/qa_extra.py` around
lines 128 - 138, Update the final-report status logic in the QA prompt around
the final-report contract so intermediate Stage approvals during replan mode use
an in-progress status rather than ACCEPT. Emit Status: ACCEPT only when the
final Stage has passed and the workflow is terminal, while preserving INCOMPLETE
for budget exhaustion and writing the report before append_qa_progress on every
turn.
agent-flow/agent_flow/workflows/modeling_bringup/prompts/_common.py-90-94 (1)

90-94: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Do not convert every probe failure into “skill unavailable.”

Catching Exception also suppresses programming errors in check_skill_via_agent_layer or probe result handling, silently removing the only sanctioned test runner from all prompts. Catch the documented backend/session failures specifically and let unexpected defects surface.

As per coding guidelines, “Catch the narrowest possible exceptions.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/modeling_bringup/prompts/_common.py` around
lines 90 - 94, Update the exception handling around check_skill_via_agent_layer
in the skill-detection flow to catch only the documented backend or session
failure exceptions. Continue returning an empty string for those expected
failures, but let programming errors from probing or probe result handling
propagate instead of treating the skill as unavailable.

Source: Coding guidelines

agent-flow/agent_flow/workflows/modeling_bringup/prompts/_common.py-332-340 (1)

332-340: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Align architecture-conflict guidance with the QA-driven replan path.

The shared root cause is unconditional text claiming that no programmatic replan exists, even though --replan-on-qa introduces one.

  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/_common.py#L332-L340: distinguish ordinary mode from Stage/Goal replan mode.
  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/_common.py#L407-L416: route unresolved hard-path conflicts through Failed Goal and QA rejection when replan is enabled.
  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/reviewer_extra.py#L52-L59: avoid instructing the Reviewer to wait exclusively for out-of-band human action in replan mode.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/modeling_bringup/prompts/_common.py` around
lines 332 - 340, Update the architecture-conflict guidance in _common.py at
lines 332-340 to distinguish ordinary mode from --replan-on-qa Stage/Goal replan
mode, preserving the hard-blocker guidance only when no programmatic replan
exists. In _common.py lines 407-416, route unresolved hard-path conflicts
through Failed Goal and QA rejection when replan is enabled. In
reviewer_extra.py lines 52-59, revise Reviewer guidance so replan mode does not
require waiting exclusively for out-of-band human action.
agent-flow/agent_flow/workflows/modeling_bringup/prompts/plan_drafter_extra.py-299-311 (1)

299-311: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Do not replace an unmet user criterion with a weaker success criterion.

The gap-fix flow may lower a task-defined threshold to an empirically achievable value, then treats approval of that replacement as resolving the original QA rejection. This can return DONE even though task.yaml’s completion criterion never passed. Keep the original gate authoritative; an unattainable gate should end as incomplete or require explicit human amendment of the task specification.

Also applies to: 355-363

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@agent-flow/agent_flow/workflows/modeling_bringup/prompts/plan_drafter_extra.py`
around lines 299 - 311, The gap-fix planning flow must keep the original
task.yaml completion criterion authoritative rather than replacing it with an
empirically achievable weaker threshold. Update the Goal and Stage acceptance
handling in the prompt definitions around the gap-fix instructions so approval
of a replacement criterion cannot produce DONE unless the original gate passes
or receives explicit human amendment; otherwise conclude as incomplete.
agent-flow/agent_flow/workflows/modeling_bringup/prompts/_common.py-97-97 (1)

97-97: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Keep the backend probe out of module import.

This assignment immediately invokes the cached getter, contradicting Lines 23-25 and potentially starting Claude/Codex sessions whenever any prompt module is imported. Resolve the invocation inside build_modeling_bringup_prompts instead.

Proposed direction
-TRTLLM_TEST_SPECIALIST_INVOCATION = get_trtllm_test_specialist_invocation()

Then call get_trtllm_test_specialist_invocation() when constructing the prompt bundle.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/modeling_bringup/prompts/_common.py` at line
97, Remove the module-level invocation assigned to
TRTLLM_TEST_SPECIALIST_INVOCATION, and call
get_trtllm_test_specialist_invocation() inside build_modeling_bringup_prompts
while constructing the prompt bundle. Preserve the existing prompt content and
ensure the backend probe occurs only when that builder function runs, not during
module import.
agent-flow/agent_flow/workflows/modeling_bringup/prompts/reviewer_extra.py-161-162 (1)

161-162: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Remove the reopened-Goal reset instruction.

Later rules explicitly make QA-rejected CLOSED Stages and their Goals immutable and require a new gap-fix Stage. Telling the Reviewer to reset “reopened Goal(s)” introduces an incompatible state transition.

Proposed fix
-- On QA REJECT (replan mode) or a Stage roll-back, reset the
-  reopened Goal(s) to `(iterations=0)`.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/modeling_bringup/prompts/reviewer_extra.py`
around lines 161 - 162, Remove the instruction requiring reopened Goals to be
reset to iterations=0 during QA REJECT replan mode or Stage rollback in the
reviewer prompt. Preserve the later rules that keep QA-rejected CLOSED Stages
and their Goals immutable and require a new gap-fix Stage.
agent-flow/agent_flow/workflows/pr_review/progress.py-101-107 (1)

101-107: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate each persisted progress entry before returning it.

A YAML stage such as stage1: [broken] passes this validation, then crashes in find_entries at e.get(...) or e["round"]. Validate that every item is a mapping with a valid agent, integer round, and decision so corrupted workspaces fail with a clear ValueError.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/pr_review/progress.py` around lines 101 -
107, Extend the progress-entry validation in the loop processing _STAGES before
assigning result[key]. For every item, require a mapping containing a valid
agent, an integer round, and a decision; raise a clear ValueError including the
path, stage key, and invalid entry details when any check fails, while
preserving valid entries unchanged.
agent-flow/agent_flow/workflows/pr_review/prompts/coder.py-26-26 (1)

26-26: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use one consistent final-tool ordering.

Both agents are told to call append_*_progress and then update_discussion, while also being told that append_*_progress must be their last action. Update the discussion first and append progress last.

  • agent-flow/agent_flow/workflows/pr_review/prompts/coder.py#L26-L26: reverse the two tool calls.
  • agent-flow/agent_flow/workflows/pr_review/prompts/coder.py#L75-L79: explicitly require update_discussion before the final progress call.
  • agent-flow/agent_flow/workflows/pr_review/prompts/reviewer.py#L24-L26: reverse the two tool calls.
  • agent-flow/agent_flow/workflows/pr_review/prompts/reviewer.py#L67-L70: explicitly require update_discussion before the final progress call.
  • agent-flow/tests/workflows/pr_review/test_prompts.py#L112-L147: assert this ordering in both generated prompts.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/pr_review/prompts/coder.py` at line 26, Make
the final-tool ordering consistent: in
agent-flow/agent_flow/workflows/pr_review/prompts/coder.py lines 26 and
agent-flow/agent_flow/workflows/pr_review/prompts/reviewer.py lines 24-26,
instruct agents to call update_discussion before append_*_progress; in coder.py
lines 75-79 and reviewer.py lines 67-70, explicitly state that the progress call
is the final action. Update agent-flow/tests/workflows/pr_review/test_prompts.py
lines 112-147 to assert this ordering in both generated prompts.
agent-flow/agent_flow/workflows/pr_review/README.md-1-1 (1)

1-1: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add the required NVIDIA copyright header to every new file.

  • agent-flow/agent_flow/workflows/pr_review/README.md#L1-L1: prepend the documentation-file header.
  • agent-flow/agent_flow/workflows/pr_review/__init__.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/workflows/pr_review/cli.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/workflows/pr_review/discussion.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/workflows/pr_review/progress.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/workflows/pr_review/prompts/__init__.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/workflows/pr_review/prompts/_common.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/workflows/pr_review/prompts/coder.py#L1-L1: prepend the Python header.
  • agent-flow/agent_flow/workflows/pr_review/prompts/reviewer.py#L1-L1: prepend the Python header.
  • agent-flow/tests/workflows/pr_review/test_progress.py#L1-L1: prepend the Python header.
  • agent-flow/tests/workflows/pr_review/test_prompts.py#L1-L1: prepend the Python header.

As per coding guidelines, “Add the NVIDIA copyright header to all new files.” <coding_guidelines>

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/pr_review/README.md` at line 1, Add the
standard NVIDIA copyright header at the beginning of every listed new file:
agent-flow/agent_flow/workflows/pr_review/README.md (1-1),
agent-flow/agent_flow/workflows/pr_review/__init__.py (1-1), cli.py (1-1),
discussion.py (1-1), progress.py (1-1), prompts/__init__.py (1-1),
prompts/_common.py (1-1), prompts/coder.py (1-1), prompts/reviewer.py (1-1),
agent-flow/tests/workflows/pr_review/test_progress.py (1-1), and
agent-flow/tests/workflows/pr_review/test_prompts.py (1-1). Use the
documentation header for README.md and the Python header for each .py file,
preserving all existing content after the header.

Source: Coding guidelines

agent-flow/agent_flow/workflows/pr_review/cli.py-20-26 (1)

20-26: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make target the required positional argument documented by the CLI.

The README invokes pr-review 1234, but this parser only accepts --target 1234. It also delays the missing-target error until workflow construction.

Proposed fix
     parser.add_argument(
-        "--target",
+        "target",
         help="The GitHub PR or GitLab MR to review — a number or URL. The "
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/pr_review/cli.py` around lines 20 - 26,
Update the CLI parser’s target argument in the argument-parser setup to be a
required positional argument named target, replacing the optional --target flag.
Preserve the existing help text and ensure downstream workflow construction
continues reading the parsed target value directly.
agent-flow/agent_flow/workflows/pr_review/workflow.py-159-162 (1)

159-162: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Bind checkpoints to the requested repository and PR/MR.

An explicit workspace containing an old checkpoint is resumed regardless of the current repo and target. Reusing it for another review silently loads stale pr_context.md and can review the wrong branch or repository.

Persist the resolved repository and identifier in WorkflowState, then reject mismatches on resume with guidance to use --clean.

Also applies to: 373-382

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/pr_review/workflow.py` around lines 159 -
162, Bind checkpoint state to the requested repository and target by persisting
the resolved repo and PR/MR identifier in WorkflowState when creating or saving
checkpoints. In the resume logic around self.resume and the workflow state
loading path, compare those stored values with the current repo and target;
reject mismatches with a clear message directing the user to use --clean, while
preserving resume behavior for matching checkpoints.
agent-flow/agent_flow/workflows/pr_review/vcs.py-128-136 (1)

128-136: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Shell-quote the repository path and base ref.

This command is executed by agents through a shell, but diff_base_ref is unquoted and double quotes do not neutralize $(), backticks, or embedded quotes in repo. Valid local paths/ref names can therefore break or inject into the command.

Proposed fix
 import os
+import shlex
 import shutil
-    repo_q = repo
-    return f'git -C "{repo_q}" diff "$(git -C "{repo_q}" merge-base {diff_base_ref} HEAD)"'
+    repo_q = shlex.quote(str(repo))
+    ref_q = shlex.quote(diff_base_ref)
+    return f'git -C {repo_q} diff "$(git -C {repo_q} merge-base {ref_q} HEAD)"'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/pr_review/vcs.py` around lines 128 - 136,
Update diff_command to shell-quote both repo and diff_base_ref safely for every
git invocation, including the nested merge-base command; use a standard
argument-quoting mechanism rather than manual interpolation, while preserving
the existing merge-base diff behavior and support for paths containing spaces or
shell metacharacters.
🧹 Nitpick comments (3)
agent-flow/agent_flow/backends/base.py (1)

84-94: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Define precise shared types for the backend client contract.

Raw list, dict, and Any prevent validation of tools, hooks, and MCP server configurations across implementations. Introduce shared aliases or protocols and reuse them in each backend.

As per coding guidelines, “Annotate every function, avoid Any, and prefer precise built-in generic types.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/backends/base.py` around lines 84 - 94, Update the
abstract BackendBase.create_client contract to replace raw list, dict, and Any
annotations with shared precise aliases or protocols for tools, hooks, and extra
MCP server configurations. Define or reuse those shared types consistently
across backend implementations, while preserving the existing optional
parameters and AsyncIterator[BackendClient] return contract.

Source: Coding guidelines

agent-flow/agent_flow/workflows/agent_team/state.py (1)

133-144: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the broad Exception handler.

Use finally for unconditional temporary-file cleanup so unexpected exceptions still propagate without broad interception. As per coding guidelines, catch the narrowest possible exceptions instead of broad Exception handlers.

Proposed refactor
+from contextlib import suppress
+
     try:
         with os.fdopen(fd, "w", encoding="utf-8") as fh:
             json.dump(payload, fh, indent=2)
             fh.flush()
             os.fsync(fh.fileno())
         os.replace(tmp_path, path)
-    except Exception:
-        try:
+    finally:
+        with suppress(FileNotFoundError):
             os.unlink(tmp_path)
-        except FileNotFoundError:
-            pass
-        raise
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/agent_team/state.py` around lines 133 - 144,
Update the temporary-file handling around the atomic write flow to remove the
broad Exception handler and move cleanup of tmp_path into a finally block. Keep
os.replace after the successful write, ensure cleanup is attempted
unconditionally while tolerating FileNotFoundError, and allow all other
exceptions to propagate naturally.

Source: Coding guidelines

agent-flow/tests/helpers.py (1)

26-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Complete function annotations across the new test suite.

  • agent-flow/tests/helpers.py#L26-L26: annotate async generators and context-manager methods.
  • agent-flow/tests/test_agent_layer.py#L38-L38: add -> None to tests and type local callbacks.
  • agent-flow/tests/test_backends.py#L45-L46: annotate fake SDK methods, helpers, and tests.
  • agent-flow/tests/test_console.py#L19-L19: type fixture parameters and add test return types.
  • agent-flow/tests/test_examples.py#L10-L10: type the module loader and tests.
  • agent-flow/tests/test_hooks.py#L69-L69: add test return types and precise mapping types.
  • agent-flow/tests/workflows/agent_team/test_progress.py#L17-L18: type loaders, stubs, and callbacks.
  • agent-flow/tests/workflows/agent_team/test_workflow.py#L14-L15: type workflow helpers and tests.
  • agent-flow/tests/workflows/modeling_bringup/test_workflow.py#L16-L17: type loaders, fixtures, and callbacks.
  • agent-flow/tests/workflows/pr_review/test_workflow.py#L18-L26: type seeded fixtures and nested agent callbacks.

As per coding guidelines, “Annotate every function; use None for non-returning functions.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/tests/helpers.py` at line 26, Complete annotations across all
affected test helpers and tests: in agent-flow/tests/helpers.py lines 26-26,
annotate send_message and its async-generator/context-manager methods; in
agent-flow/tests/test_agent_layer.py lines 38-38, add test return annotations
and type local callbacks; in agent-flow/tests/test_backends.py lines 45-46,
annotate fake SDK methods, helpers, and tests; in
agent-flow/tests/test_console.py lines 19-19, type fixture parameters and test
returns; in agent-flow/tests/test_examples.py lines 10-10, type the module
loader and tests; in agent-flow/tests/test_hooks.py lines 69-69, add test return
annotations and precise mapping types; in
agent-flow/tests/workflows/agent_team/test_progress.py lines 17-18, type
loaders, stubs, and callbacks; in
agent-flow/tests/workflows/agent_team/test_workflow.py lines 14-15, type
workflow helpers and tests; in
agent-flow/tests/workflows/modeling_bringup/test_workflow.py lines 16-17, type
loaders, fixtures, and callbacks; and in
agent-flow/tests/workflows/pr_review/test_workflow.py lines 18-26, type seeded
fixtures and nested agent callbacks. Annotate every function, using None for
non-returning functions.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2aae166e-84bb-4cfb-9131-89136471b61a

📥 Commits

Reviewing files that changed from the base of the PR and between 01f3463 and 8a55003.

⛔ Files ignored due to path filters (6)
  • agent-flow/agent_flow/workflows/agent_team/docs/agent-team-workflow.svg is excluded by !**/*.svg
  • agent-flow/agent_flow/workflows/agent_team/docs/agent-team.svg is excluded by !**/*.svg
  • agent-flow/agent_flow/workflows/modeling_bringup/docs/modeling-agent-workflow.svg is excluded by !**/*.svg
  • agent-flow/agent_flow/workflows/modeling_bringup/docs/workflow-container.svg is excluded by !**/*.svg
  • agent-flow/agent_flow/workflows/modeling_bringup/docs/workflow-slurm-mode.svg is excluded by !**/*.svg
  • agent-flow/agent_flow/workflows/modeling_bringup/docs/workflow.svg is excluded by !**/*.svg
📒 Files selected for processing (90)
  • agent-flow/.gitignore
  • agent-flow/.pre-commit-config.yaml
  • agent-flow/AGENTS.md
  • agent-flow/CLAUDE.md
  • agent-flow/README.md
  • agent-flow/agent_flow/__init__.py
  • agent-flow/agent_flow/backends/__init__.py
  • agent-flow/agent_flow/backends/base.py
  • agent-flow/agent_flow/backends/claude_code.py
  • agent-flow/agent_flow/backends/codex.py
  • agent-flow/agent_flow/config.py
  • agent-flow/agent_flow/console.py
  • agent-flow/agent_flow/hooks.py
  • agent-flow/agent_flow/layers.py
  • agent-flow/agent_flow/logger.py
  • agent-flow/agent_flow/module.py
  • agent-flow/agent_flow/runtime.py
  • agent-flow/agent_flow/types.py
  • agent-flow/agent_flow/utils.py
  • agent-flow/agent_flow/workflows/__init__.py
  • agent-flow/agent_flow/workflows/agent_team/README.md
  • agent-flow/agent_flow/workflows/agent_team/__init__.py
  • agent-flow/agent_flow/workflows/agent_team/cli.py
  • agent-flow/agent_flow/workflows/agent_team/progress.py
  • agent-flow/agent_flow/workflows/agent_team/prompts/__init__.py
  • agent-flow/agent_flow/workflows/agent_team/prompts/coder.py
  • agent-flow/agent_flow/workflows/agent_team/prompts/plan_drafter.py
  • agent-flow/agent_flow/workflows/agent_team/prompts/plan_reviewer.py
  • agent-flow/agent_flow/workflows/agent_team/prompts/qa.py
  • agent-flow/agent_flow/workflows/agent_team/prompts/reviewer.py
  • agent-flow/agent_flow/workflows/agent_team/state.py
  • agent-flow/agent_flow/workflows/agent_team/status.py
  • agent-flow/agent_flow/workflows/agent_team/workflow.py
  • agent-flow/agent_flow/workflows/modeling_bringup/README.md
  • agent-flow/agent_flow/workflows/modeling_bringup/__init__.py
  • agent-flow/agent_flow/workflows/modeling_bringup/cli.py
  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/__init__.py
  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/_common.py
  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/coder_extra.py
  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/plan_drafter_extra.py
  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/plan_reviewer_extra.py
  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/qa_extra.py
  • agent-flow/agent_flow/workflows/modeling_bringup/prompts/reviewer_extra.py
  • agent-flow/agent_flow/workflows/modeling_bringup/quick_start.md
  • agent-flow/agent_flow/workflows/modeling_bringup/task.example.yaml
  • agent-flow/agent_flow/workflows/modeling_bringup/task.slurm.example.yaml
  • agent-flow/agent_flow/workflows/modeling_bringup/task_schema.py
  • agent-flow/agent_flow/workflows/pr_review/README.md
  • agent-flow/agent_flow/workflows/pr_review/__init__.py
  • agent-flow/agent_flow/workflows/pr_review/cli.py
  • agent-flow/agent_flow/workflows/pr_review/discussion.py
  • agent-flow/agent_flow/workflows/pr_review/progress.py
  • agent-flow/agent_flow/workflows/pr_review/prompts/__init__.py
  • agent-flow/agent_flow/workflows/pr_review/prompts/_common.py
  • agent-flow/agent_flow/workflows/pr_review/prompts/coder.py
  • agent-flow/agent_flow/workflows/pr_review/prompts/reviewer.py
  • agent-flow/agent_flow/workflows/pr_review/prompts/sourcing.py
  • agent-flow/agent_flow/workflows/pr_review/sourcing.py
  • agent-flow/agent_flow/workflows/pr_review/state.py
  • agent-flow/agent_flow/workflows/pr_review/vcs.py
  • agent-flow/agent_flow/workflows/pr_review/workflow.py
  • agent-flow/examples/human_in_the_loop.py
  • agent-flow/examples/planner_generator_evaluator_workflow.py
  • agent-flow/examples/quick_start.py
  • agent-flow/pyproject.toml
  • agent-flow/tests/__init__.py
  • agent-flow/tests/conftest.py
  • agent-flow/tests/helpers.py
  • agent-flow/tests/test_agent_layer.py
  • agent-flow/tests/test_backends.py
  • agent-flow/tests/test_console.py
  • agent-flow/tests/test_examples.py
  • agent-flow/tests/test_hooks.py
  • agent-flow/tests/test_module_composition.py
  • agent-flow/tests/test_sessions.py
  • agent-flow/tests/workflows/__init__.py
  • agent-flow/tests/workflows/agent_team/__init__.py
  • agent-flow/tests/workflows/agent_team/test_progress.py
  • agent-flow/tests/workflows/agent_team/test_status.py
  • agent-flow/tests/workflows/agent_team/test_workflow.py
  • agent-flow/tests/workflows/modeling_bringup/__init__.py
  • agent-flow/tests/workflows/modeling_bringup/test_workflow.py
  • agent-flow/tests/workflows/pr_review/__init__.py
  • agent-flow/tests/workflows/pr_review/test_discussion.py
  • agent-flow/tests/workflows/pr_review/test_progress.py
  • agent-flow/tests/workflows/pr_review/test_prompts.py
  • agent-flow/tests/workflows/pr_review/test_sourcing.py
  • agent-flow/tests/workflows/pr_review/test_state.py
  • agent-flow/tests/workflows/pr_review/test_vcs.py
  • agent-flow/tests/workflows/pr_review/test_workflow.py

Comment on lines +500 to +504
f"Read `{self.pr_context_path}` for the PR/MR under review and the "
f"exact diff command. Run that command — and read the changed "
f"files and build/run/test as needed — to judge the **current** "
f"change (it includes the coder's uncommitted edits from earlier "
f"rounds).\n\n"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🔴 Critical | 🏗️ Heavy lift

Sandbox execution of code from the PR/MR branch.

These prompts direct agents to build, run, and test attacker-controlled PR code in the operator environment. A malicious test, build script, package hook, or executable can therefore achieve code execution with the workflow user's credentials.

Run these actions in an isolated disposable environment with restricted credentials/network/filesystem access, or require explicit confirmation before executing repository code.

Also applies to: 527-535

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-flow/agent_flow/workflows/pr_review/workflow.py` around lines 500 -
504, Update the workflow prompts around the PR/MR inspection instructions and
the corresponding section at lines 527-535 to prohibit unsandboxed execution of
repository-controlled code. Require agents to use an isolated disposable
environment with restricted credentials, network, and filesystem access, or
obtain explicit user confirmation before running build, test, or other
executable commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant