Skip to content

[orchard] Preserve exec output before closing WebSockets - #471

Closed
yzhuang-oai wants to merge 1 commit into
mainfrom
dev/yzhuang/orchard-exec-close-handshake
Closed

[orchard] Preserve exec output before closing WebSockets#471
yzhuang-oai wants to merge 1 commit into
mainfrom
dev/yzhuang/orchard-exec-close-handshake

Conversation

@yzhuang-oai

@yzhuang-oai yzhuang-oai commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserve exec output and exit frames even when late stdin or resize fails as the worker exits. Keep reconnectable-session controls active after worker-input errors, distinguish them from client disconnects, and use an ordered WebSocket ping/pong before normal closure; an independent 30-second timeout only bounds unresponsive peers.

Verification

  • Production-faithful Linux/TLS/uvloop reproduction: 4 MiB: 30/30; 8 MiB: 20/20, including late input.
  • Real-TLS regressions cover worker-first, exit-first, and simultaneous events; slow clients; late input; reconnectable close, detach, replay ACK, and history; normal close frames; and real disconnects.
  • Controller tests, five repeated race checks, go vet, new-issues lint, and synthetic integration tests covering 32 concurrent sessions, SSH reconnects, keepalives, and rejected sessions.

@yzhuang-oai
yzhuang-oai marked this pull request as ready for review August 25, 2026 23:21
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-26T03:43:16.406655Z fcf015c New commits
🔒 Security Review Completed 2026-08-26T03:43:31.076379Z fcf015c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6010af34b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controller/api_vms_exec.go Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

closeTimer := time.NewTimer(controller.pingInterval)

P1 Badge Keep the exec drain grace independent of PING cadence

When the controller is started with the supported --experimental-ping-interval=5s setting (accepted in internal/command/controller/run.go:217-222), this timer gives clients only five seconds to drain. That flag is documented as controlling WebSocket PING cadence, but TestExecWebSocketWaitsForSlowClientBeforeClosing specifically delays reads for 5.25 seconds, so the same client loses its buffered output under this valid configuration. Use a dedicated shutdown grace rather than pingInterval.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yzhuang-oai
yzhuang-oai force-pushed the dev/yzhuang/orchard-exec-close-handshake branch 2 times, most recently from 2847231 to 5fc933f Compare August 26, 2026 00:17
@yzhuang-oai yzhuang-oai changed the title [orchard] Wait for exec clients before closing WebSockets [orchard] Preserve exec output before closing WebSockets Aug 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5fc933f477

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controller/api_vms_exec.go
@yzhuang-oai
yzhuang-oai force-pushed the dev/yzhuang/orchard-exec-close-handshake branch 2 times, most recently from 1a0d350 to 76d1378 Compare August 26, 2026 01:30

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76d1378255

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/controller/api_vms_exec.go Outdated
@yzhuang-oai
yzhuang-oai force-pushed the dev/yzhuang/orchard-exec-close-handshake branch 2 times, most recently from 4a469e1 to f9bc52e Compare August 26, 2026 03:39
@yzhuang-oai
yzhuang-oai force-pushed the dev/yzhuang/orchard-exec-close-handshake branch from f9bc52e to fcf015c Compare August 26, 2026 03:41
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