Skip to content

Fix PTY attach output ordering - #476

Draft
chruffins wants to merge 2 commits into
mainfrom
hypeship/fix-pty-attach-replay
Draft

chruffins wants to merge 2 commits into
mainfrom
hypeship/fix-pty-attach-replay

Conversation

@chruffins

@chruffins chruffins commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • drain PTY output independently of WebSocket attachment and retain the latest 64 KiB in a fixed-size ring buffer
  • forward output on a separate goroutine so WebSocket backpressure cannot stop PTY draining; flush pending output before the exit event
  • add regression coverage for replay/exit ordering, ring-buffer reuse, and continued draining while the sink is blocked

Overlap with #463

Checked open PR #463 first. It changes process lifecycle and process.go, but its description explicitly excludes TTY sessions from output capture; it does not cover PTY attach replay or ordering. This PR changes the same file, so a merge conflict with #463 is possible. The PTY changes are otherwise separate from #463's non-TTY output lifecycle work.

Validation

  • cd server && go test -race ./cmd/api/api -run 'TestPTYOutput' -count=10
  • cd server && go test ./cmd/api/api -count=1
  • cd server && go vet ./cmd/api/api

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f83e4da. Configure here.

Comment thread server/cmd/api/api/process.go
@chruffins
chruffins requested review from Sayan- and rgarcia and removed request for rgarcia October 19, 2026 19:03
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