Skip to content

support app usage analytics - #11687

Merged
alexsong-oai merged 7 commits into
mainfrom
alexs/app-usage
Feb 13, 2026
Merged

alexsong-oai merged 7 commits into
mainfrom
alexs/app-usage

Conversation

@alexsong-oai

@alexsong-oai alexsong-oai commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Emit app mentioned and app used events. Dedup by (turn_id, connector_id)

Example event params:
{
"event_type": "codex_app_used",
"connector_id": "asdk_app_xxx",
"thread_id": "019c5527-36d4-xxx",
"turn_id": "019c552c-cd17-xxx",
"app_name": "Slack (OpenAI Internal)",
"product_client_id": "codex_cli_rs",
"invoke_type": "explicit",
"model_slug": "gpt-5.3-codex"
}

@alexsong-oai
alexsong-oai marked this pull request as ready for review February 13, 2026 18:51

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

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6a7e9d121

ℹ️ 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 +285 to +287
if !queue.should_enqueue_app_used(&tracking, &app) {
return;
}

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.

P2 Badge Record dedupe key only after app-used enqueue succeeds

track_app_used checks should_enqueue_app_used before attempting try_send, and should_enqueue_app_used inserts (turn_id, connector_id) into the dedupe set immediately. When the analytics channel is temporarily full, try_send drops the job but the key is still marked as emitted, so later tool calls for the same app in the same turn are suppressed even after the queue has capacity again, causing silent undercounting of codex_app_used events during backpressure.

Useful? React with 👍 / 👎.

);
}

pub(crate) fn track_app_mentioned(

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.

Why do you need this? can you call the underlying track_app_mentioned directly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pub(crate) fn track_app_mentioned is a wrapper around the underlying free function. Since the free function does not have access to self.queue, we need to pass it as a param. Can also move the free function’s logic into this method instead; either should be fine.

#[derive(Clone)]
pub(crate) struct AnalyticsEventsQueue {
sender: mpsc::Sender<TrackEventsJob>,
app_used_emitted_keys: Arc<Mutex<HashSet<(String, String)>>>,

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.

I think it is OK, but just to confirm, this will be cleared when you close codex then resume right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes

@alexsong-oai
alexsong-oai merged commit e71760f into main Feb 13, 2026
33 checks passed
@alexsong-oai
alexsong-oai deleted the alexs/app-usage branch February 13, 2026 20:00
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 13, 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.

3 participants