fix(codex): store command output whole in result_summary - #127
Open
joeysbase wants to merge 1 commit into
Open
Conversation
…ew fixes) The Codex agent truncated command output with `output[:100]` when building CommandTelemetry.result_summary, so result_tokens (derived from its length) under-reported every Bash result and skewed the cost model. Store the output whole and add lint rule CE043 to forbid re-introducing output truncation in agents/. Code-review fixes applied on top: - streaming/renderers.py: cap the Rich live-feed ToolEnd preview at _MAX_RESULT_LEN so a now-whole result_summary can't flood the console; the reported char count still shows the true full length (+ regression test). - models/telemetry.py: narrow the result_tokens docstring — the untruncated contract covers captured command stdout/stderr, not the intentionally-brief one-line summaries of non-command tool items (_summarize_tool_item). - experiments/default.yaml: clarify the max_turns:100 comment as a hard safety ceiling above the typical 3-18 range (task_timeout/turn_timeout are the practical guards). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
joeysbase
requested review from
akshaylive,
bai-uipath,
tmatup and
uipreliga
as code owners
August 18, 2026 22:22
|
Claude finished @joeysbase's task in 1m 36s —— View job Code Review in Progress
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
The Codex agent truncated command output with
f"Output: {output[:100]}"when buildingCommandTelemetry.result_summary. Becauseresult_tokensis derived fromresult_summarylength (ceil(len/4)), this pinned ~77% of Bash results near a ~31-token floor and under-reported every Codex tool result, skewing the cost model.This also violated the codebase-wide untruncated-
result_summarycontract (the Claude agent already stores full output;test_resolve_pending_command_does_not_truncate_long_result_summaryasserts a 5000-char summary survives). Codex was the outlier.Change
codex_agent.py: store command output whole inresult_summary(display trimming belongs in renderers/reports, not capture).CE043lint rule (tests/lint/rules/ce043_no_command_output_truncation.py, wired intorunner.py): forbids constant-slice truncation of captured command output (output[:N],.stdout[:N], …) insideagents/, so the contract can't silently regress. Scoped toagents/, with a# noqa: CE043escape hatch.test_command_output_recorded_whole_not_truncated) + full lint-rule unit tests.Code-review fixes applied on top
streaming/renderers.py: cap the Rich live-feedToolEndpreview at_MAX_RESULT_LENso a now-wholeresult_summarycan't flood the console; the reported char count still shows the true full length (+ regression test).models/telemetry.py: narrow theresult_tokensdocstring — the untruncated contract covers captured command stdout/stderr, not the intentionally-brief one-line summaries of non-command tool items (_summarize_tool_item).experiments/default.yaml:max_turnsraised to100(intentional, for larger task runs) with the comment clarified as a hard safety ceiling;task_timeout/turn_timeoutremain the practical guards.Verification
make verifygreen — ruff, pyright (0 errors), custom lint (incl. CE043), 4210 tests, coverage 91.72%.🤖 Generated with Claude Code