From c447a5f1f5d0e7860511d97d378c4fd23e80f22b Mon Sep 17 00:00:00 2001 From: Placidoe <113952363+Placidoe@users.noreply.github.com> Date: Fri, 30 Oct 2026 19:20:19 +0000 Subject: [PATCH] fix: show current session ID in /status (#12607) Co-authored-by: Douwe Osinga --- crates/goose-cli/src/session/input.rs | 2 +- crates/goose/src/agents/execute_commands.rs | 2 +- .../src/agents/state_machine/ops_status.rs | 20 ++++++++++++++++++- .../src/agents/state_machine/tests/mod.rs | 1 + .../docs/guides/goose-cli-commands.md | 1 + 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/crates/goose-cli/src/session/input.rs b/crates/goose-cli/src/session/input.rs index bf8f9ee9f..00efff23e 100644 --- a/crates/goose-cli/src/session/input.rs +++ b/crates/goose-cli/src/session/input.rs @@ -432,7 +432,7 @@ fn help_text() -> String { /model [name] - Show the current model, or switch models for this session while keeping the same provider /model --provider [model] - Switch to a different provider (optionally specifying a model) /compact - Compact the current conversation to reduce context length while preserving key information. -{additional_builtin_help}/status - Show session status: model, provider, mode, and token usage. +{additional_builtin_help}/status - Show session status: session ID, model, provider, mode, and token usage. /edit [text] - Open your prompt editor to compose a message. Optionally pre-fill with text. Uses $GOOSE_PROMPT_EDITOR, $VISUAL, or $EDITOR (in that order). /skills - List available skills or enable skills by name (usage: /skills [...]) diff --git a/crates/goose/src/agents/execute_commands.rs b/crates/goose/src/agents/execute_commands.rs index 652450a3b..cb52d19cf 100644 --- a/crates/goose/src/agents/execute_commands.rs +++ b/crates/goose/src/agents/execute_commands.rs @@ -50,7 +50,7 @@ static COMMANDS: &[CommandDef] = &[ }, CommandDef { name: "status", - description: "Show session status: model, provider, mode, and token usage", + description: "Show session status: session ID, model, provider, mode, and token usage", }, ]; diff --git a/crates/goose/src/agents/state_machine/ops_status.rs b/crates/goose/src/agents/state_machine/ops_status.rs index e0937a26b..c10c37609 100644 --- a/crates/goose/src/agents/state_machine/ops_status.rs +++ b/crates/goose/src/agents/state_machine/ops_status.rs @@ -60,7 +60,25 @@ impl Operation for StatusOperation { } else { "N/A".to_string() }; - let response = Message::assistant().with_text(format!("**Session status**\n\n- Model: {}\n- Provider: {}\n- Mode: {}\n- Tokens (lifetime): {}\n- Context: {} / {} tokens ({})", self.model_config.model_name, self.provider.get_name(), session.goose_mode, lifetime_tokens, context_tokens, context_limit, context_pct)).with_visibility(true, false); + let response = Message::assistant() + .with_text(format!( + "**Session status**\n\n\ + - Session ID: `{}`\n\ + - Model: {}\n\ + - Provider: {}\n\ + - Mode: {}\n\ + - Tokens (lifetime): {}\n\ + - Context: {} / {} tokens ({})", + session.id, + self.model_config.model_name, + self.provider.get_name(), + session.goose_mode, + lifetime_tokens, + context_tokens, + context_limit, + context_pct, + )) + .with_visibility(true, false); let command_message = messages_since_kickoff(conversation)? .first() .cloned() diff --git a/crates/goose/src/agents/state_machine/tests/mod.rs b/crates/goose/src/agents/state_machine/tests/mod.rs index 21bc0825c..f6bb30f85 100644 --- a/crates/goose/src/agents/state_machine/tests/mod.rs +++ b/crates/goose/src/agents/state_machine/tests/mod.rs @@ -514,6 +514,7 @@ async fn slash_commands_yield_or_fall_through_to_inference() -> Result<()> { let status = pipeline.run(["/status"]).await?; assert_eq!(api.call_count(), 0); + status.assert_message(-1, Agent, &format!("Session ID: `{}`", pipeline.session_id)); status.assert_message(-1, Agent, "Provider:"); assert!(status .conversation() diff --git a/documentation/docs/guides/goose-cli-commands.md b/documentation/docs/guides/goose-cli-commands.md index 0c251c328..5b0f99085 100644 --- a/documentation/docs/guides/goose-cli-commands.md +++ b/documentation/docs/guides/goose-cli-commands.md @@ -828,6 +828,7 @@ Once you're in an interactive session (via `goose session` or `goose run --inter - **`/compact`** - Compact and summarize the current conversation to reduce context length while preserving key information - **`/r`** - Toggle full tool output display (show complete tool parameters without truncation) - **`/skills [...]`** - List available skills, or load one or more skills by name +- **`/status`** - Show the current session ID, model, provider, mode, and token usage. Use the ID to resume the same session in another client, or with `goose session --resume --session-id ` in the CLI. - **`/t`** - Toggle between `light`, `dark`, and `ansi` themes. [More info](#themes). - **`/t `** - Set theme directly (light, dark, ansi)