Skip to content

test(python): synchronize interactive exec TTY readiness - #4076

Merged
matthewgrossman merged 2 commits into
mainfrom
codex/4075-python-interactive-tty/matthewgrossman
Oct 1, 2026
Merged

matthewgrossman merged 2 commits into
mainfrom
codex/4075-python-interactive-tty/matthewgrossman

Conversation

@matthewgrossman

@matthewgrossman matthewgrossman commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Prevent a false failure in test_sandbox_interactive_exec_honors_tty when PTY stdin echo lands between the shell's separate TTY flag writes. Wait for a complete output readiness marker before submitting stdin, so a successful terminal execution cannot turn TTT into TTstreamed-stdin-sentinel\r\nT.

CI Evidence

Observed in PR #4066's Branch E2E Checks on October 1, 2026, at SHA 6c4bb7614af2d86783e8a887b8915ef1520e94df:

  • Failed Docker Python E2E job, attempt 2: test_sandbox_interactive_exec_honors_tty failed because stdout contained TTstreamed-stdin-sentinel\r\nT instead of contiguous TTT. All three TTY flags, consumed stdin, both output sentinels, and exit code zero were present. Suite result: 1 failed, 59 passed, 81 skipped.
  • Passed Docker Python E2E job, attempt 1: the same test passed at the same SHA. Suite result: 60 passed, 81 skipped.

This was a pre-existing test race exposed on the PR branch; PR #4066 does not modify this test or the interactive runtime.

Changes

  • Accumulate output across gRPC events, recognize the complete readiness marker with CRLF normalization, and gate stdin with a bounded event wait. Unblock the request iterator on early exit or RPC failure.
  • Require exact TTY flag lines, verify consumed stdin and both output sentinels in TTY mode, and preserve non-TTY stdout/stderr separation checks.

Testing

  • Ruff lint, focused formatting, test collection, and git diff --check pass.
  • Configured mise run pre-commit hook passes, including repository lint, formatting, license, protobuf, Helm, and SDK checks.
  • E2E assertions and input synchronization updated.
  • Applied test passes 160 trials through a local service using real PTYs/pipes and Python bidirectional gRPC: 100 ordinary, 30 forced-interleaving, and 30 with one-byte output events. The original test fails 10/10 trials under the same forced ordering with the exact CI transcript.
  • The applied test rejects lost TTY support, merged non-TTY streams, lost consumed stdin in either mode, missing TTY output sentinels, early exit, RPC errors, and missing readiness. The actual readiness timeout was exercised; no input-consumption threads remained blocked.
  • Full Docker-backed OpenShell Python E2E lane. The local Docker daemon is unavailable; the local harness does not run the Rust gateway, SSH relay, or Linux isolation backend. Draft pending CI validation.

The change is limited to this E2E test; the adjacent request-EOF/output-draining test remains intact.

Checklist

  • Follows Conventional Commits.
  • Commit is signed off for DCO.
  • Architecture docs: not applicable to this test-only change.

Wait for the complete readiness marker before streaming stdin so PTY echo cannot split the separately written TTY flags. Preserve pipe stream separation and verify consumed stdin and both output sentinels in TTY mode.

Fixes #4075

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman marked this pull request as ready for review October 1, 2026 21:33
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