Skip to content

Use extension lifecycle for goal resume continuation#25626

Merged
jif-oai merged 1 commit into
jif/goal-extension-app-server-wiringfrom
jif/goal-extension-resume-ordering
Jun 2, 2026
Merged

Use extension lifecycle for goal resume continuation#25626
jif-oai merged 1 commit into
jif/goal-extension-app-server-wiringfrom
jif/goal-extension-resume-ordering

Conversation

@jif-oai

@jif-oai jif-oai commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • expose generic thread resume/idle lifecycle methods on CodexThread
  • route app-server resume goal snapshot continuation through extension idle lifecycle
  • stop invoking legacy goal resume runtime effects after extension resume lifecycle

Testing

  • just fmt
  • just test -p codex-core (fails locally: sandbox/tooling environment failures, including missing test_stdio_server and sandbox-exec: sandbox_apply: Operation not permitted)
  • just test -p codex-app-server (fails locally: sandbox/process-exec environment failures and timeouts, including sandbox-exec: sandbox_apply: Operation not permitted)

@jif-oai jif-oai requested a review from a team as a code owner June 1, 2026 14:27

@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: 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;

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.

P2 Badge 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;

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.

P2 Badge 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 👍 / 👎.

@jif-oai jif-oai merged commit 1c0be73 into jif/goal-extension-app-server-wiring Jun 2, 2026
28 of 30 checks passed
@jif-oai jif-oai deleted the jif/goal-extension-resume-ordering branch June 2, 2026 12:49
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 2, 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.

1 participant