Skip to content

[codex-analytics] guardian review analytics events emission#17693

Merged
rhan-oai merged 1 commit into
mainfrom
pr17693
Apr 22, 2026
Merged

[codex-analytics] guardian review analytics events emission#17693
rhan-oai merged 1 commit into
mainfrom
pr17693

Conversation

@rhan-oai

@rhan-oai rhan-oai commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Why

Guardian approvals now run as review sessions, but Codex analytics did not have a terminal event for those reviews. That made it hard to measure approval outcomes, failure modes, Guardian session reuse, model metadata, token usage, and timing separately from the parent turn.

What changed

Adds codex_guardian_review analytics emission for Guardian approval reviews. The event is emitted from the Guardian review path with review identity, target item id, approval request source, a PII-minimized reviewed-action shape, terminal decision/status, failure reason, Guardian assessment fields, Guardian session metadata, token usage, and timing metadata.

The reviewed-action payload intentionally omits high-risk fields such as shell commands, working directories, argv, file paths, network targets/hosts, rationale, retry reason, and permission justifications. It also classifies prompt-build failures separately from Guardian session/runtime failures so fail-closed cases are distinguishable in analytics.

Verification

  • Guardian review analytics tests cover terminal success, timeout/cancel/fail-closed paths, session metadata, and token usage plumbing.
  • cargo clippy -p codex-core --lib --tests -- -D warnings

Stack created with Sapling. Best reviewed with ReviewStack.

@rhan-oai rhan-oai force-pushed the pr17693 branch 5 times, most recently from 8de4171 to 9f94b82 Compare April 15, 2026 04:20
@rhan-oai rhan-oai changed the base branch from main to pr17692 April 15, 2026 21:13
@rhan-oai rhan-oai changed the base branch from pr17692 to main April 15, 2026 21:37
@rhan-oai rhan-oai changed the base branch from main to pr17692 April 15, 2026 21:39
@rhan-oai rhan-oai changed the base branch from pr17692 to main April 15, 2026 22:11
@rhan-oai rhan-oai force-pushed the pr17693 branch 5 times, most recently from 044b9ef to 73130f4 Compare April 16, 2026 00:05
@rhan-oai rhan-oai changed the base branch from main to pr17692 April 16, 2026 00:28
@rhan-oai rhan-oai changed the base branch from pr17692 to main April 16, 2026 00:52
@rhan-oai rhan-oai changed the base branch from main to pr17692 April 16, 2026 16:51
@rhan-oai rhan-oai changed the base branch from pr17692 to main April 16, 2026 17:06
@rhan-oai rhan-oai changed the base branch from main to pr17692 April 16, 2026 17:13
@rhan-oai rhan-oai changed the base branch from pr17692 to main April 16, 2026 17:33
@rhan-oai rhan-oai changed the base branch from main to pr17692 April 16, 2026 18:46
@rhan-oai rhan-oai requested a review from a team as a code owner April 20, 2026 20:08
@rhan-oai rhan-oai force-pushed the pr17693 branch 4 times, most recently from 748a64f to 8508629 Compare April 20, 2026 22:32
@rhan-oai rhan-oai requested a review from dylan-hurd-oai April 20, 2026 22:39
@rhan-oai rhan-oai force-pushed the pr17693 branch 3 times, most recently from c23fbb6 to 8e51b64 Compare April 21, 2026 00:54
@rhan-oai rhan-oai force-pushed the pr17693 branch 4 times, most recently from cc931a9 to 6b895cd Compare April 21, 2026 06:15

@dylan-hurd-oai dylan-hurd-oai left a comment

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.

LGTM once we fix the error enum

Comment thread codex-rs/core/src/guardian/review.rs Outdated
Completed(GuardianAssessment),
Failed(GuardianReviewFailure),
TimedOut,
Aborted,

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.

Failed / TimedOut / Aborted feels like a messy mix here

Comment thread codex-rs/core/src/guardian/review.rs Outdated
}

#[derive(Debug)]
pub(super) enum GuardianReviewFailure {

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.

nit, if this is an error type, we should name it Error rather than failure

Comment thread codex-rs/core/src/guardian/review.rs
@rhan-oai rhan-oai force-pushed the pr17693 branch 5 times, most recently from 342c93c to e116329 Compare April 22, 2026 01:13
@rhan-oai

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ 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".

@rhan-oai rhan-oai force-pushed the pr17693 branch 2 times, most recently from 33e3764 to e1bd596 Compare April 22, 2026 06:22

@dylan-hurd-oai dylan-hurd-oai left a comment

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.

thanks!

@rhan-oai rhan-oai merged commit 4e7399c into main Apr 22, 2026
25 checks passed
@rhan-oai rhan-oai deleted the pr17693 branch April 22, 2026 08:02
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 22, 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