Skip to content

Add dormant plugin script lifecycle state - #31855

Closed
kmbroai wants to merge 2 commits into
dev/kyleb/plugin-script-command-resolver-tests-v3from
dev/kyleb/plugin-script-lifecycle-metrics-v3
Closed

kmbroai wants to merge 2 commits into
dev/kyleb/plugin-script-command-resolver-tests-v3from
dev/kyleb/plugin-script-lifecycle-metrics-v3

Conversation

@kmbroai

@kmbroai kmbroai commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Add a dormant PluginScriptExecution state object for one attributed plugin-script invocation.
  • Add the default-off plugin_script_lifecycle feature flag and generated config schema entries.
  • Emit one started fact and one terminal completed, failed, or interrupted fact.
  • Use an explicit terminal-outcome type and carry session/client identity for direct-session analytics fallback.

Why

Phase 1 needs one best-effort lifecycle state machine with a stable execution ID before shell and unified-exec adapters wire it into actual process execution. Explicit outcomes avoid ambiguous exit-code/bool call sites.

Enhancement design: Codex Plugin Metrics

Stacked on #31854.

How

  • Resolve an attributed first-party plugin script only when the feature is enabled.
  • Generate one UUID per execution and start timing only after successful spawn.
  • Make start and terminal transitions idempotent.
  • Classify explicit process outcomes as completed or failed, with interruption overriding terminal classification.
  • Preserve session ID and product client ID on both lifecycle facts.
  • Keep the state dormant until later runtime-adapter PRs opt in.

I tested this

  • just fmt — passed
  • just write-config-schema — passed with no generated drift
  • just fix -p codex-core-plugins -p codex-plugin -p codex-analytics -p codex-core -p codex-features -p codex-app-server -p codex-windows-sandbox — passed (stack-wide scoped lint gate)
  • just argument-comment-lint — passed
  • just test -p codex-core plugin_script_lifecycle — passed (8/8)
  • just test — attempted; the local workspace build stopped before tests because the runner lacks system libcap for unrelated codex-bwrap. Exact-head CI provides the full Linux/macOS/Windows matrix.

@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-command-resolver-tests-v3 branch from f9a8932 to ea11b7c Compare July 9, 2026 19:24
@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-lifecycle-metrics-v3 branch from 6252b89 to 03a2d6f Compare July 9, 2026 19:24
@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-command-resolver-tests-v3 branch from ea11b7c to 6b84c4c Compare July 9, 2026 22:29
@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-lifecycle-metrics-v3 branch from 03a2d6f to 2f0dc16 Compare July 9, 2026 22:29
@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-command-resolver-tests-v3 branch from 6b84c4c to afd3942 Compare July 9, 2026 22:44
@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-lifecycle-metrics-v3 branch from 2f0dc16 to 3ac7ca3 Compare July 9, 2026 22:44
@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-command-resolver-tests-v3 branch from afd3942 to 03aa5e3 Compare July 9, 2026 22:55
@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-lifecycle-metrics-v3 branch from 3ac7ca3 to 78d3222 Compare July 9, 2026 22:55
@kmbroai
kmbroai marked this pull request as ready for review July 9, 2026 23:14
@kmbroai
kmbroai requested a review from a team as a code owner July 9, 2026 23:14

@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: 78d32222af

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

self.interrupted.store(true, Ordering::Release);
}

pub(crate) fn finish(&self, exit_code: Option<i32>, failed: bool) {

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.

P3 Badge Replace opaque finish arguments

This new crate-internal API bakes in an ambiguous Option plus bool, so when the executor adapters wire this dormant type in, calls like finish(None, true) or finish(Some(0), false) will not be self-documenting about whether None means a signal, spawn failure, or some other terminal condition. The repo guidance asks new Rust APIs to avoid these positional opaque arguments rather than relying on comments at every callsite; consider a small enum/struct for the terminal outcome before this API is used.

AGENTS.md reference: AGENTS.md:L14-L20

Useful? React with 👍 / 👎.

@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-command-resolver-tests-v3 branch from 03aa5e3 to a96c06c Compare July 10, 2026 01:10
@kmbroai
kmbroai force-pushed the dev/kyleb/plugin-script-lifecycle-metrics-v3 branch from 78d3222 to 05f457c Compare July 10, 2026 01:10

kmbroai commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by openai/codex-internal#1390 after the Codex source-of-truth migration. The internal replacement preserves this stack position and carries the validated review fixes.

@kmbroai kmbroai closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant