fix(openai): bound native shell output#507
Merged
Merged
Conversation
jdchawla29
marked this pull request as ready for review
July 23, 2026 10:27
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 109b6ca105
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
jdchawla29
force-pushed
the
jaideep/hud-2204-openai-shell-max-output-length
branch
from
July 24, 2026 06:18
109b6ca to
13822ec
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 13822ec. Configure here.
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.

Summary
max_output_lengthfor each commandRoot cause
The native OpenAI shell adapter returned
max_output_lengthas metadata but copied the complete command result into display content and structured stdout/stderr. No execution-boundary truncation occurred, so noisy output could exceed the Responses API field limit and terminate the rollout before grading.Validation
uv run --no-sync pytest -q hud/agents/openai/tools/tests hud/agents/tests/test_provider_native_tools.py hud/agents/tests/test_openai_agent.py hud/agents/tests/test_tool_agent.py(69 passed)Linear: HUD-2204
Note
Medium Risk
Changes agent tool execution and result shaping on a critical path; behavior is well-tested but affects all native OpenAI shell calls.
Overview
OpenAI native shell now honors
max_output_lengthinstead of echoing full command output while only storing the limit as metadata—fixing rollouts that blew past Responses API text limits on noisy commands.Execution parses and validates
max_output_length(integer ≥ minimum, capped at 10 MiB); bad values return an error without running commands. Each command runs viaconn.runwith separate stdout/stderr, then_bound_outputtrims combined length per command using a truncation marker while keeping head/tail. Structuredoutputand MCP text content both use the same bounded streams (one text block per command).Tests cover huge stderr truncation, per-command limits, invalid limits, and default/ceiling effective limits; the fake SSH client now supports stderr.
Reviewed by Cursor Bugbot for commit 109b6ca. Bugbot is set up for automated code reviews on this repo. Configure here.