Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,6 @@
"Before the merge, follow the upgrade plan of #4406: read the release notes and the migrations, and load `k8s/llm/gateway/config.yaml` with the new release."
]
},
{
"description": "pydantic-ai 2.67 and later cap google-genai below 3, and the lock holds an older pydantic-ai, so lock maintenance would move google-genai to 3 alone. The pydantic-ai move of #5098 removes this hold.",
"matchPackageNames": ["google-genai"],
"allowedVersions": "<3"
},
{
"description": "semgrep pins mcp==1.29.0, also in its newest release (1.185.0 on 2026-11-16), so uv finds no lock of the semgrep tool with the security fix, and Renovate stopped the fix as an empty commit at each run. The hold ends when the lock takes the fix. #3988 tracks the advisories of the tools lock.",
"matchManagers": ["pip-compile"],
Expand Down
2 changes: 1 addition & 1 deletion docs/ENV_VARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ All configuration options for `devops-cli` can be overridden via environment var
| `DEVOPS_CLI_ROADMAP_IMPLEMENT_STEP_TIME_LIMIT_SECONDS` | `roadmap.implement.step_time_limit_seconds` | No | The most seconds that one implementation step may take, counted from its start. The step compares the time with this limit before each model request, so a command or a model call that is running ends by its own limit first (`command_timeout_seconds`, `request_timeout_seconds`). A step over the limit stops with the class `limit_reached` |
| `DEVOPS_CLI_ROADMAP_IMPLEMENT_STEP_TOKEN_BUDGET` | `roadmap.implement.step_token_budget` | No | The most new tokens that the replies of one implementation step may report, summed over all its requests, its repair rounds and its tiers. The new tokens of a reply are its input tokens that the provider did not read from its cache, and its output tokens. Before each request the step compares its count with this budget. A step that has spent it gets one extension when its last tool calls show progress (see `step_token_ceiling`). Otherwise, and at the end of the extension, it stops with the class `limit_reached`, and the stop names this setting |
| `DEVOPS_CLI_ROADMAP_IMPLEMENT_STEP_TOKEN_CEILING` | `roadmap.implement.step_token_ceiling` | No | The most new tokens (see `step_token_budget`) that one implementation step may reach with its one extension. A step that reaches `step_token_budget` gets one extension of half the budget when its last `extension_calls` tool calls hold at least one successful edit and at most `extension_max_refused` refused commands (the rule `implement.extension`), and the extension stops at this ceiling. It must not be below `step_token_budget`. When no config file and no variable sets it, it is twice `step_token_budget`, also after a change of the budget. The item budget still holds |
| `DEVOPS_CLI_ROADMAP_IMPLEMENT_TOOL_RETRIES` | `roadmap.implement.tool_retries` | No | The failures in a row that one tool of an implementation step may answer before the run ends, such as an `edit_file` whose text is not found. A successful call resets the count, and a refusal of the shell by policy is no failure. The settings load refuses a value above 4 times the default |
| `DEVOPS_CLI_ROADMAP_IMPLEMENT_TOOL_RETRIES` | `roadmap.implement.tool_retries` | No | The failures in a row that one tool of an implementation step may answer as a retry, such as an `edit_file` whose text is not found. The next failure comes back to the model as a failed result and the run goes on, but arguments that break the schema of the tool end the run. A successful call resets the count, and a refusal of the shell by policy is no failure. The settings load refuses a value above 4 times the default |
| `DEVOPS_CLI_ROADMAP_INTAKE_BACKLOG_INTERVAL_MINUTES` | `roadmap.intake.backlog_interval_minutes` | No | The minutes from the start of a round of this row to the start of its next round, while the queue that its last round counted holds `backlog_threshold` or more items. Empty by default, which turns the backlog rule off. It must not be above `interval_minutes` |
| `DEVOPS_CLI_ROADMAP_INTAKE_BACKLOG_THRESHOLD` | `roadmap.intake.backlog_threshold` | No | The count of items in the queue of this row from which the row runs at `backlog_interval_minutes`. The row counts its queue from the listing that its round reads. Empty by default, which turns the backlog rule off |
| `DEVOPS_CLI_ROADMAP_INTAKE_INTERVAL_MINUTES` | `roadmap.intake.interval_minutes` | No | The minutes from the start of a round of this row of the Service to the start of its next round, while its queue holds fewer items than `backlog_threshold`. Each round reads it again, so a change needs no restart |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ The research sweep of #3909 finds advisories and releases that mention a compone
- `read_file` lines 196-238 of `src/devops_cli/security/prompt_injection.py` showed `src/devops_cli/security/prompt_injection.py:207:def scan_injection_line(line: str, line_no: int, location: str) -> list[Finding]:` calling four detectors, and `src/devops_cli/security/prompt_injection.py:217:def scan_injection_text(`; none of the four reads a plain instruction, so a fifth detector is needed.
- The review finding that the new detector breaks the INJ002 case is no defect: `tests/security/test_prompt_injection.py:47:hidden = "Ignore previous instructions` holds no second-person possessive, the new pattern needs one, so `tests/security/test_prompt_injection.py:49:assert len(findings) == 1` still holds, and group 3's verify runs that whole module.
- `search_code` for `class ResearchConfig`, `JUDGE_INSTRUCTIONS`, `judge_records`, `check_judged_citations` and `judge_intake_candidate` each found no line of the commit, so the names and the settings section are new.
- `pyproject.toml:40:"pydantic-ai[spec]==2.59.0",` and `pyproject.toml:41:"pydantic-ai-harness[coder]==0.59.0",` are the staged pins, and `docs/adr/0028-a-research-agent-composes-open-tools-and-a-research-index.md:21:the open agent framework of the project` is the chosen option, with lines 22, 23 and 24 rejecting GPT Researcher, the LangChain agent and STORM.
- `pyproject.toml:40:"pydantic-ai[spec]==2.71.0",` and `pyproject.toml:41:"pydantic-ai-harness[coder]==0.71.0",` are the staged pins, and `docs/adr/0028-a-research-agent-composes-open-tools-and-a-research-index.md:21:the open agent framework of the project` is the chosen option, with lines 22, 23 and 24 rejecting GPT Researcher, the LangChain agent and STORM.
- No verify introduces a program: `uv run devops ci test` and `uv run devops ci docs` are rows of the gate, and `uv`, `python`, `pytest` and `devops` are tools of the runner image. Their failure classes are `test`, `lint`, `types` and `ci_infra`, each with an action in the action-by-class table. The live run is `NOT_IN_RUNNER`, because the runner holds no model gateway client; it is a manual process that no verify runs, and its failure class is `provider` with the action `retry`. The pod keeps `runAsNonRoot: true`, `readOnlyRootFilesystem: true`, `capabilities.drop: ALL`, `allowPrivilegeEscalation: false` and `seccompProfile: RuntimeDefault`.
- The first check of the implementation against the real system is `uv run devops ci test tests/research/test_research_judge.py` after group 1, and the last is `uv run devops ci docs` after group 8.

## Existing Tool Considered

pydantic-ai 2.59.0 with pydantic-ai-harness 0.59.0, both pinned, through the project's `build_agent` factory, `create_function_toolset`, the injection scanner, `rag_search` and pydantic-ai's `TestModel` and `FunctionModel`, cover the agent loop, the typed output, the tool schema, the spend hook, the scan and the offline test models. They lack the judgment prompt text, the four read-only record tools, the citation check, the two limit stops and the labeled fixture, which this change builds at about 72k tokens to build, about 3k tokens a year to keep and fix, and about 6 hours elapsed. It deletes no code.
pydantic-ai 2.71.0 with pydantic-ai-harness 0.71.0, both pinned, through the project's `build_agent` factory, `create_function_toolset`, the injection scanner, `rag_search` and pydantic-ai's `TestModel` and `FunctionModel`, cover the agent loop, the typed output, the tool schema, the spend hook, the scan and the offline test models. They lack the judgment prompt text, the four read-only record tools, the citation check, the two limit stops and the labeled fixture, which this change builds at about 72k tokens to build, about 3k tokens a year to keep and fix, and about 6 hours elapsed. It deletes no code.

## Dependencies

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-11-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Design

## Decisions

- Find a retry with `is_retry(part)`, which pydantic-ai 2.69 gives for this check. A retried `ToolReturnPart` stays out of the tool answers of the trace and out of the match lines of a search tool, as a `RetryPromptPart` did.
- Keep the stock `Coder` of 0.71. The new instructions, the strict default and the answer to spent retries come with the upgrade. The next items of #6519 run `Coder` as upstream runs it, so the change writes no code to undo them.
- Record the retry parts from a run of an agent on the installed pydantic-ai, and replace only the content of the part when a test needs given errors. A part that the framework no longer builds then fails the test.
- Read an error frame of the stream before the class of its error: pydantic-ai 2.71 gives the 408 frame the category `ModelTimeoutError`, and the frame is not a timeout of the client.
- Catch `ToolFailed` in `ToolCallLog._execute`: pydantic-ai 2.71 turns it into `ToolFailedError` only after the hooks that wrap the tool return, so the log saw neither error for the call that `Coder` answers.
- Match `Model\w*Error: HTTP <status>` in the provider rule, but not `ModelContextWindowExceededError` or `ModelQuotaExceededError`: the reason of a failed model call names the class and the status, every class of an HTTP error of pydantic-ai is a `ModelHTTPError`, and 2.59 already gave those two their names, so their stops keep the class `ci_infra`. A transport timeout, which has no status, keeps its class.
- Test the last-retries line of `ToolCallLog` on an agent with no `Coder`, where a tool still ends the run when it spends its retries.

## Rejected alternatives

- Keep the `RetryPromptPart` checks: pydantic-ai 2.71 builds no such part, so 4 tests of the stage toolbox found 0 violations where the run had 1.
- Strip the spent-retries answer of `Coder` in `_tune`: it is a private class of the harness (`_ReportExhaustedRetries`), and the next item of #6519 adopts the stock `Coder`.
- Keep `pydantic_ai_harness.filesystem`: it gives a `HarnessDeprecationWarning` on 0.71.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Proposal: #5098

## Why

`pyproject.toml` pins pydantic-ai 2.59.0 and pydantic-ai-harness 0.59.0. The newest releases are 2.71.0 and 0.71.0 (2026-11-19). Experiment 1 of #6519 runs the stock harness `Coder` as upstream runs it, and needs the 0.71 features. The move breaks run-time checks with no error (#5098): since 2.60 pydantic-ai builds no `RetryPromptPart`, so the run trace stops counting the schema violations of the output tool.

Closes #5098.

## What Changes

- Pin `pydantic-ai[spec]==2.71.0` and `pydantic-ai-harness[coder]==0.71.0`. The lock moves pydantic-ai-slim, pydantic-evals and pydantic-graph with them, and no other package.
- `RunTrace` and the investigation of refine find a retry with `is_retry`: the `ToolReturnPart` of a call with `outcome='retried'`, or a `RetryFeedbackPart`.
- The `DeferredToolRequests.build_results` override takes `answered_by`.
- The gateway call model sends a stream again when an error frame with code 408 comes before the first event. pydantic-ai 2.71 raises that frame as a `ModelTimeoutError`, which the model read as a timeout of the client.
- The step imports `FileSystem` from `pydantic_ai_harness.file_system`, its name since 0.69.
- `ToolCallLog` notes the call that `Coder` answers with a failed result (a `ToolFailed` after the retries of the tool) as failed, with its reason. So its Job log line and trace event stay, and the same call again gets the refusal of a repeated failed call (#3570).
- The provider rule of the failure classes takes an HTTP error of pydantic-ai by the class of a status category that 2.71 adds, such as `ModelRequestRejectedError: HTTP 400`, as it took `ModelHTTPError`. `ModelContextWindowExceededError` and `ModelQuotaExceededError`, which 2.59 named already, keep their class.
- The description of `roadmap.implement.tool_retries` says that a spent retry comes back to the model as a failed result.
- `.github/renovate.json` holds google-genai below 3 no more: pydantic-ai 2.71 caps it below 3 itself.
- The ruff rule TID251 bans `RetryPromptPart` and `pydantic_ai_harness.filesystem`, so neither comes back.
- The tests take the retry parts from a recorded run of an agent (`refused_call`, `refused_output`, `refused_text` in `tests/support/model_script.py`), not from a hand-built `RetryPromptPart`.

The upgrade changes behavior that the change keeps as upstream gives it:

- `Coder` answers the call that spends the retries of a tool with the last error as a failed result, and the run goes on (0.65). So the reason of a step names no last retries, and that call counts as no retry. The `roadmap-implement-step/trace` delta states this.
- `Coder` has new base instructions (0.69), sends its tools with no strict schema (0.64), and protects the `.git` file of a worktree.
- A reply that the output token limit cuts with no output ends the run with `OutputTokenLimitExceeded`, a kind of `UnexpectedModelBehavior`, at once (2.68). The stop of refine names that class.

## Capabilities

### New Capabilities

None.

### Modified Capabilities

- `roadmap-implement-step/budgets`: `tool_retries` bounds the retries of a tool; only arguments that break the schema of the tool then end the step.
- `roadmap-implement-step/trace`: a step goes on when a file tool spends its retries, so its reason names no last retries, and the call that `Coder` answers with a failed result counts as no retry.

## Impact

The roadmap jobs stage, implement, refine and alternatives run on pydantic-ai 2.71. Fits one pull request.

## Feasibility

PyPI names 2.71.0 and 0.71.0 as the newest releases. `uv lock` resolves them and keeps google-genai 2.34.0, tenacity 9.1.4, genai-prices 0.2.5 and openai 3.49.0. On 2.71.0, 18 tests of `tests/roadmap/stage`, `tests/roadmap/implement`, `tests/roadmap/refine`, `tests/roadmap/test_roadmap_alternatives.py` and `tests/ai` failed, and mypy found one error in `src/devops_cli/ai/tools/__init__.py`. The release notes of v2.60.0 to v2.71.0 name the changes above.

## Existing Tool Considered

pydantic-ai and pydantic-ai-harness themselves, MIT, maintained. `is_retry` of `pydantic_ai.messages` replaces the class checks. The change deletes the hold rule of `.github/renovate.json` and the hand-built retry parts of the tests.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## MODIFIED Requirements

### Requirement: The limits that end an implement step are settings
The implement step SHALL read each limit that ends its run from `roadmap.implement` when the step starts. The default of each new setting SHALL be the value of the constant that it replaces, so a step with no configuration does not change. The file tools of the harness SHALL take `tool_retries` in place of their own count.

#### Scenario: No configuration
- **WHEN** no source sets `max_requests`, `max_tool_calls`, `tool_retries`, `max_refusals`, `max_consecutive_refusals`, `model_resends`, `extension_calls` and `extension_max_refused`
- **THEN** they are 500, 1500, 5, 30, 3, 1, 20 and 3, the values of the constants that they replace

#### Scenario: The refusal and retry limits of a setting
- **WHEN** `max_consecutive_refusals` is 5, `max_refusals` is 7 and `tool_retries` is 2
- **THEN** 5 refusals in a row stop a step, 7 refusals between accepted calls stop a step at its eighth request, and a third call of `read_file` in a row with no `path` argument stops a step

#### Scenario: No resend and a small request limit
- **WHEN** `model_resends` is 0 and `max_requests` is 2
- **THEN** a request that fails with a 400 inside a stream is not sent again, and a model that reads in every reply gets 2 requests

#### Scenario: The window of the extension
- **WHEN** `extension_calls` is 10 and `extension_max_refused` is 5
- **THEN** the digest of the tool log counts the last 10 calls, and a step at its token budget with 5 refused commands in them gets the extension
Loading