-
Notifications
You must be signed in to change notification settings - Fork 2
bug(debug): --dump-format trace creates empty session dirs and overwrites trace.json #1814
Description
Bug
When running with --dump-format trace, two problems occur:
1. Empty session directories accumulate
DebugDumper::new(base_dir, DumpFormat::Trace) always creates a timestamped session subdirectory (e.g. .local/testing/debug/1773575914/), even though in Trace mode all dump methods (dump_request, dump_response, dump_tool_output, dump_tool_error) are no-ops.
// debug_dump/mod.rs DebugDumper::new()
let dir = base_dir.join(ts.to_string()); // always created
std::fs::create_dir_all(&dir)?; // even in Trace modeResult: each trace session leaves behind an empty directory.
2. trace.json is overwritten on every session
TracingCollector::new(base_dir, ...) writes to base_dir/trace.json (not the session subdir). Every new trace session silently overwrites the previous trace.
// debug_dump/trace.rs
let path = self.output_dir.join("trace.json"); // always same filenameReproduction
echo 'hello' | cargo run --features full -- --config .local/config/testing.toml --dump-format trace
# Observe: .local/testing/debug/1773575914/ created (empty)
# Observe: .local/testing/debug/trace.json written at base level
echo 'hello again' | cargo run --features full -- --config .local/config/testing.toml --dump-format trace
# Observe: .local/testing/debug/1773575924/ created (empty)
# Observe: .local/testing/debug/trace.json OVERWRITTEN (prev trace lost)Expected
- In Trace mode, no session subdir should be created (or the trace file should be written inside it)
- Each trace session should produce a unique file (e.g.
trace-{session_id}.jsonor{ts}/trace.json)
Fix Suggestion
Option A: Skip DebugDumper entirely when format=Trace (only create TracingCollector).
Option B: Write trace file into the session subdir: self.output_dir.join(ts).join("trace.json").
Option B is more consistent since it keeps one trace per session dir, same as numbered files for json/raw formats.
Files
crates/zeph-core/src/debug_dump/mod.rs—DebugDumper::new()line 72-73crates/zeph-core/src/debug_dump/trace.rs—TracingCollector::trace_path()line 429src/runner.rs— trace setup lines 1027-1032