Skip to content

[app-server] type client response payloads#20050

Merged
rhan-oai merged 1 commit intomainfrom
rhan/client-response-payload-plumbing
Apr 29, 2026
Merged

[app-server] type client response payloads#20050
rhan-oai merged 1 commit intomainfrom
rhan/client-response-payload-plumbing

Conversation

@rhan-oai
Copy link
Copy Markdown
Collaborator

Why

pr17088 adds typed server-originated request/response plumbing, but successful client responses are still erased into bare JSON-RPC result values before app-server can make any typed decision about them.

This precursor PR keeps successful client responses typed until the outgoing response seam. It is intentionally limited to protocol/app-server plumbing so the analytics behavior change can review separately on top.

What changed

  • Add ClientResponsePayload as the pre-serialization client response body type.
  • Route app-server successful response paths through the typed payload seam while preserving existing handler-local analytics behavior.
  • Keep InterruptConversation JSON-RPC-only because it has no ClientResponse variant.
  • Move the new payload conversion tests into a dedicated protocol test module.

Verification

  • cargo check -p codex-app-server
  • cargo test -p codex-app-server-protocol

@rhan-oai rhan-oai requested a review from owenlin0 April 28, 2026 21:06
@rhan-oai rhan-oai force-pushed the pr17088 branch 2 times, most recently from 7fafa13 to 9bca771 Compare April 28, 2026 21:57
self.outgoing.send_result(request_id, result).await;
self.outgoing
.send_result(request_id, result, ClientResponsePayload::LoginAccount)
.await;
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.

Is there a way to avoid updating every callsite that sends an RPC response with the payload type? This seems boilerplatey, especially since the result is typed already.

Codex suggests:

Yes. The cleanest reduction is to make the protocol macro generate From for ClientResponsePayload for response types that are unambiguous, then change send_result/send_response to accept Into.

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.

There's one annoying gotcha, which is that we have at least one reused response type:

ConfigValueWrite => response: v2::ConfigWriteResponse
ConfigBatchWrite => response: v2::ConfigWriteResponse

but maybe there's a fix/workaround for this one?

@rhan-oai rhan-oai force-pushed the rhan/client-response-payload-plumbing branch 3 times, most recently from 0022641 to a1caa34 Compare April 28, 2026 23:29
@rhan-oai rhan-oai marked this pull request as ready for review April 28, 2026 23:43
@rhan-oai rhan-oai requested a review from owenlin0 April 28, 2026 23:44
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: a1caa34dbe

ℹ️ 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 on lines +728 to +732
self.analytics_events_client.track_request(
connection_id.0,
connection_request_id.request_id.clone(),
codex_request.clone(),
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Restrict request analytics to turn requests

Avoid tracking every initialized request here. track_request now clones and enqueues all ClientRequests, but the analytics reducer only processes TurnStart/TurnSteer and discards the rest. High-volume or large-payload methods (for example command/exec/write or fs/writeFile with data_base64) can saturate the 256-item analytics queue, causing dropped telemetry and skewed experiment data.

Useful? React with 👍 / 👎.

@rhan-oai rhan-oai force-pushed the pr17088 branch 3 times, most recently from 9bca771 to 87158fb Compare April 29, 2026 01:30
@rhan-oai rhan-oai requested a review from a team as a code owner April 29, 2026 01:30
@rhan-oai rhan-oai force-pushed the rhan/client-response-payload-plumbing branch from a1caa34 to 6a5df25 Compare April 29, 2026 04:25
@rhan-oai rhan-oai force-pushed the pr17088 branch 2 times, most recently from b771b23 to 9195578 Compare April 29, 2026 04:50
@rhan-oai rhan-oai force-pushed the rhan/client-response-payload-plumbing branch 2 times, most recently from 7223fa2 to e593ec4 Compare April 29, 2026 05:03
@rhan-oai rhan-oai force-pushed the rhan/client-response-payload-plumbing branch from e593ec4 to 1c6108c Compare April 29, 2026 19:15
Base automatically changed from pr17088 to main April 29, 2026 19:56
@rhan-oai rhan-oai force-pushed the rhan/client-response-payload-plumbing branch from 1c6108c to 2536ff7 Compare April 29, 2026 20:03
@rhan-oai rhan-oai enabled auto-merge (squash) April 29, 2026 20:29
@rhan-oai rhan-oai merged commit 973c5c8 into main Apr 29, 2026
35 of 36 checks passed
@rhan-oai rhan-oai deleted the rhan/client-response-payload-plumbing branch April 29, 2026 20:50
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants