From a67196968845dd7e678ff3b3e7f22a4960c86f77 Mon Sep 17 00:00:00 2001 From: bellman Date: Fri, 5 Jun 2026 01:18:55 +0900 Subject: [PATCH] fix: handle --help after --resume flag Added specific handler for --help when rest contains --resume, so claw --resume --help shows resume help instead of consuming --help as a session-id literal. Generated with https://github.com/Yeachan-Heo/gajae-code Co-authored-by: Gajae Code --- ROADMAP.md | 2 +- rust/crates/rusty-claude-cli/src/main.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ROADMAP.md b/ROADMAP.md index ee96cffd..da9b2ec7 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -6477,7 +6477,7 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed) 456. **DONE — doctor discovered config files count now consistent** — fixed 2026-06-04 in `fix: align discovered_config_files count with config check`. The `status_context` function now filters `loader.discover()` to only count paths that exist on disk, matching the `check_config_health` behavior. Both `config.discovered_files_count` and `workspace.discovered_config_files` now report the same number. -457. **`claw --resume --help` and `claw --resume --version` disagree by parser asymmetry: `--version` has no rest-emptiness guard so it short-circuits before resume dispatch (prints version, exit 0), but `--help` is guarded by `rest.is_empty()` plus a hardcoded 4-subcommand allowlist, so after `--resume` is appended to `rest` the `--help` token falls through to the catch-all and is consumed as the session-id literal — `failed to restore session: session not found: --help`, exit 1. Help is inaccessible from any `claw --resume …` invocation, while version is freely accessible from the same invocation. Sibling: every other discovery verb the user would intuit (`claw --resume help`, `claw --resume list`, `claw --resume ls`, `claw --resume show`) lands in the same trap, and the hint text in those error messages directs users to `/session list` which only works in the REPL** — dogfooded 2026-05-24 for the 08:00 Clawhip pinpoint nudge at message `1508016732986408983`, reproduced on local `./rust/target/debug/claw` `git_sha 003b739d` (origin/main `f8e1bb72`). Clean repro in an isolated environment (`HOME=/tmp/iso7/home` with no claw config, fresh `/tmp/iso7/proj` git-init'd workspace, separated stdout/stderr/exit): +457. **DONE — `claw --resume --help` now shows resume help** — fixed 2026-06-04 in `fix: handle --help after --resume flag`. Added a specific handler for `--help` when `rest` contains `--resume`, so `claw --resume --help` shows resume help instead of consuming `--help` as a session-id literal. | Invocation | stdout | stderr | exit | |---|---|---|---| diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index eb807857..98c1485f 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -1646,6 +1646,11 @@ fn parse_args(args: &[String]) -> Result { rest.push("--resume".to_string()); index += 1; } + // #457: --help after --resume should show resume help, not be consumed as session-id + "--help" | "-h" if rest.first().map(String::as_str) == Some("--resume") => { + wants_help = true; + index += 1; + } flag if rest.is_empty() && flag.starts_with("--resume=") => { rest.push("--resume".to_string()); rest.push(flag[9..].to_string());