Skip to content

feat(cli): collision-proof --run_id auto for rehearsals/stage demos (#116) - #160

Merged
micahstubbs merged 2 commits into
mainfrom
claude/issue-116-auto-run-id
Jun 7, 2026
Merged

feat(cli): collision-proof --run_id auto for rehearsals/stage demos (#116)#160
micahstubbs merged 2 commits into
mainfrom
claude/issue-116-auto-run-id

Conversation

@micahstubbs

Copy link
Copy Markdown
Owner

Closes #116.

Fixed-run-id demo commands aborted on a second rehearsal (setup_run_directory errors if run_<id> exists). Adds a collision-proof mode:

  • src/cli.rs: --run_id now parses as a string; --help documents auto or a positive integer.
  • src/run.rs: resolve_run_id(arg, runs_root)auto scans the resolved runs root (honors --runs-dir/SIA_RUNS_DIR) for run_<n> and picks max+1 (or 1); numeric ids unchanged; 0/negatives/garbage rejected up front. run_orchestrator prints Run directory: <path> as the first line, before any LLM work. No deletion/overwrite by default.
  • Tests: numeric collision still errors; auto picks next free id under a custom --runs-dir; unit tests for resolve_run_id (ignores non-run_<n> entries, gaps ok).
  • docs/HACKATHON_DEMO.md: rehearsal/live/checklist now use --run_id auto.

Verified: with run_1+run_4 present, autorun_5. Gate green: fmt/clippy/test (default + --features llm) + parity OK.

https://claude.ai/code/session_01WX3ZN9azxr1fyWuZAaRJ7Y


Generated by Claude Code

Add an `auto` mode to `--run_id` so repeated rehearsals/restarts never
collide with an existing `run_<id>` directory. `auto` scans the runs root
(honoring `--runs-dir` / `SIA_RUNS_DIR`) and picks `max(n)+1`, or 1 if none.
Numeric ids keep their historical behavior, including the existing-directory
error in setup_run_directory.

- src/cli.rs: --run_id now parses as a string ('auto' or positive integer);
  --help documents both forms.
- src/run.rs: new pub `resolve_run_id(arg, runs_root) -> SiaResult<i64>` plus
  `next_free_run_id`; run_orchestrator resolves the runs root first, then the
  run id against that same root, and prints `Run directory: <path>` before any
  expensive LLM work so the presenter sees where artifacts land.
- docs/HACKATHON_DEMO.md: rehearsal + live-run commands use `--run_id auto`.
- Tests: unit tests for resolve_run_id (numeric passthrough, invalid rejection,
  auto next-free incl. gaps/non-run entries, auto under a custom root) and
  integration tests for numeric collision error + auto-under-custom-runs-dir.

https://claude.ai/code/session_01WX3ZN9azxr1fyWuZAaRJ7Y
…-run-id

# Conflicts:
#	docs/HACKATHON_DEMO.md
@micahstubbs
micahstubbs merged commit 0034a4c into main Jun 7, 2026
15 checks passed
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.

Add collision-proof run IDs for rehearsal and stage demos

1 participant