Skip to content

fix: fix race in reconnecting-pty/screen #19248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

sreya
Copy link
Collaborator

@sreya sreya commented Aug 8, 2025

Context: Screen backend used a readiness probe (screen -X version) tied to a cancel coming from the output reader, so an initial short-lived attach (e.g., for connection reporting) could cancel the wait and leave no master session. Subsequent attaches then failed with "Cannot find master process to attach to!" and tests would fail attempting to find the prompt.

Change: decouple the readiness probe from the output reader cancellation; use the attach context directly so the session must reach ready or fail. This prevents the flake where the first quick connect/disconnect prevents actual session creation.

Tested: ran agent package tests locally; Screen subtest is skipped here without screen, but the change is isolated to screen backend.

Co-authored-by: sreya 4856196+sreya@users.noreply.github.com

…onnection to avoid race on first attach

When the first attach is opened only for connection reporting and closed
immediately, the screen readiness wait (screen -X version) inherited the
connection context and was canceled, but Attach treated context.Canceled
as success. That left no master session, and subsequent attaches failed
with ‘Cannot find master process to attach to!’.

Use the attach context directly for readiness (do not cancel it on
output reader exit), so the session must reach the ready state or fail.

Co-authored-by: sreya <4856196+sreya@users.noreply.github.com>
@sreya sreya changed the title agent/reconnecting-pty/screen: fix readiness race on first attach fix: fix race in reconnecting-pty/screen Aug 8, 2025
@sreya sreya closed this Aug 8, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant