Skip to content

Shell: drain runaway output slowly, run without a terminal, report wall time - #247

Merged
lydakis merged 1 commit into
mainfrom
claude/project-thread-dcbv64
Oct 28, 2026
Merged

lydakis merged 1 commit into
mainfrom
claude/project-thread-dcbv64

Conversation

@lydakis

@lydakis lydakis commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

A follow-up to #236, from the Codex tool comparison.

What

  • Runaway output drains slowly. Since Shell: keep both ends of output past 1 MiB instead of failing #236, a command that writes past 1 MiB keeps running and the daemon discards the middle. For a writer that never stops, that cost a full core on the daemon's one thread, which every bot shares. Past the bound, each read is now followed by a 1 ms pause. That caps the drain at about 64 MiB/s, and the writer waits on the full pipe instead. Output up to 1 MiB is read exactly as before. Measured in a current-thread runtime: timeout 5 yes cost 4.71 s of daemon CPU in 5 s before, and 0.20 s after. A finite command still finishes. A 200 MB log takes about 3 s longer to drain.
  • No terminal. Commands get TERM=dumb, NO_COLOR=1, and cat as PAGER, GIT_PAGER and GH_PAGER, the same as Codex's exec environment. These are set before the registry's and the bot's own environment, so a caller's value still wins. I left the locale alone: C.UTF-8 doesn't exist on every macOS, and the daemon inherits the person's locale anyway.
  • wall_time_ms on every shell result, so the model can choose its next timeout. Codex reports wall_time_seconds. Serde orders the keys, so the field comes last in the JSON.
  • ripgrep: the sonny Homebrew formula now depends_on "ripgrep", so bots can count on rg. The README says so.

Tests that matched the result exactly now allow the new field: tests/test_approvals.py and bench/lifecycle_provider.py. In tests/test_elision.py, one test is sized to the byte. The extra ~20 bytes per result moved its overflow one round earlier, so it now runs one fewer small round (20x1 instead of 21x1) and still exercises the same case: two large results elided beside the note.

Tests

  • cargo test: all pass. cargo clippy --all-targets and cargo fmt --check: clean.
  • New contract checks: wall_time_ms is an integer, the no-terminal variables are set, and a caller's PAGER overrides the default.
  • Python runtime suites (AGENT_TEST_RUNTIME=1, release build): approvals, cli, elision, wait, active_steering, lifecycle, runtime, lookout, bench, bench_integration, engines, fleet_screen, pi_durable, soak and store_scale all pass. release/test_homebrew_formula.py passes.

No UI change.

…report wall time

- Past 1 MiB a stream pauses 1 ms after each read, so a runaway writer
  waits on the full pipe instead of spending the daemon's one thread
  (timeout 5 yes: daemon CPU 4.71 s -> 0.20 s).
- Commands get TERM=dumb, NO_COLOR=1 and cat for PAGER, GIT_PAGER and
  GH_PAGER, before the caller's environment, which still wins.
- Shell results report wall_time_ms.
- The sonny formula depends on ripgrep.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGFtCdGun1rPhhwTSrG
@lydakis lydakis self-assigned this Oct 28, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T01:23:22.297196Z 9ca67c1 Manual request
🔒 Security Review ✅ Completed 2026-10-28T01:25:44.436087Z 9ca67c1 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

lydakis commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 9ca67c1247

ℹ️ 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".

@lydakis
lydakis merged commit f93d900 into main Oct 28, 2026
1 check passed
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 9ca67c1247

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants