mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[rollout_trace] Add debug trace reduction command (#18880)
## Summary Adds the debug CLI entry point for reducing recorded rollout traces. This gives developers a direct way to inspect whether the emitted trace stream reduces into the expected conversation/runtime model. ## Stack This is PR 5/5 in the rollout trace stack. - [#18876](https://github.com/openai/codex/pull/18876): Add rollout trace crate - [#18877](https://github.com/openai/codex/pull/18877): Record core session rollout traces - [#18878](https://github.com/openai/codex/pull/18878): Trace tool and code-mode boundaries - [#18879](https://github.com/openai/codex/pull/18879): Trace sessions and multi-agent edges - [#18880](https://github.com/openai/codex/pull/18880): Add debug trace reduction command ## Review Notes This PR is intentionally last: it depends on the trace crate, core recorder, runtime/tool events, and session/agent edge data all existing. The command should remain a debug/developer tool and avoid adding new runtime behavior. The useful review question is whether the CLI exposes the reducer in the smallest practical way for local inspection without turning the debug command into a supported user-facing workflow.
This commit is contained in:
@@ -34,13 +34,16 @@ impl CodeModeExecuteHandler {
|
||||
// Allocate before starting V8 so the trace can create the parent
|
||||
// CodeCell before model-authored JavaScript issues nested tool calls.
|
||||
let runtime_cell_id = exec.session.services.code_mode_service.allocate_cell_id();
|
||||
let code_cell_trace = exec.session.services.rollout_trace.start_code_cell_trace(
|
||||
exec.session.conversation_id,
|
||||
exec.turn.sub_id.as_str(),
|
||||
runtime_cell_id.as_str(),
|
||||
call_id.as_str(),
|
||||
args.code.as_str(),
|
||||
);
|
||||
let code_cell_trace = exec
|
||||
.session
|
||||
.services
|
||||
.rollout_thread_trace
|
||||
.start_code_cell_trace(
|
||||
exec.turn.sub_id.as_str(),
|
||||
runtime_cell_id.as_str(),
|
||||
call_id.as_str(),
|
||||
args.code.as_str(),
|
||||
);
|
||||
let started_at = std::time::Instant::now();
|
||||
let response = exec
|
||||
.session
|
||||
|
||||
@@ -85,12 +85,8 @@ impl ToolHandler for CodeModeWaitHandler {
|
||||
};
|
||||
exec.session
|
||||
.services
|
||||
.rollout_trace
|
||||
.code_cell_trace_context(
|
||||
exec.session.conversation_id,
|
||||
exec.turn.sub_id.as_str(),
|
||||
runtime_cell_id,
|
||||
)
|
||||
.rollout_thread_trace
|
||||
.code_cell_trace_context(exec.turn.sub_id.as_str(), runtime_cell_id)
|
||||
.record_ended(response);
|
||||
}
|
||||
handle_runtime_response(&exec, wait_response.into(), args.max_tokens, started_at)
|
||||
|
||||
Reference in New Issue
Block a user