chore(engine): rename ENGINE_V2_TRACE to IRONCLAW_RECORD_TRACE#2114
chore(engine): rename ENGINE_V2_TRACE to IRONCLAW_RECORD_TRACE#2114ilblackdragon merged 2 commits intostagingfrom
Conversation
Aligns the trace-recording env var with the project-wide IRONCLAW_* naming convention so it's discoverable alongside other ironclaw flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request renames the ENGINE_V2_TRACE environment variable to IRONCLAW_RECORD_TRACE within the engine's trace executor and updates all relevant documentation. The review feedback suggests using the parse_option_env<bool> helper function to reduce boilerplate and recommends maintaining backward compatibility for the legacy variable name during the transition period.
| std::env::var("IRONCLAW_RECORD_TRACE") | ||
| .map(|v| v == "1" || v == "true") | ||
| .unwrap_or(false) |
There was a problem hiding this comment.
To maintain consistency and minimize boilerplate across the repository, use the specialized parse_option_env<T> helper function for resolving environment variables. This approach should also be used to implement the fallback logic for the legacy ENGINE_V2_TRACE variable to ensure backward compatibility during the transition period.
| std::env::var("IRONCLAW_RECORD_TRACE") | |
| .map(|v| v == "1" || v == "true") | |
| .unwrap_or(false) | |
| parse_option_env::<bool>("IRONCLAW_RECORD_TRACE") | |
| .or_else(|| parse_option_env::<bool>("ENGINE_V2_TRACE")) | |
| .unwrap_or(false) |
References
- Use specialized helper functions like parse_option_env when resolving environment variables into Option fields to minimize boilerplate and maintain consistency across configuration files.
There was a problem hiding this comment.
Pull request overview
Renames the engine trace-recording environment variable from ENGINE_V2_TRACE to IRONCLAW_RECORD_TRACE and updates related documentation to match, aiming to align with IRONCLAW_* naming.
Changes:
- Updated
is_trace_enabled()and module docs incrates/ironclaw_engine/src/executor/trace.rsto readIRONCLAW_RECORD_TRACE. - Replaced
ENGINE_V2_TRACEwithIRONCLAW_RECORD_TRACEacross three documentation files.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| docs/self-improvement.md | Updates the debug command example to use the new env var name. |
| docs/plans/2026-03-20-engine-v2-architecture.md | Updates architectural plan reference to the new env var name. |
| docs/engine-v2-architecture.md | Updates architecture doc reference to the new env var name. |
| crates/ironclaw_engine/src/executor/trace.rs | Changes the env var checked for enabling engine trace recording and updates module docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Check if trace recording is enabled. | ||
| pub fn is_trace_enabled() -> bool { | ||
| std::env::var("ENGINE_V2_TRACE") | ||
| std::env::var("IRONCLAW_RECORD_TRACE") | ||
| .map(|v| v == "1" || v == "true") | ||
| .unwrap_or(false) |
There was a problem hiding this comment.
IRONCLAW_RECORD_TRACE is already used elsewhere (e.g., src/llm/recording.rs) to enable LLM trace capture for E2E replay fixtures. Reusing the same env var here will unexpectedly enable/disable two different trace systems with different output formats/paths. Consider using a more specific env var for engine traces (e.g., IRONCLAW_ENGINE_TRACE / IRONCLAW_ENGINE_RECORD_TRACE), or intentionally unify the formats and output config so a single flag makes sense.
| Set `ENGINE_V2=true` environment variable. The router in `src/bridge/router.rs` intercepts messages and routes them through the engine instead of the v1 agent loop. | ||
|
|
||
| For trace debugging: `ENGINE_V2_TRACE=1` writes full JSON traces to `engine_trace_*.json`. | ||
| For trace debugging: `IRONCLAW_RECORD_TRACE=1` writes full JSON traces to `engine_trace_*.json`. |
There was a problem hiding this comment.
This doc now points users to IRONCLAW_RECORD_TRACE, but that env var is already documented/used to enable LLM trace recording for replay testing. If engine tracing keeps using the same variable, please clarify the dual behavior here; otherwise update this to the engine-specific env var name chosen for engine traces.
| For trace debugging: `IRONCLAW_RECORD_TRACE=1` writes full JSON traces to `engine_trace_*.json`. | |
| For trace debugging, use the existing shared trace flag: `IRONCLAW_RECORD_TRACE=1`. This env var is also used for LLM trace recording/replay testing; when Engine v2 routing is enabled, it additionally writes full engine JSON traces to `engine_trace_*.json`. |
|
|
||
| ### 6.5 Trace recording + retrospective — DONE | ||
| `ENGINE_V2_TRACE=1` writes full JSON traces. Automatic trace analysis detects 8 issue categories. Reflection pipeline produces Summary/Lesson/Issue/Spec/Playbook docs. All run inside ThreadManager after thread completion. | ||
| `IRONCLAW_RECORD_TRACE=1` writes full JSON traces. Automatic trace analysis detects 8 issue categories. Reflection pipeline produces Summary/Lesson/Issue/Spec/Playbook docs. All run inside ThreadManager after thread completion. |
There was a problem hiding this comment.
Same concern as other docs: IRONCLAW_RECORD_TRACE is already used for LLM trace recording. Either clarify that it enables multiple trace outputs, or switch this reference to the engine-specific env var used by the executor trace recorder.
| `IRONCLAW_RECORD_TRACE=1` writes full JSON traces. Automatic trace analysis detects 8 issue categories. Reflection pipeline produces Summary/Lesson/Issue/Spec/Playbook docs. All run inside ThreadManager after thread completion. | |
| `IRONCLAW_RECORD_TRACE=1` enables trace recording across the system, including the full engine/thread JSON traces described here. Automatic trace analysis detects 8 issue categories. Reflection pipeline produces Summary/Lesson/Issue/Spec/Playbook docs. All run inside ThreadManager after thread completion. |
| @@ -207,7 +207,7 @@ The mission is capped at 5 threads per day (`max_threads_per_day: 5`). | |||
| Enable trace logging to see the self-improvement loop in action: | |||
There was a problem hiding this comment.
This command now uses IRONCLAW_RECORD_TRACE, which is also used to enable LLM trace recording. If engine tracing gets a separate env var to avoid the collision, update this example accordingly (or clarify that this enables multiple trace outputs).
| Enable trace logging to see the self-improvement loop in action: | |
| Enable trace logging to see the self-improvement loop in action. Note that | |
| `IRONCLAW_RECORD_TRACE=1` currently enables multiple trace outputs, including | |
| LLM trace recording: |
Address PR review feedback. Instead of having two separate trace systems both named IRONCLAW_RECORD_TRACE (the v1 RecordingLlm in src/llm/recording.rs and the engine v2 executor/trace.rs JSON dumper), collapse them to one. Engine v2's LlmBackend is wired to the host's full LLM provider chain, which already includes RecordingLlm when IRONCLAW_RECORD_TRACE=1. That means engine v2 LLM interactions are already captured by the unified trace_*.json fixture file -- no engine-side env var, no second JSON output, no risk of one flag enabling two divergent recorders. Removed: - is_trace_enabled() and write_trace() from executor/trace.rs - the engine_trace_*.json write site in runtime/manager.rs Kept (still useful, runs unconditionally for the self-improvement mission): - build_trace() / analyze_trace() / log_trace_summary() Docs updated to point to RecordingLlm as the single trace mechanism. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewFound 3 issues:
The PR updates docs to reference https://github.com/anthropics/ironclaw/blob/fdb093fb4270f1f57df7acffdf414c091bee6498/.env.example (check for ENGINE_V2_TRACE references)
The removed
The updated docs mention |
Summary
ENGINE_V2_TRACEtoIRONCLAW_RECORD_TRACEto align with the project-wideIRONCLAW_*naming conventionis_trace_enabled()and the module doc incrates/ironclaw_engine/src/executor/trace.rsdocs/self-improvement.md,docs/engine-v2-architecture.md,docs/plans/2026-03-20-engine-v2-architecture.md)Test plan
cargo check -p ironclaw_enginepasses (verified locally)IRONCLAW_RECORD_TRACE=1 cargo runwritesengine_trace_*.jsonENGINE_V2_TRACE=1no longer enables tracing🤖 Generated with Claude Code