Repository navigation
Conversation
8aa0023 to
1be315c
Compare
3af7e95 to
933dfab
Compare
1be315c to
0e6aeaa
Compare
933dfab to
d58e174
Compare
0e6aeaa to
cf93b45
Compare
d58e174 to
2e37597
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e37597834
ℹ️ 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".
| } | ||
| let exit_code = process.exit_code(); | ||
| let exit = exit_code.unwrap_or(-1); | ||
| process.notify_lifecycle_finished(exit_code, /*failed*/ false); |
There was a problem hiding this comment.
Check sandbox denial before reporting lifecycle success
For a sandboxed command that exits quickly, this new lifecycle notification runs before check_for_sandbox_denial_with_text() below can convert the exited process into a sandbox-denied failure. An idempotent lifecycle implementation (as required by the trait) will likely keep this first failed=false terminal result, so plugin/process metrics record a sandbox-denied execution as successful. Move the sandbox-denial check ahead of the success notification, or notify only after the terminal outcome is known.
Useful? React with 👍 / 👎.
| .await; | ||
| } else { | ||
| let exit_code = process.exit_code().unwrap_or(-1); | ||
| process.notify_lifecycle_finished(Some(exit_code), /*failed*/ false); |
There was a problem hiding this comment.
Treat background sandbox denials as lifecycle failures
When a stored/background sandboxed process exits after the initial call returns, the output task records ProcessState::sandbox_denied but does not set failure_message, so this watcher falls into the success branch and reports failed=false; there is no later poll required to correct the lifecycle result. This makes sandbox-denied background executions look successful to the new lifecycle metrics. Check sandbox_denied (or run the existing denial check against the transcript) before issuing the success finish notification.
Useful? React with 👍 / 👎.
| if state.failure_message.is_none() { | ||
| let _ = self.state_tx.send_replace(state.failed(message)); | ||
| } | ||
| self.notify_lifecycle_finished(/*exit_code*/ None, /*failed*/ true); |
There was a problem hiding this comment.
Defer lifecycle finish until termination is observed
When a live process is failed by orchestration, such as the network-denial path calling fail_and_terminate, this reports the lifecycle as finished before terminate() has even been requested or any exit status can be observed. Because lifecycle implementations are expected to make terminal emission idempotent, the first (None, true) result can become the permanent terminal record even if the process later exits with a real status/output; mark the failure state here, but let the watcher/drop path finish the lifecycle after termination is observed.
Useful? React with 👍 / 👎.
| if state.failure_message.is_none() { | ||
| let _ = self.state_tx.send_replace(state.failed(message)); | ||
| } | ||
| self.notify_lifecycle_finished(/*exit_code*/ None, /*failed*/ true); |
There was a problem hiding this comment.
Mark cancellation before terminating failed live processes
When a live process is stopped through fail_and_terminate (for example after a deferred network denial), this path records a terminal failure and then terminates the process, but it never calls mark_cancelled; because state.failed(...) also makes has_exited() true, the later Drop path will skip cancellation as well. Lifecycle consumers that track orchestration-stopped processes will therefore miss these cancellations even though the process was still live when Codex killed it.
Useful? React with 👍 / 👎.
cf93b45 to
ef993e5
Compare
2e37597 to
6bd7bd6
Compare
|
Superseded by openai/codex-internal#1387 after the Codex source-of-truth migration. The internal replacement preserves this stack position and carries the validated review fixes. |
What
Why
Plugin script lifecycle metrics need a reliable execution-backend hook without coupling generic process execution to plugin-specific analytics. Terminal callbacks must report denials as failures before idempotent downstream consumers observe success.
Enhancement design: Codex Plugin Metrics
Stacked on #31851.
How
after_spawnonly after successful child creation.I tested this
just fmt— passedjust 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— passedjust test -p codex-windows-sandbox— passedjust test -p codex-core unified_exec— 113/114 passed; both relevant short-lived/background network-denial tests passed, and the sole failure is the known unrelated localunified_exec_runs_under_sandboxharness assertionjust test— attempted; the local workspace build stopped before tests because the runner lacks systemlibcapfor unrelatedcodex-bwrap. Exact-head CI provides the full Linux/macOS/Windows matrix.