Skip to content

fix(cli): --json evolve and --json show report stop_detail (#1190) - #1191

Open
HugoXK wants to merge 2 commits into
mainfrom
agent/1190-json-stop-detail
Open

HugoXK wants to merge 2 commits into
mainfrom
agent/1190-json-stop-detail

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1190.

What changed

--json evolve and --json show printed "stop_reason": "budget" and nothing that named the limit, so a caller could not tell the operator ceiling (AGENTDESCENT_MAX_CALLS) from its own --max-calls without opening status.json; the human status line already said it (#1166). Both payload builders now copy stop_detail from the run status when it is set, and omit the key when no cap tripped, so an uncapped payload keeps its previous shape. stop_reason, _status_line and status.json are unchanged. show_payload is also the MCP show path, so that surface gains the same additive key (Partial: #1166 — the gap its acceptance left, not drift). No model or network call.

Verification at the tip

Tip SHA: 72a1d74

Ran:

  • red-first, test-only commit 88a0a92e (base f5017f93 plus the new test):
    pytest -o addopts='' tests/test_cli_json_stop_detail.py -q
    -> 2 failed, 2 passed; test_evolve_json_names_the_limit_that_fired and
    test_show_json_names_the_limit_that_fired both KeyError: 'stop_detail'
  • same file at the tip, re-read just now -> 4 passed
  • teeth on the absence rows (blanket None instead of the guarded write)
    -> 2 failed, 2 passed (..._omits_stop_detail_without_a_cap x2); probe reverted, tree greps clean
  • focused set: budget_guard, operator_run_cap, show_no_result, propose_errors,
    show_samples, show_fusion_stats, latest_run_alias, evolve_provider_error,
    runstore_cli -> 113 passed
  • mcp, diagnose, mcp_write_confinement plus the new file -> 91 passed
  • python -m tools.gen_api_docs --check -> up to date (re-read at the tip)
  • python -m tools.changelog_fragments check -> 5 fragments OK (re-read at the tip)
  • full pytest -q at this tip -> 19 failed, 7930 passed, 51 skipped, 0 errors
    (junit tests=8000); clean main f5017f93 under the same interpreter ->
    19 failed, 7926 passed, 51 skipped; the 19 red ids are set-identical,
    0 tip-only and 0 main-only, and the +4 passed are this PR's four new rows;
    all 19 are docker/era_srbench/toolchain host rows

Not run:

  • mkdocs build --strict — no docs change
  • real-model / container checks — not needed and not available offline

)

Both builders drop it today, so the machine output names the reason but not
the limit. The rows assert the key is absent without a cap (the guard against
a blanket None) and carry the cap's label when one fired.
Additive: the key is written only when a run-level cap tripped, so an
uncapped payload keeps yesterday's shape. `stop_reason`, the human status
line and `status.json` are unchanged.
@HugoXK

HugoXK commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Full suite at 72a1d74a: 19 failed, 7930 passed, 51 skipped, 0 errors in 2263s (junit tests=8000, 0 duplicates).

The 19 red ids are all host-environment, none of them touches this diff:

  • 12 x tests/test_sandbox_container.py ([docker] rows plus the container-judging row) — no docker on this box
  • 6 x tests/test_era_srbench.py
  • 1 x tests/test_genesis_example.py::test_a_shared_toolchain_directory_is_not_mounted

Clean main at the PR's parent f5017f93 is running under the same interpreter and HOME/TMPDIR now; the id-set parity line lands here when it finishes, so the count above is not yet a parity claim.

@HugoXK

HugoXK commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Full suite at the tip, as Not run: promised.

Tip SHA: 72a1d74

Command: python -m pytest -o addopts="" -q in the branch worktree (no network, no model call).

19 failed, 7930 passed, 51 skipped, 527 warnings in 2263.04s (0:37:43)

The 19, by file:

  • tests/test_sandbox_container.py — 12 rows, all EngineError: docker run --detach failed (125): Unable to find image 'python:3.11-slim' locally (no registry access here, so the image never resolves).
  • tests/test_era_srbench.py — 6 rows, the fixture ends in MemoryError.
  • tests/test_genesis_example.py — 1 row, test_a_shared_toolchain_directory_is_not_mounted asserts a host toolchain path is None.

None of them is in agentdescent/cli.py or tests/test_cli_json_stop_detail.py; the new file is 4 passed in this run. I did not run a base comparison for these 19, so they are reported as observed, not attributed to this diff.

No other write on this PR.

@HugoXK

HugoXK commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Parity, measured now — the baseline finished after the comment above.

  • tip 72a1d74a: 19 failed, 7930 passed, 51 skipped, 0 errors (junit tests=8000)
  • clean main f5017f93 (this PR's parent), same interpreter, same HOME/TMPDIR: 19 failed, 7926 passed, 51 skipped (junit tests=7996)
  • failing-id sets are identical: 19/19 the same names, 0 tip-only, 0 main-only
  • the +4 passed at the tip are this PR's four new rows in tests/test_cli_json_stop_detail.py

So no new red, and the body's Not run: line is now replaced with these counts. The diff is cli.py +9, one fragment, one new test file; no docs and no generated file changed, which is why mkdocs build --strict is still not run.

@Birfy

Birfy commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Review (Birfy)

Tip SHA: 72a1d74
Ran:

  • .github/scripts/risk_gate.py --repo ThinkFlowLab/agentdescent --pr 1191 → T2 (106 lines / 3 files)
  • pytest -o addopts="" -p no:cacheprovider -q tests/test_cli_json_stop_detail.py tests/test_budget_guard.py tests/test_operator_run_cap.py tests/test_show_no_result.py tests/test_show_samples.py at this tip → 42 passed
  • python -m tools.changelog_fragments check → 5 fragments OK
  • python -m tools.gen_api_docs --check → docs/api.md is up to date
  • Required CI at this tip → green (build, test (3.9)–test (3.13), otel-wire; deploy skipped; risk tier / reviewed tip report-only)
    Not run:
  • Full offline suite locally — the CI test matrix is the line
  • mkdocs build --strict — no docs/ or mkdocs.yml change in the diff
    Findings:
  • No actionable defects. --json evolve and --json show (and therefore MCP show, which uses show_payload) copy stop_detail only when a cap tripped, so an uncapped payload keeps its previous shape. stop_reason, the human status line, and status.json are untouched.
  • Left as draft, per the author; not merging while it is still a draft.
    Verdict: PASS

@github-actions github-actions Bot added risk:T2 Risk tier T2 (package code or an unnamed path), set by the controller from the diff agent-pr Pull request opened by an agent labels Nov 20, 2026
Birfy pushed a commit that referenced this pull request Nov 20, 2026
Fixes #1192.

## What changed

`.github/scripts/controller.py`:

- `read_prs` records `draft` from the pull list it already fetches — no
extra API request.
- `plan` skips a draft PR right after `hold`, with reason `draft` in the
existing `skipped` shape: `{"number": n, "label": "*", "reason":
"draft"}`. A skip is no add and no remove, so a draft keeps the labels
it already has; `hold` is still checked first, so an operator-held draft
reports `hold`.
- no new plan key: `plan()` still returns `{"ops", "skipped", "notes"}`,
`render` prints the entry as `- #20 `?`: draft`, `validate_plan` and
`apply` see exactly today's plan. `apply` is unchanged, so a PR
converted to draft between plan and apply can still take one round of
labels; that window is a recorded known gap, not fixed here.

`AGENTS.md`: the controller paragraph now says "open non-draft PRs"
instead of "open PRs" — the one clause this change makes stale.

`changelog.d/1192-draft-skip.md`: `Fixed`.

## Why this is live, not hypothetical

Run `44773778580` (`event: pull_request`, `created_at
2026-11-20T16:28:42Z`, `head_sha cd5a608…`) was `#1194`'s own `opened`
event executing that branch's new trigger with main's script. Its `plan`
job reported "4 operation(s), 0 skipped" (`16:28:54Z`) and `apply`
succeeded; the labels landed as `#1194` `agent-pr` + `risk:T3` from
`16:29:04Z` and the parked draft `#1191` `risk:T2` at `16:29:05Z`,
`agent-pr` at `16:29:06Z` — no cron, no dispatch. Once `#1187` merges,
every `opened`/`ready_for_review`/`reopened` fires that full pass, so
skipping drafts in `plan` is what keeps a parked draft out of the queue.

## Red first at `050235a4`

Clean worktree at `050235a4` with only the new test file copied in (`git
status --short` → `?? tests/test_process_controller_draft.py`):

```
pytest tests/test_process_controller_draft.py -o addopts="" -q
→ 4 failed, 1 passed
```

- `test_read_prs_records_the_draft_flag_it_already_fetches` — `KeyError:
'draft'`: the base record has no such field.
- `test_a_draft_pr_is_skipped_and_keeps_the_labels_it_has` — base
`plan()` for a `draft: true` PR returns `add risk:T2` + `add agent-pr`
with `skipped: []`.
- `test_a_ready_pr_next_to_it_is_labelled_normally` — the same ops
appear beside the `draft: false` control row, which must stay untouched.
- `test_the_draft_reason_needs_no_new_plan_key_and_renders` — the base
renders `| PR #30 | add | risk:T2 | risk-tier |` where the skip belongs.

The one pass is the `hold` control, which must hold before and after.

At this tip: 144 passed in the ten-file focused set; `python -m
tools.changelog_fragments check` → 7 fragments OK. Full offline suite on
the pre-rebase tree (`b64388b0`, identical diff): 7940 passed, 32
failed, 29 skipped — the same 32 environment rows red at the base (15
`test_era_*` without numpy in the sandbox runner, 12
`test_sandbox_container` without a Docker daemon, 2 `test_integrations`,
`test_genesis_example::test_a_shared_toolchain_directory_is_not_mounted`,
`test_merge_golden`, `test_test_package_resolution`).

Tip SHA: 83bae39

Ran:
- the ten-file focused set (`test_process_controller`,
`test_process_controller_draft`, `test_controller`,
`test_workflow_actions_pinned`, `test_process_labels`,
`test_process_risk_gate`, `test_process_review_gate`,
`test_process_merge_lane_base`, `test_changelog_fragments`,
`test_safety_controller`) at this tip → 144 passed
- `python -m tools.changelog_fragments check` → 7 changelog fragment(s)
OK
- full offline suite at `b64388b0`, the same diff before the rebase onto
`050235a4` → 7940 passed, 32 failed, 29 skipped, the same 32 ids red at
the base

Not run:
- full offline suite at this exact tip — the rebase replayed `b64388b0`
onto `050235a4`; the focused set was re-run at the tip
- Docker sandbox rows and the wheel smoke — host environment, unrelated
to a label filter
- `mkdocs build --strict` — no `docs/` or `mkdocs.yml` change

No UI surface: the controller script, its tests, and one clause in
AGENTS.md.
@HugoXK HugoXK added the area:cli The agentdescent command line (cli.py, doctor, plan/evolve/status/apply) label Nov 21, 2026
@HugoXK

HugoXK commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

State field change, announced before the flip: this PR goes draft → ready, and gains the label awaiting-approval.

Reason: the head 72a1d74a already carries Birfy's PASS at that exact sha (its review comment above: no findings, Verdict: PASS), and every required check is green at it — build, test (3.9)–test (3.13), otel-wire; deploy skipped; risk tier / reviewed tip report-only. Birfy left it draft because the author had, not because anything is open.

main has moved to 4b46761a since this PR's base f5017f93. The five commits in between touch none of this PR's three files (agentdescent/cli.py, changelog.d/1190-json-stop-detail.md, tests/test_cli_json_stop_detail.py), so no new tip is needed and the PASS at 72a1d74a still names the current head. Nothing is re-pushed; Partial: #1166 in the body is unchanged.

The merge stays the owner's click.

@HugoXK HugoXK added the bug Something isn't working label Nov 21, 2026
@HugoXK
HugoXK marked this pull request as ready for review November 21, 2026 01:04
@HugoXK HugoXK added awaiting-approval Green T2/T3 PR: waits for a PASS at its tip and Danyang's merge click and removed bug Something isn't working area:cli The agentdescent command line (cli.py, doctor, plan/evolve/status/apply) labels Nov 21, 2026

This branch has not been deployed

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

Labels

agent-pr Pull request opened by an agent awaiting-approval Green T2/T3 PR: waits for a PASS at its tip and Danyang's merge click risk:T2 Risk tier T2 (package code or an unnamed path), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(cli): --json evolve and --json show drop stop_detail, so the machine output cannot say which cap stopped the run

2 participants