Project
cortex
Description
cortex exec emits JSON output with inconsistent field naming conventions depending on the --output-format value. The json format uses snake_case keys (duration_ms, num_turns, result) while the stream-json format uses camelCase keys (durationMs, numTurns, finalText) for the same semantic data. This breaks automation scripts that switch between output formats or parse both.
Error Message
Debug Logs
System Information
Screenshots
Steps to Reproduce
- Run cortex exec --output-format json "hello" — observe duration_ms, num_turns in JSON output
- Run cortex exec --output-format stream-json "hello" — observe durationMs, numTurns in JSON output
- Compare the field naming conventions between the two outputs
Expected Behavior
Both output formats from the same command should use a consistent field naming convention (either snake_case or camelCase) for the same semantic fields.
Actual Behavior
--output-format json uses snake_case (duration_ms, num_turns, result, is_error) while --output-format stream-json uses camelCase (durationMs, numTurns, finalText, toolCalls). Scripts that parse exec JSON output will break when switching between formats because the field names differ.
Additional Context
At src/cortex-cli/src/exec_cmd/runner.rs lines 528–548, the Json format emits:
{
"type": "result",
"subtype": "success",
"is_error": false,
"result": "...",
"duration_ms": 1234,
"num_turns": 1,
"session_id": "..."
}
At lines 552–562, the StreamJson format emits:
{
"type": "completion",
"finalText": "...",
"numTurns": 1,
"durationMs": 1234,
"session_id": "...",
"timestamp": 1712345678000,
"toolCalls": 0
}
Project
cortex
Description
cortex exec emits JSON output with inconsistent field naming conventions depending on the --output-format value. The json format uses snake_case keys (duration_ms, num_turns, result) while the stream-json format uses camelCase keys (durationMs, numTurns, finalText) for the same semantic data. This breaks automation scripts that switch between output formats or parse both.
Error Message
Debug Logs
System Information
Screenshots
Steps to Reproduce
Expected Behavior
Both output formats from the same command should use a consistent field naming convention (either snake_case or camelCase) for the same semantic fields.
Actual Behavior
--output-format json uses snake_case (duration_ms, num_turns, result, is_error) while --output-format stream-json uses camelCase (durationMs, numTurns, finalText, toolCalls). Scripts that parse exec JSON output will break when switching between formats because the field names differ.
Additional Context
At src/cortex-cli/src/exec_cmd/runner.rs lines 528–548, the Json format emits:
{
"type": "result",
"subtype": "success",
"is_error": false,
"result": "...",
"duration_ms": 1234,
"num_turns": 1,
"session_id": "..."
}
At lines 552–562, the StreamJson format emits:
{
"type": "completion",
"finalText": "...",
"numTurns": 1,
"durationMs": 1234,
"session_id": "...",
"timestamp": 1712345678000,
"toolCalls": 0
}