Skip to content

app-server: Add back pressure and batching to command/exec#15547

Merged
owenlin0 merged 7 commits intomainfrom
ruslan/codex-app-server-backpressure
Mar 24, 2026
Merged

app-server: Add back pressure and batching to command/exec#15547
owenlin0 merged 7 commits intomainfrom
ruslan/codex-app-server-backpressure

Conversation

@euroelessar
Copy link
Copy Markdown
Collaborator

@euroelessar euroelessar commented Mar 23, 2026

  • Add OutgoingMessageSender::send_server_notification_to_connection_and_wait which returns only once message is written to websocket (or failed to do so)
  • Use this mechanism to apply back pressure to stdout/stderr streams of processes spawned by command/exec, to limit them to at most one message in-memory at a time
  • Use back pressure signal to also batch smaller chunks into ≈64KiB ones

This should make commands execution more robust over high-latency/low-throughput networks

@euroelessar euroelessar requested a review from owenlin0 March 23, 2026 19:40
connection_id: ConnectionId,
notification: ServerNotification,
) {
tracing::trace!("app-server event: {notification}");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: if this was just for temporary debugging, can we remove? IIRC we've had issues with noisy trace logs in the past

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it's replicated from existing send_server_notification_to_connections, should I remove it from both?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

was added by #12695

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ah ok, fine to keep then. seems deliberate

@owenlin0 owenlin0 merged commit d61c03c into main Mar 24, 2026
35 checks passed
@owenlin0 owenlin0 deleted the ruslan/codex-app-server-backpressure branch March 24, 2026 18:35
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants