Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

keep session ids and fixture keys out of log and panic messages (CodeQL rust/cleartext-logging) (#3370)

Sebastian Müllerc6926c574788
diff --git a/.changes/codeql-cleartext-logging.md b/.changes/codeql-cleartext-logging.md
new file mode 100644
index 0000000000..abd6dab3d6
--- /dev/null
+++ b/.changes/codeql-cleartext-logging.md
@@ -0,0 +1 @@
+- Internal: daemon log, panic, and test assertion messages no longer print session ids or fixture API keys (CodeQL `rust/cleartext-logging` cleanup).
diff --git a/crates/pa-cli/tests/interactive_daemon_e2e.rs b/crates/pa-cli/tests/interactive_daemon_e2e.rs
index 147191d547..bd55096d7d 100644
--- a/crates/pa-cli/tests/interactive_daemon_e2e.rs
+++ b/crates/pa-cli/tests/interactive_daemon_e2e.rs
@@ -4895,8 +4895,7 @@ async fn tui_bare_launch_opens_a_fresh_session_when_a_newer_saved_one_exists_for
);
assert!(
!poisoned_id.starts_with(&outcome.session_id),
- "the fresh session has its own id: {} vs {poisoned_id}",
- outcome.session_id
+ "the fresh session has its own id"
);
// The saved file is byte-identical: no reopen, no append, no resume.
let after = std::fs::read_to_string(&poisoned_path).expect("read poisoned session back");
diff --git a/crates/pa-core/src/session/manager/lifecycle.rs b/crates/pa-core/src/session/manager/lifecycle.rs
index 24a91cdf85..0d4a404900 100644
--- a/crates/pa-core/src/session/manager/lifecycle.rs
+++ b/crates/pa-core/src/session/manager/lifecycle.rs
@@ -360,11 +360,11 @@ impl SessionManager {
let mut session_id = options.id.clone().unwrap_or_else(create_session_id);
let mut session_file: Option<PathBuf> = None;
if self.persist {
- if options.id.is_some() {
- let candidate = get_session_file_path(&self.session_dir, &session_id);
+ if let Some(id) = &options.id {
+ let candidate = get_session_file_path(&self.session_dir, id);
assert!(
!candidate.exists(),
- "Session file already exists for id \"{session_id}\": {}",
+ "Session file already exists for id \"{id}\": {}",
candidate.display()
);
session_file = Some(candidate);
diff --git a/crates/pa-core/tests/kernel_snapshot_resume.rs b/crates/pa-core/tests/kernel_snapshot_resume.rs
index a8f27be636..d32392ddd3 100644
--- a/crates/pa-core/tests/kernel_snapshot_resume.rs
+++ b/crates/pa-core/tests/kernel_snapshot_resume.rs
@@ -274,7 +274,7 @@ async fn session_end_then_resume_prewarms_and_revives_the_namespace() {
let snapshot = artifact_dir.join("kernel-state.dill");
assert!(
snapshot.exists(),
- "snapshot {snapshot:?} must exist after dispose"
+ "kernel-state.dill must exist in the session artifact dir after dispose"
);
drop(engine);
diff --git a/crates/pa-daemon/src/agent_engine/tests/compaction.rs b/crates/pa-daemon/src/agent_engine/tests/compaction.rs
index 1d9c54f05d..650bf4bdbb 100644
--- a/crates/pa-daemon/src/agent_engine/tests/compaction.rs
+++ b/crates/pa-daemon/src/agent_engine/tests/compaction.rs
@@ -296,7 +296,7 @@ fn threshold_compaction_stays_on_the_session_provider_after_a_resolution_drift()
assert_eq!(keys.len() as u64, registration.call_count());
assert!(
keys.iter().all(|key| key.as_deref() == Some("sk-faux")),
- "every call followed the live target's key: {keys:?}"
+ "every call followed the live target's key"
);
assert!(matches!(
crossing_events.last(),
diff --git a/crates/pa-daemon/src/rlm_children/host.rs b/crates/pa-daemon/src/rlm_children/host.rs
index 63a238a067..8d47603d81 100644
--- a/crates/pa-daemon/src/rlm_children/host.rs
+++ b/crates/pa-daemon/src/rlm_children/host.rs
@@ -161,6 +161,7 @@ impl RlmSubagentHost for SupervisorChildSessions {
let prompt = request.prompt.clone();
let child_active_session_id = created.active_session_id.clone();
let child_session_file = created.session_file.clone();
+ let child_log_id = child_id.clone();
// Capture the current turn boundary before detaching: spawn
// admission happens mid-turn, so the parent's continuation
// request reaches the provider first (see `wait_turn_done`).
@@ -193,7 +194,7 @@ impl RlmSubagentHost for SupervisorChildSessions {
};
if let Err(retry_error) = retried {
eprintln!(
- "pa-daemon: RLM child task prompt failed for {child_active_session_id}: {error:#}; retry failed: {retry_error:#}"
+ "pa-daemon: RLM child task prompt failed for {child_log_id}: {error:#}; retry failed: {retry_error:#}"
);
let _ = watcher_this
.kill_child(&child_active_session_id, ChildCloseReason::Killed)
diff --git a/crates/pa-daemon/tests/agent_family_e2e.rs b/crates/pa-daemon/tests/agent_family_e2e.rs
index d7df19ca5f..c67f4bc752 100644
--- a/crates/pa-daemon/tests/agent_family_e2e.rs
+++ b/crates/pa-daemon/tests/agent_family_e2e.rs
@@ -74,7 +74,7 @@ fn parent_worker_token(agent_dir: &Path, active_session_id: &str) -> String {
return token.to_string();
}
}
- panic!("parent worker descriptor not found for {active_session_id}");
+ panic!("parent worker descriptor not found");
}
fn spawn_supervisor(socket: &Path, agent_dir: &Path, kernel_python: &Path) -> Daemon {
diff --git a/crates/pa-daemon/tests/command_breadth.rs b/crates/pa-daemon/tests/command_breadth.rs
index d107592454..9befd7a1c5 100644
--- a/crates/pa-daemon/tests/command_breadth.rs
+++ b/crates/pa-daemon/tests/command_breadth.rs
@@ -575,7 +575,7 @@ fn every_command_type_parses_and_routes() {
assert_eq!(
selector.is_some(),
wire_has_selector,
- "{type_name}: session selector mismatch (got {selector:?})"
+ "{type_name}: session selector mismatch"
);
assert_eq!(selector, wire_has_selector.then_some("sess"));
}
diff --git a/crates/pa-daemon/tests/stale_lease_release_e2e.rs b/crates/pa-daemon/tests/stale_lease_release_e2e.rs
index f9e36fc1a3..af5a501487 100644
--- a/crates/pa-daemon/tests/stale_lease_release_e2e.rs
+++ b/crates/pa-daemon/tests/stale_lease_release_e2e.rs
@@ -115,12 +115,13 @@ fn log_contains(socket: &Path, agent_dir: &Path, needle: &str) -> bool {
std::fs::read_to_string(daemon_log(socket, agent_dir)).is_ok_and(|log| log.contains(needle))
}
+#[track_caller]
fn await_log_line(socket: &Path, agent_dir: &Path, needle: &str, budget: Duration) {
let deadline = Instant::now() + budget;
while !log_contains(socket, agent_dir, needle) {
assert!(
Instant::now() < deadline,
- "the daemon log never said \"{needle}\""
+ "the daemon log never said the awaited line"
);
std::thread::sleep(Duration::from_millis(50));
}
diff --git a/crates/pa-daemon/tests/supervisor_restart_e2e/main.rs b/crates/pa-daemon/tests/supervisor_restart_e2e/main.rs
index cf62d8c42d..2d8d4ff13d 100644
--- a/crates/pa-daemon/tests/supervisor_restart_e2e/main.rs
+++ b/crates/pa-daemon/tests/supervisor_restart_e2e/main.rs
@@ -345,8 +345,7 @@ fn wait_for_busy_journal_evidence(agent_dir: &Path, socket: &Path, session_id: &
}
assert!(
Instant::now() < deadline,
- "busy journal evidence never landed for {session_id}: {}",
- journal_path.display()
+ "busy journal evidence never landed"
);
std::thread::sleep(Duration::from_millis(50));
}