Skip to content

reduce shell poll tax - #1166

Open
bearsyankees wants to merge 5 commits into
mainfrom
devin/reduce-shell-poll-tax
Open

reduce shell poll tax#1166
bearsyankees wants to merge 5 commits into
mainfrom
devin/reduce-shell-poll-tax

Conversation

@bearsyankees

Copy link
Copy Markdown
Collaborator

No description provided.

…unded shells

The SDK yields after only 250ms on a `write_stdin` poll and 10s on `exec_command`, so agents burn many turns re-polling a backgrounded process for almost no output. Each poll costs a full LLM turn, which makes even trivial commands take minutes of wall time.

Raise the defaults in the existing `exec_command` / `write_stdin` wrappers:

- an empty-`chars` `write_stdin` (a poll, not input) yields 20s instead of 250ms, so one poll returns a meaningful result
- `exec_command` yields 30s by default, and 120s for known long-running security binaries matched on the leading binary of the command
- a bare `sleep N` hand-wait is clamped to 60s and annotated with a hint pointing at `write_stdin(chars="")`, which returns as soon as there is output or the process exits

Every override is skipped when the model passes `yield_time_ms` explicitly, and the new values are configurable through `STRIX_SHELL_*` env vars. Command parsing fails open: an unparsable command just gets the plain default, and a `sleep` inside a compound command is never rewritten.
Assert exec_command/write_stdin wrappers render ValidationError and invalid-workdir errors as messages instead of raising.
@bearsyankees bearsyankees changed the title Devin/reduce shell poll tax reduce shell poll tax Aug 25, 2026
@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reduces unnecessary shell polling by applying longer bounded yield defaults, steering agents away from blind sleeps, and validating configured yields against the PTY ceiling.

  • Normalizes omitted exec_command and empty write_stdin poll yields.
  • Caps pure sleep commands and returns guidance for polling background jobs.
  • Adds shell settings whose configured yields cannot exceed the PTY limit.
  • Updates the agent prompt and adds focused wrapper and configuration tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
strix/agents/factory.py Adds centralized shell-argument normalization, bounded default yields, pure-sleep handling, and polling guidance without leaving a blocking defect.
strix/agents/prompts/system_prompt.jinja Updates shell-efficiency guidance to favor explicit bounded yields and event-driven polling.
strix/config/settings.py Adds validated shell defaults and resolves the previously reported silent PTY-capping behavior.
tests/test_agent_factory_shell.py Covers default and explicit yields, sleep handling, write-stdin polling, error formatting, and ceiling validation.

Reviews (3): Last reviewed commit: "fix(shell): validate shell yields agains..." | Re-trigger Greptile

Comment thread strix/config/settings.py Outdated
…inary list

Drop the hardcoded long-running-binary set and its exec_long_yield_ms default. The wrapper no longer guesses how long a command runs from its leading binary: every omitted yield_time_ms gets the same 30s default, and the prompt asks the agent to pass a longer yield itself when it expects a slow command.
The SDK clamps every PTY yield to 30s and floors an empty poll at 5s. Record that where the defaults are set, and tell the agent a slower command still backgrounds so it harvests it with one poll per 30s instead of asking for an unreachable yield.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

@greptile

Comment thread strix/config/settings.py Outdated
The PTY layer clamps any yield above its maximum, so a larger configured value bought nothing and looked effective. Bound both yield settings by that constant instead, and take the exec default from it.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

@greptile

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.

1 participant