Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions rust/src/providers/claude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,28 @@ fn cleanup_probe_session_jsonl(probe_dir: &std::path::Path) {
}
}

/// Arguments shared by every Claude CLI `/usage` probe.
///
/// The remote-control startup hook can otherwise change the interactive
/// session before the usage command is collected. Keep this override in one
/// helper so future CLI probe paths cannot silently omit it.
fn claude_usage_settings_args() -> [String; 2] {
[
"--settings".to_string(),
r#"{"remoteControlAtStartup":false}"#.to_string(),
]
}

fn claude_probe_launch_args(session_id: &str) -> Vec<String> {
vec![
let mut args = vec![
"--setting-sources".to_string(),
"user".to_string(),
"--allowed-tools".to_string(),
String::new(),
"--settings".to_string(),
r#"{"remoteControlAtStartup":false}"#.to_string(),
"--session-id".to_string(),
session_id.to_string(),
]
];
args.extend(claude_usage_settings_args());
args.extend(["--session-id".to_string(), session_id.to_string()]);
args
}

struct ClaudePtyProbeOptions {
Expand Down Expand Up @@ -1204,6 +1215,17 @@ mod tests {
);
}

#[test]
fn usage_probe_settings_disable_remote_control_startup() {
assert_eq!(
claude_usage_settings_args(),
[
"--settings".to_string(),
r#"{"remoteControlAtStartup":false}"#.to_string(),
]
);
}

#[test]
fn probe_session_jsonl_cleanup_removes_transcript_files() {
let dir = tempfile::tempdir().unwrap();
Expand Down