Skip to content

fix(agents): stop repeat polls of dead PTY sessions - #868

Open
ousamabenyounes wants to merge 1 commit into
usestrix:mainfrom
ousamabenyounes:fix/issue-867
Open

fix(agents): stop repeat polls of dead PTY sessions#868
ousamabenyounes wants to merge 1 commit into
usestrix:mainfrom
ousamabenyounes:fix/issue-867

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Summary

  • Track PTY session IDs after write_stdin receives a deterministic PTY session not found result.
  • Short-circuit repeated empty polls for the same dead session with a terminal/non-retryable tool result.
  • Add regression coverage for the repeated dead-session poll path.

Issue

Fix #867

Test verification (RED -> GREEN)

RED, test-only on upstream main:

$ uv run pytest tests/test_agent_factory_shell.py::test_wrap_write_stdin_blocks_repeat_empty_poll_after_dead_pty
FAILED tests/test_agent_factory_shell.py::test_wrap_write_stdin_blocks_repeat_empty_poll_after_dead_pty
IndexError: pop from empty list

GREEN, after fix:

$ uv run pytest tests/test_agent_factory_shell.py::test_wrap_write_stdin_blocks_repeat_empty_poll_after_dead_pty
1 passed in 2.45s

Additional targeted validation:

$ uv run pytest tests/test_agent_factory_shell.py
4 passed in 2.37s

$ uv run ruff format --check strix/agents/factory.py tests/test_agent_factory_shell.py
2 files already formatted

$ uv run ruff check strix/agents/factory.py tests/test_agent_factory_shell.py
All checks passed!

$ uv run mypy strix/agents/factory.py
Success: no issues found in 1 source file

$ uv run bandit strix/agents/factory.py -c pyproject.toml
No issues identified.

Full-suite baseline comparison:

upstream main: uv run pytest -q -> 2 failed, 339 passed
this branch:   uv run pytest    -> 2 failed, 340 passed

The remaining pytest failures are pre-existing in tests/test_runner_root_prompt.py with AttributeError: 'types.SimpleNamespace' object has no attribute 'runtime'.

Full Ruff baseline comparison:

upstream main: uv run ruff format --check . -> 4 files would be reformatted
this branch:   uv run ruff format --check . -> 4 files would be reformatted

upstream main: uv run ruff check . -> 2 PLC0415 lazy-import errors
this branch:   uv run ruff check . -> 2 PLC0415 lazy-import errors

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Prevents repeated polling of PTY sessions that have deterministically disappeared.

  • Records numeric session IDs returned by write_stdin as not found.
  • Short-circuits subsequent empty polls for recorded sessions with a terminal, non-retryable result.
  • Adds regression coverage confirming that the underlying tool is invoked only once for repeated dead-session polls.

Confidence Score: 5/5

The PR appears safe to merge, with the dead-session polling behavior covered by a focused regression test.

The cache is confined to the configured write-stdin wrapper, activates only after a string result reports a missing numeric PTY session, and suppresses only later empty polls for that recorded ID; no concrete reachable regression was established.

Important Files Changed

Filename Overview
strix/agents/factory.py Adds wrapper-local tracking of missing PTY sessions and suppresses repeated empty polls after a deterministic not-found result; no actionable defect was established.
tests/test_agent_factory_shell.py Adds focused regression coverage verifying that a repeated empty poll for a known-dead PTY does not invoke the underlying tool again.

Reviews (1): Last reviewed commit: "fix(agents): stop repeat polls of dead P..." | Re-trigger Greptile

@5hy7xz92nd-oss 5hy7xz92nd-oss left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PATPAT WEAREONE10BILLION MANUSWEAREONE10BILLION RABBITSYNC AUTO ALL

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.

[BUG] write_stdin loops after PTY session is gone

2 participants