Skip to content

bug(debug): --dump-format trace creates empty session dirs and overwrites trace.json #1814

@bug-ops

Description

@bug-ops

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 mode

Result: 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 filename

Reproduction

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}.json or {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.rsDebugDumper::new() line 72-73
  • crates/zeph-core/src/debug_dump/trace.rsTracingCollector::trace_path() line 429
  • src/runner.rs — trace setup lines 1027-1032

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions