Skip to content

fix(cli): accept latest/last as a run id on show, watch, diagnose and friends - #893

Merged
Birfy merged 1 commit into
mainfrom
fix/892-latest-run-alias
Nov 8, 2026
Merged

Birfy merged 1 commit into
mainfrom
fix/892-latest-run-alias

Conversation

@Birfy

@Birfy Birfy commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Closes #892

status, watch, show, apply, cancel, resume and diagnose now take latest (or last, any case) in place of a run id and resolve it to the newest run in the store, so agentdescent demo && agentdescent show latest works without copying the timestamped id.

  • A real run directory literally named latest/last still wins.
  • An empty store raises a clear no runs under … yet error (also via --json), instead of no run 'latest'.
  • Resolution happens in cli.main only; runstore.py is untouched.
  • show/watch/diagnose help mentions latest.

Tests: tests/test_latest_run_alias.py (newest wins, real dir wins, empty store, other ids untouched); -k "cli or help or docs or json" suite passes locally.

@Birfy

Birfy commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review at tip 2c51e76

Verdict: PASS

  • Alias resolution is confined to cli.main for the seven run-id commands; audit/--run-id flags and runstore.get are unchanged.
  • A real latest/last run dir is preferred; empty store errors through the existing RunStoreError path (exit 2, --json object).
  • New tests cover newest-wins, literal-dir-wins, empty store and untouched ids; local -k "cli or help or docs or json" suite green.
  • risk_gate: T2 (83 lines / 3 files).

@Birfy
Birfy enabled auto-merge (squash) November 8, 2026 16:15
@Birfy

Birfy commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS

Tip SHA: 2c51e76
Ran: tests/test_latest_run_alias.py (4 passed); -k "cli or help or json or runstore" plus tests/test_docs_links.py on the tip — all pass except tests/test_plugin_host_cli.py::test_present_host_passes, which fails identically on main in this environment (a gateway key ARK_API_KEY is set on the review box), so unrelated. risk_gate.py → T2 (83 lines / 3 files).
Not run: full suite; CI matrix 3.9–3.13 still in progress at review time.

Correctness

Design fit: keeping it in cli.main and leaving runstore untouched keeps the MCP/library API exact-id only, which is the safer default. Case-insensitive match is fine since generated ids are never those words.

Tests/docs: cover newest-wins, real-dir-wins, empty store, and untouched other ids; help text updated on show/watch/diagnose; changelog fragment present.

Nits (non-blocking): status/apply/cancel/resume help could mention latest too for discoverability; with a default store and a run being created concurrently, latest is naturally racy, which is acceptable for an interactive alias.

@Birfy
Birfy merged commit bd91f24 into main Nov 8, 2026
9 checks passed
@Birfy
Birfy deleted the fix/892-latest-run-alias branch November 8, 2026 16:38
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.

show/watch/diagnose: no way to point at the newest run without copying its id

1 participant