Skip to content

Emit accepted line fingerprint analytics#21601

Merged
alexsong-oai merged 1 commit into
mainfrom
alexs/loc-accepted-events
May 8, 2026
Merged

Emit accepted line fingerprint analytics#21601
alexsong-oai merged 1 commit into
mainfrom
alexs/loc-accepted-events

Conversation

@alexsong-oai
Copy link
Copy Markdown
Collaborator

Why

Codex assisted-code attribution needs a client-side accepted-code source that does not upload raw code. This adds a hash-only analytics event derived from the turn diff so downstream attribution can compare accepted Codex lines against commit or PR diffs.

What Changed

  • Parse accepted/effective added lines from the final turn diff and emit codex_accepted_line_fingerprints analytics.
  • Hash repo, path, and normalized line content before upload; raw code and raw diffs are not included in the event.
  • Chunk large fingerprint payloads and send accepted-line fingerprint events in isolated requests while preserving normal batching for other analytics events.
  • Canonicalize Git remote URLs before repo hashing so SSH/HTTPS GitHub remotes join to the same repo hash.
  • Add parser coverage for unified diff hunk lines that look like +++ or --- file headers.

Verification

  • cargo test -p codex-analytics
  • cargo test -p codex-git-utils canonicalize_git_remote_url
  • just fix -p codex-analytics
  • just bazel-lock-check
  • git diff --check
@alexsong-oai alexsong-oai requested a review from a team as a code owner May 7, 2026 22:43
@alexsong-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

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: 614ca494c2

ℹ️ 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 +232 to +235
if host == "github.com" {
Some(format!("{host}/{}", path.to_ascii_lowercase()))
} else {
Some(format!("{host}/{path}"))
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 Normalize GitHub remotes with default ports

The commit promises SSH/HTTPS GitHub remotes join to the same repo hash, but ssh://git@github.com:22/OpenAI/Codex.git and https://github.com:443/openai/codex.git keep the port in host, so this branch skips the GitHub lowercasing/canonical host path and hashes them differently from git@github.com:OpenAI/Codex.git. This fragments attribution for valid Git remotes using default ports.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

updated

@alexsong-oai alexsong-oai force-pushed the alexs/loc-accepted-events branch 2 times, most recently from 5dd8ab8 to 47956eb Compare May 8, 2026 01:16
@alexsong-oai alexsong-oai force-pushed the alexs/loc-accepted-events branch from 47956eb to 90a5103 Compare May 8, 2026 01:49
@alexsong-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

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: 90a510352b

ℹ️ 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 codex-rs/analytics/src/client.rs
@@ -0,0 +1,188 @@
use crate::facts::AcceptedLineFingerprint;
Copy link
Copy Markdown
Collaborator

@xl-openai xl-openai May 8, 2026

Choose a reason for hiding this comment

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

I think you can combine this file with accepted_line_events.rs

let mut current_batch = Vec::new();

for event in events {
if event.should_send_in_isolated_request() {
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.

I think it is good for now. But would love to learn if we need a separate queue for this event so it won't block other events.

@alexsong-oai alexsong-oai force-pushed the alexs/loc-accepted-events branch from 2015ce9 to 98572b1 Compare May 8, 2026 18:20
@alexsong-oai alexsong-oai merged commit bbb6bf0 into main May 8, 2026
26 checks passed
@alexsong-oai alexsong-oai deleted the alexs/loc-accepted-events branch May 8, 2026 19:16
@github-actions github-actions Bot locked and limited conversation to collaborators May 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants