Skip to content

Add app-server client protocol#19

Open
peter-jerry-ye wants to merge 6 commits into
mainfrom
codex/app-server-protocol-draft
Open

Add app-server client protocol#19
peter-jerry-ye wants to merge 6 commits into
mainfrom
codex/app-server-protocol-draft

Conversation

@peter-jerry-ye
Copy link
Copy Markdown
Contributor

Summary

  • add a separate app-server client entrypoint and stdio connection
  • add typed app-server request params, responses, events, and common server request handling
  • keep JSON-RPC response handling inside the SDK, including handler-error responses

Validation

  • moon fmt
  • moon info
  • moon check
  • moon test

@peter-jerry-ye peter-jerry-ye marked this pull request as ready for review May 18, 2026 05:50
Copy link
Copy Markdown

@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: f25c4c1e39

ℹ️ 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 app_server.mbt
@peter-jerry-ye peter-jerry-ye force-pushed the codex/app-server-protocol-draft branch from f25c4c1 to fea5aed Compare May 20, 2026 07:32
Copy link
Copy Markdown

@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: 3730553f08

ℹ️ 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 app_server.mbt Outdated
Comment thread app_server.mbt Outdated
Copy link
Copy Markdown

@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: be0d9fc8cc

ℹ️ 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 app_server.mbt
Copy link
Copy Markdown

@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: 453fb54b60

ℹ️ 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 app_server.mbt
Comment on lines +5206 to +5209
"inputTokens": Number(input_tokens, ..),
"cachedInputTokens": Number(cached_input_tokens, ..),
"outputTokens": Number(output_tokens, ..),
"reasoningOutputTokens": Number(reasoning_output_tokens, ..),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Accept token usage payloads without reasoning tokens

When the server emits thread/tokenUsage/updated, the v2 Usage payload contains the standard token fields (inputTokens, cachedInputTokens, outputTokens) and does not always include reasoningOutputTokens. Requiring that field here makes normal usage notifications fail JSON decoding; in the reader pump that exception closes the event/request queues and drops the connection for resumed or active threads that report usage. Treat the reasoning count as optional/defaulted instead of mandatory.

Useful? React with 👍 / 👎.

Comment thread app_server.mbt Outdated
Comment on lines +147 to +148
executable_path,
["--listen", "stdio://"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Launch the documented Codex app-server command

With no override, this runs the default executable as codex-app-server --listen stdio://, but the Codex CLI installed by the README exposes the app server as the codex app-server subcommand. In the default installation path this means with_app_server fails before any handshake unless callers provide a custom wrapper; the SDK should launch codex with the app-server subcommand or otherwise make the argv configurable together with the executable.

Useful? React with 👍 / 👎.

Comment thread app_server.mbt Outdated
Copy link
Copy Markdown

@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: f96c253267

ℹ️ 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 app_server.mbt
Comment on lines +4823 to +4827
guard value
is {
"id": String(id),
"sessionId": String(session_id),
"status": status,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Stop requiring sessionId on Thread payloads

When decoding any Thread returned by thread/list, thread/start, thread/read, or thread/started, this guard requires sessionId, but the app-server v2 Thread schema for the targeted Codex 0.128 protocol does not include that field. A normal thread payload with id, status, preview, etc. is therefore rejected with JsonDecodeError, making the main typed thread APIs and thread notifications unusable even after the request itself succeeds.

Useful? React with 👍 / 👎.

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.

2 participants