Skip to content

Commit dc4fa55

Browse files
committed
fix(cli): /status JSON emits null model and correct session_id in resume mode
Two bugs in --output-format json --resume /status: 1. 'model' field emitted 'restored-session' (a run-mode label) instead of the actual model or null. Fixed: status_json_value now takes Option<&str> for model; resume path passes None; live REPL path passes Some(model). 2. 'session_id' extracted parent dir name ('sessions') instead of the file stem. Session files are session-<id>.jsonl directly under .claw/sessions/, not in a subdirectory. Fixed: extract file_stem() instead of parent().file_name(). 159 CLI tests pass.
1 parent 9cf4033 commit dc4fa55

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • rust/crates/rusty-claude-cli/src

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,7 +2741,7 @@ fn run_resume_command(
27412741
&context,
27422742
)),
27432743
json: Some(status_json_value(
2744-
"restored-session",
2744+
None,
27452745
StatusUsage {
27462746
message_count: session.messages.len(),
27472747
turns: tracker.turns(),
@@ -5006,7 +5006,7 @@ fn print_status_snapshot(
50065006
CliOutputFormat::Json => println!(
50075007
"{}",
50085008
serde_json::to_string_pretty(&status_json_value(
5009-
model,
5009+
Some(model),
50105010
usage,
50115011
permission_mode.as_str(),
50125012
&context,
@@ -5017,7 +5017,7 @@ fn print_status_snapshot(
50175017
}
50185018

50195019
fn status_json_value(
5020-
model: &str,
5020+
model: Option<&str>,
50215021
usage: StatusUsage,
50225022
permission_mode: &str,
50235023
context: &StatusContext,
@@ -5046,9 +5046,9 @@ fn status_json_value(
50465046
"untracked_files": context.git_summary.untracked_files,
50475047
"session": context.session_path.as_ref().map_or_else(|| "live-repl".to_string(), |path| path.display().to_string()),
50485048
"session_id": context.session_path.as_ref().and_then(|path| {
5049-
// Session files live under .claw/sessions/<session-id>/<file>.jsonl
5050-
// Extract the session-id directory component.
5051-
path.parent().and_then(|p| p.file_name()).map(|n| n.to_string_lossy().into_owned())
5049+
// Session files are named <session-id>.jsonl directly under
5050+
// .claw/sessions/. Extract the stem (drop the .jsonl extension).
5051+
path.file_stem().map(|n| n.to_string_lossy().into_owned())
50525052
}),
50535053
"loaded_config_files": context.loaded_config_files,
50545054
"discovered_config_files": context.discovered_config_files,

0 commit comments

Comments
 (0)