Use extension lifecycle for goal resume continuation#25626
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a4bbf8819
ℹ️ 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".
| @@ -1296,9 +1296,6 @@ impl ThreadManagerState { | |||
| .await?; | |||
| if is_resumed_thread { | |||
| new_thread.thread.emit_thread_resume_lifecycle().await; | |||
There was a problem hiding this comment.
Preserve goal resume effects without extensions
When a ThreadManager is used by a caller that does not install the goal extension, this new resume path becomes a no-op for goal runtime restore. For example, the MCP server constructs its manager with empty_extension_registry() (codex-rs/mcp-server/src/message_processor.rs:65-70), but it can still run with a state DB and goals enabled; resuming an active-goal thread there now skips the old ThreadResumed restore, so the new session never rehydrates idle goal accounting and subsequent goal accounting/mutations miss elapsed time since resume. Either keep the legacy restore for managers without a goal lifecycle contributor or install the extension in those callers before removing the direct runtime effect.
Useful? React with 👍 / 👎.
| tracing::warn!("failed to continue active goal after resume: {err}"); | ||
| } | ||
| // those are sent before letting extensions schedule idle work. | ||
| thread.emit_thread_idle_lifecycle_if_idle().await; |
There was a problem hiding this comment.
Prevent plan-mode resumes from starting goal continuations
When resuming a thread whose current collaboration mode is Plan and whose goal is active, routing the post-resume continuation through the extension idle hook bypasses the old core guard in goal_continuation_candidate_if_active, which skipped continuations while should_ignore_goal_for_mode(...) was true. The extension GoalRuntimeHandle::continue_if_idle only checks that goal tools are visible before calling try_start_turn_if_idle, so this cold-resume path can now start an autonomous goal continuation turn even though plan mode is supposed to ignore goal continuations.
Useful? React with 👍 / 👎.
1c0be73
into
jif/goal-extension-app-server-wiring
Summary
CodexThreadTesting
just fmtjust test -p codex-core(fails locally: sandbox/tooling environment failures, including missingtest_stdio_serverandsandbox-exec: sandbox_apply: Operation not permitted)just test -p codex-app-server(fails locally: sandbox/process-exec environment failures and timeouts, includingsandbox-exec: sandbox_apply: Operation not permitted)