mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
Apply backpressure to app-server request replay on thread resume (#62609)
## Why When a client resumes a thread with many pending server requests, replay can fill the connection's bounded outbound queue if the client reads slowly. Replaying inline can also stall the thread listener. ## What changed Replay pending requests in a background task after sending the `thread/resume` response. Allow one outstanding replay write per connection and wait for its write receipt to complete or be dropped before sending the next request. This extends the write-receipt backpressure used by `command/exec`. https://github.com/openai/codex/pull/15547 A new resume replaces the previous replay for the same thread and connection while honoring any outstanding write receipt. Unsubscribing or disconnecting stops the replay. Before sending each request, check that it is still pending and apply the human approval eligibility check where required. ## Testing Add a regression test with more pending requests than the outbound queue can hold. It checks that a second resume succeeds while a replay write is stalled, dropped write receipts let replay advance, and unsubscribe and disconnect stop replay. GitOrigin-RevId: 77fc415be0e7b50744f5ccfcaa09857359dd5c55
This commit is contained in:
@@ -881,6 +881,7 @@ impl MessageProcessor {
|
||||
connection_id: ConnectionId,
|
||||
request_attestation: bool,
|
||||
) {
|
||||
self.outgoing.connection_initialized(connection_id).await;
|
||||
self.account_processor
|
||||
.notify_workspace_routing_to_connection(connection_id);
|
||||
self.thread_processor
|
||||
@@ -943,6 +944,7 @@ impl MessageProcessor {
|
||||
session_state: &ConnectionSessionState,
|
||||
) {
|
||||
session_state.disconnect.cancel();
|
||||
self.outgoing.stop_connection_replays(connection_id).await;
|
||||
session_state.rpc_gate.close().await;
|
||||
self.account_processor
|
||||
.gateway_connection_closed(connection_id);
|
||||
|
||||
Reference in New Issue
Block a user