Skip to content

simulate: list, view and export subcommands - #968

Open
u9g wants to merge 3 commits into
mainfrom
jason/simulate-subcommands
Open

simulate: list, view and export subcommands#968
u9g wants to merge 3 commits into
mainfrom
jason/simulate-subcommands

Conversation

@u9g

@u9g u9g commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Requested in Slack: lk agent simulate --view can reopen a past run, but there was no way to list runs to find an ID.

Rather than add --list next to --view and --export, this makes the run operations subcommands. Each of those flags took an ID and replaced the whole run action, and audio inherited them, so lk agent simulate audio --view ID parsed and did something meaningless. A flag that swaps the action is a subcommand; this matches the noun/verb shape of the rest of lk (lk agent list, lk room list, lk egress list) and the git stash / git stash list / git stash show precedent of a verb whose bare form does the main thing.

lk agent simulate [entrypoint]        run (unchanged)
lk agent simulate audio [entrypoint]  run, audio pipeline (unchanged)
lk agent simulate list                newest runs for the project (new)
lk agent simulate view <run-id>       was --view
lk agent simulate export <run-id>     was --export

Commit 1 turns --view/--export into view/export with a positional run ID and updates the exit hints to print the new forms. The old flags are removed, not aliased: the hint is reprinted after every run, so only stale scrollback breaks.

Commit 2 adds list: one ListSimulationRuns call for the project's first page (server returns newest first, 20 per page, no jobs), rendered like lk agent list with --json for the raw response.

Commit 3 adds --limit to list, the same next_page_token loop as lk egress list: unset keeps the single-page default, --limit N walks pages until N runs are collected. --json prints the collected runs inside the List response so the field formatting is unchanged. No filters yet.

The run flags on simulate stay persistent, so list/view/export still parse --scenarios etc. and ignore them. Making them local would break lk agent simulate --scenarios f audio: urfave/cli v3 resolves a flag by the first command in the lineage that declares it and re-runs PreParse on the child's flags, so a shared or duplicated flag loses the value parsed on the parent.

Tested against my dev project: list, list --limit 3, list --json, view <id> (CI and TUI paths), export <id>. Paging tested against a staging project with 184 runs: --limit 45 returned 45 unique runs across three pages, newest first with no seam; --limit 1000 drained all 184.

u9g added 2 commits September 8, 2026 14:12
--view ID and --export ID each replaced the whole run action from inside
a flag, and audio inherited both. A flag that takes an ID and swaps the
action is a subcommand, so they become `lk agent simulate view <run-id>`
and `lk agent simulate export <run-id>`, matching the noun/verb shape of
the rest of lk. The exit hints print the new forms.
`lk agent simulate list` prints the API's first page (newest first) with
ID, created time, status, mode and agent name, or the raw response with
--json, so a run ID can be found without the dashboard.
@u9g
u9g force-pushed the jason/simulate-subcommands branch from 6b361bf to 88f2a00 Compare September 8, 2026 18:13
`lk agent simulate list` fetched only the API's first page (20 runs).
--limit walks next_page_token until that many runs are collected, the
same loop as `lk egress list`; unset keeps the single-page default.
--json now prints the collected runs wrapped in the List response so the
field formatting is unchanged.
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.

2 participants