Skip to content

[codex-analytics] emit goal lifecycle analytics - #27078

Merged
marksteinbrick-oai merged 1 commit into
mainfrom
mark.steinbrick/goal-analytics-extension-review
Jun 10, 2026
Merged

[codex-analytics] emit goal lifecycle analytics#27078
marksteinbrick-oai merged 1 commit into
mainfrom
mark.steinbrick/goal-analytics-extension-review

Conversation

@marksteinbrick-oai

@marksteinbrick-oai marksteinbrick-oai commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Why

  • Currently, there is no analytics event for /goal behavior
  • Existing events cannot identify goal execution or its resulting outcome
  • The original update in #26182 was implemented before /goal moved into codex-goal-extension.

What Changed

  • Adds codex_goal_event serialization and enrichment to codex-analytics
  • Emits goal events from the canonical codex-goal-extension mutation and accounting paths:
    • created when a new logical goal is persisted
    • usage_accounted when cumulative goal usage is persisted
    • status_changed when the stored goal status changes
    • cleared when the goal is deleted
  • Preserves causal turn_id for turn driven events and uses null attribution for external or idle lifecycle events
  • Changes goal deletion to return the deleted row so cleared retains the stable goal ID

Event Details

Includes standard analytics metadata along with goal specific fields:

  • goal_id: Stable ID stored in the local SQLite goal row and shared across the goal's events
  • event_kind: Observed operation (see the 4 lifecycle events cited in the above bullet)
  • goal_status: Resulting or last stored status: active, paused, blocked, usage_limited, etc.
  • has_token_budget: Indicates whether a token budget is configured
  • turn_id: Causal turn ID, or null when no causal turn exists
  • cumulative_tokens_accounted: Cumulative tokens on usage_accounted events; null otherwise
  • cumulative_time_accounted_seconds: Cumulative active time on usage_accounted events; null otherwise

Validation

  • just test -p codex-analytics -p codex-state -p codex-goal-extension
  • just test -p codex-core -E 'test(/goal/)'
  • just test -p codex-app-server
  • cargo build -p codex-analytics -p codex-core -p codex-state -p codex-app-server

@marksteinbrick-oai
marksteinbrick-oai marked this pull request as ready for review June 8, 2026 22:29

@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: 9984988dae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/ext/goal/src/api.rs
Comment thread codex-rs/analytics/Cargo.toml
Emit the existing codex_goal_event contract from the canonical goal extension lifecycle after the extension migration.

- track created, usage_accounted, status_changed, and cleared events
- preserve turn attribution, cumulative accounting snapshots, and payload privacy
- return deleted goal rows so clear events retain the final goal ID and status
- cover extension, app-server, resume, budget-limit, and analytics serialization paths
@marksteinbrick-oai
marksteinbrick-oai force-pushed the mark.steinbrick/goal-analytics-extension-review branch from 9984988 to 2d1ffe5 Compare June 8, 2026 23:05
@marksteinbrick-oai marksteinbrick-oai changed the title [codex-goal-extension] emit goal lifecycle analytics [codex-analytics] emit goal lifecycle analytics Jun 8, 2026

@etraut-openai etraut-openai 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.

Code looks correct. It touches a lot more files that I'd expect for this change, but I don't see an obvious way to simplify it.

@marksteinbrick-oai
marksteinbrick-oai merged commit 608b8b1 into main Jun 10, 2026
46 of 47 checks passed
@marksteinbrick-oai
marksteinbrick-oai deleted the mark.steinbrick/goal-analytics-extension-review branch June 10, 2026 01:45
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 10, 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