Skip to content

Commit 654f384

Browse files
wpfleger96Duncan
andauthored
fix(desktop): read the newest pair-scoped harness log (#3134)
Harnesses became per (agent, relay) pair in #2122 and now write `agents/logs/{pubkey}__{sha256(relay_url)}.log` via `managed_agent_runtime_log_path`. `get_managed_agent_log` was never updated and still read the legacy `agents/logs/{pubkey}.log`, so agent profile → Runtime → Harness Log froze at each agent's last single-runtime line while live output accumulated in files the reader never opened. The reader now resolves the log through `latest_managed_agent_log_path`, which picks the most recently modified file belonging to the agent — pair-scoped `{pubkey}__*.log` or legacy `{pubkey}.log` — and falls back to the legacy path when the agent has no log on disk at all. Agents that have not restarted since the update keep working, and the panel follows whichever harness is currently writing. The response already carried `log_path`, so the panel header names the file being shown. Selection is deterministic: equal mtimes break toward the higher filename, and files belonging to other agents or without a `.log` extension are never candidates. `storage.rs`'s inline test module moves to a `#[path]`-included sibling `storage_tests.rs`, matching the existing pattern in `teams.rs` and `archive/mod.rs`. This drops both halves under the desktop file-size limit (1383 → 826 / 701), so the ratchet entries tighten instead of growing. Signed-off-by: Will Pfleger <[email protected]> Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
1 parent 00ecf2c commit 654f384

4 files changed

Lines changed: 744 additions & 597 deletions

File tree

‎desktop/scripts/check-file-sizes.mjs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ const overrides = new Map([
127127
// receipts (write_agent_runtime_receipt atomic JSON + remove/read_all
128128
// helpers) replace the pubkey-keyed PID file, plus the hashed pair-scoped
129129
// runtime log path. Load-bearing crash-recovery surface; queued to split.
130-
["src-tauri/src/managed_agents/storage.rs", 1383],
130+
// harness-log reader fix: the inline test module moved to storage_tests.rs
131+
// (`#[path]`-included), ratcheting 1383 -> 826. Both halves are now under the
132+
// 1000 default; entries kept as ratchets.
133+
["src-tauri/src/managed_agents/storage.rs", 826],
134+
["src-tauri/src/managed_agents/storage_tests.rs", 701],
131135
// config-bridge setup-payload env-boundary fix adds readiness wiring in
132136
// spawn_agent_child; load-bearing security fix, queued to split.
133137
["src-tauri/src/managed_agents/config_bridge/reader.rs", 1016],

‎desktop/src-tauri/src/commands/agent_logs.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use tauri::{AppHandle, Manager};
33
use crate::{
44
app_state::AppState,
55
managed_agents::{
6-
load_managed_agents, managed_agent_log_path, read_log_tail, BackendKind,
6+
latest_managed_agent_log_path, load_managed_agents, read_log_tail, BackendKind,
77
ManagedAgentLogResponse,
88
},
99
};
@@ -29,7 +29,7 @@ pub async fn get_managed_agent_log(
2929
return Err("logs are not available for remote agents".to_string());
3030
}
3131

32-
let log_path = managed_agent_log_path(&app, &pubkey)?;
32+
let log_path = latest_managed_agent_log_path(&app, &pubkey)?;
3333
Ok(ManagedAgentLogResponse {
3434
content: read_log_tail(&log_path, line_count.unwrap_or(120) as usize)?,
3535
log_path: log_path.display().to_string(),

0 commit comments

Comments
 (0)