aws-samples / aws-samples/sample-autonomous-cloud-coding-agents
fix(agent): is_verify_command_inert misses mise's "unknown command" output — INERT build-gating warning never fires
- Vorherrschende Sprache
- TypeScript
- Sterne
- 143
- Forks
- 46
- Ø Merge
- 3 T. 10 Std.
- Gemergte PRs (30 T.)
- 24
Beschreibung
### Component
Agent (Python runtime)
### Describe the bug
`is_verify_command_inert()` (`agent/src/post_hooks.py:77-99`) fails to recognise mise's actual "task does not exist" phrasing, so a repository with **no `mise.toml` at all** is never classified as inert.
The most damaging consequence is not the wrong `build_passed`/`lint_passed` value — it is that the operator-facing warning at `agent/src/repo.py:517-526` never fires:
```python
if not config.build_command and is_verify_command_inert(result.returncode, result.stderr):
build_gate_inert = True
notes.append(
"⚠️ Build-regression gating is INERT: no runnable `mise run build` task ..."
)
```
Because the detector returns `False`, that note is never appended. A repo onboarded with no `pipeline.buildCommand` and no `mise.toml` therefore gets **build-regression gating silently disabled with no warning to anyone** — precisely the failure mode the warning exists to prevent.
### Expected behavior
`mise run build` / `mise run lint` in a repo with no `mise.toml` should be detected as inert, so that:
1. `build_gate_inert` / lint-inert is set,
2. the "⚠️ Build-regression gating is INERT" note is appended and surfaced on the PR, and
3. `build_passed` / `lint_passed` reflect inert-treated-as-passing rather than a bogus red.
### Current behavior
The detector returns `False`, no inert warning is emitted, and `lint_passed` is persisted as `false` on every task against such a repo.
### Reproduction steps
In any checkout with no `mise.toml` (e.g. a clone of `aws-samples/sample-semantic-layer-structured`):
```console
$ mise run lint; echo "EXIT=$?"
mise ERROR unknown command: lint
Did you mean:
mise install-into
mise plugin-list
mise ERROR Version: 2026.8.4 macos-arm64
EXIT=1
```
Then feed that verbatim to the detector:
```console
$ python3 -c "
import sys; sys.path.insert(0,'agent/src')
from post_hooks import is_verify_command_inert
print(is_verify_command_inert(1, 'mise ERROR unknown command: lint'))"
False
```
The heuristics check exit `127`, `"no tasks defined"`, `"no task named"`, `"mise"` + `"not found"`, and `"command not found"`. Real mise emits **`unknown command`** with exit **1**, matching none of them.
Observed in practice on task `01KZS7NFB480DGF2A6FZ5N3CZD` and `01KZS86KNZPVK8FZXX757ADZ8S` (both `lint_passed=false`, no inert note on the PR).
### Possible solution
Add mise's real phrasing to the heuristic list in `is_verify_command_inert`:
```python
or "unknown command" in s
```
Worth reviewing the full set of mise task-missing messages across versions rather than adding one string, and adding a regression test that feeds the verbatim stderr above. Note the mise version string is included in that stderr, so a test fixture should not match on version.
Related: the same detector is used for the post-agent gate in `agent/src/post_hooks.py` and for the lint inert path, so build and lint inert handling are both affected by the single missed match.
Beitragsleitfaden
Rechercherichtung
Beginne in agent/src/post_hooks.py bei is_verify_command_inert() und reproduziere die mise-stderr aus dem Issue wortgetreu. Überprüfe die zugehörige Behandlung in agent/src/repo.py, wo die Inert-Warnung angehängt wird, und füge einen Regressionstest hinzu, der Exit-Code und stderr abdeckt; fertig ist es, wenn build- und lint-Inert-Fälle die Warnung anzeigen und falsche Fehlschläge vermeiden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- backend
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 78/100