Polish session resume messaging to match the console UX

Update in-REPL /resume success output to the same structured console style used elsewhere so session lifecycle commands feel consistent with status, model, permissions, config, and cost. This preserves the same behavior while improving operator readability.

Constraint: Resume output must stay grounded in real restored session metadata already available after load
Rejected: Add more restored-session details like cwd snapshot | that data is not yet persisted in session files
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep lifecycle command outputs stylistically aligned as the CLI surface grows
Tested: cargo fmt --manifest-path ./rust/Cargo.toml --all; cargo clippy --manifest-path ./rust/Cargo.toml --workspace --all-targets -- -D warnings; cargo test --manifest-path ./rust/Cargo.toml --workspace
Not-tested: Manual interactive comparison of /resume output before and after multiple restores
This commit is contained in:
Yeachan-Heo
2026-03-31 21:04:42 +00:00
parent cba31c4f95
commit cf8d5a8389

View File

@@ -327,6 +327,15 @@ fn format_cost_report(usage: TokenUsage) -> String {
)
}
fn format_resume_report(session_path: &str, message_count: usize, turns: u32) -> String {
format!(
"Session resumed
Session file {session_path}
Messages {message_count}
Turns {turns}"
)
}
fn run_resume_command(
session_path: &Path,
session: &Session,
@@ -657,7 +666,10 @@ impl LiveCli {
true,
permission_mode_label(),
)?;
println!("Resumed session from {session_path} ({message_count} messages).");
println!(
"{}",
format_resume_report(&session_path, message_count, self.runtime.usage().turns())
);
Ok(())
}
@@ -1274,10 +1286,10 @@ fn print_help() {
mod tests {
use super::{
format_cost_report, format_model_report, format_model_switch_report,
format_permissions_report, format_permissions_switch_report, format_status_report,
normalize_permission_mode, parse_args, render_init_claude_md, render_repl_help,
resume_supported_slash_commands, status_context, CliAction, SlashCommand, StatusUsage,
DEFAULT_MODEL,
format_permissions_report, format_permissions_switch_report, format_resume_report,
format_status_report, normalize_permission_mode, parse_args, render_init_claude_md,
render_repl_help, resume_supported_slash_commands, status_context, CliAction, SlashCommand,
StatusUsage, DEFAULT_MODEL,
};
use runtime::{ContentBlock, ConversationMessage, MessageRole};
use std::path::{Path, PathBuf};
@@ -1400,6 +1412,15 @@ mod tests {
);
}
#[test]
fn resume_report_uses_sectioned_layout() {
let report = format_resume_report("session.json", 14, 6);
assert!(report.contains("Session resumed"));
assert!(report.contains("Session file session.json"));
assert!(report.contains("Messages 14"));
assert!(report.contains("Turns 6"));
}
#[test]
fn cost_report_uses_sectioned_layout() {
let report = format_cost_report(runtime::TokenUsage {