Skip to content

notify: include client in legacy hook payload#12968

Merged
bolinfest merged 1 commit intomainfrom
pr12968
Feb 27, 2026
Merged

notify: include client in legacy hook payload#12968
bolinfest merged 1 commit intomainfrom
pr12968

Conversation

@bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented Feb 27, 2026

Why

The notify hook payload did not identify which Codex client started the turn. That meant downstream notification hooks could not distinguish between completions coming from the TUI and completions coming from app-server clients such as VS Code or Xcode. Now that the Codex App provides its own desktop notifications, it would be nice to be able to filter those out.

This change adds that context without changing the existing payload shape for callers that do not know the client name, and keeps the new end-to-end test cross-platform.

What changed

  • added an optional top-level client field to the legacy notify JSON payload
  • threaded that value through core and hooks; the internal session and turn state now carries it as app_server_client_name
  • set the field to codex-tui for TUI turns
  • captured initialize.clientInfo.name in the app server and applied it to subsequent turns before dispatching hooks
  • replaced the notify integration test hook with a python3 script so the test does not rely on Unix shell permissions or bash
  • documented the new field in docs/config.md

Testing

  • cargo test -p codex-hooks
  • cargo test -p codex-tui
  • cargo test -p codex-app-server suite::v2::initialize::turn_start_notify_payload_includes_initialize_client_name -- --exact --nocapture
  • cargo test -p codex-core (src/lib.rs passed; core/tests/all.rs still has unrelated existing failures in this environment)

Docs

The public config reference on developers.openai.com/codex should mention that the legacy notify payload may include a top-level client field. The TUI reports codex-tui, and the app server reports initialize.clientInfo.name when it is available.

Copy link
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: ce54e4725b

ℹ️ 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 +538 to +542
self.session
.update_settings(SessionSettingsUpdate {
notify_client,
..Default::default()
})
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Queue notify-client updates with turn submissions

set_notify_client applies notify_client immediately through update_settings, but turn-starting calls still use submit(...), which only enqueues work. In a multi-connection app-server session, if client A and client B (different clientInfo.name) start turns back-to-back on the same thread, B can overwrite this shared setting before A's queued turn is processed, so A's legacy notify payload is attributed to the wrong client. This should be ordered with the turn operation itself (for example via a queued op/override) so client attribution is per-turn and race-free.

Useful? React with 👍 / 👎.


const TUI_NOTIFY_CLIENT: &str = "codex-tui";

async fn initialize_app_server_client_name(thread: &CodexThread) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: this name makes it sound like the TUI is built on top of app server. prob worth adding an inline comment to explain that we are special casing TUI surface

@bolinfest bolinfest merged commit e6cd75a into main Feb 27, 2026
53 of 55 checks passed
@bolinfest bolinfest deleted the pr12968 branch February 27, 2026 06:27
@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants