Skip to content

feat: add turn lifecycle contributors#22480

Merged
jif-oai merged 1 commit into
mainfrom
jif/turn-lifecyle
May 13, 2026
Merged

feat: add turn lifecycle contributors#22480
jif-oai merged 1 commit into
mainfrom
jif/turn-lifecyle

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai commented May 13, 2026

Why

Extensions can already contribute prompt, tool, turn-item, and thread-lifecycle behavior, but there was no explicit host-owned hook for per-turn setup and cleanup. That makes extension-private turn state awkward: an extension either has to stash it outside the turn lifecycle or depend on core runtime objects.

This adds a small turn lifecycle boundary. Extensions receive stable identifiers plus the existing session, thread, and turn ExtensionData stores, while core keeps owning task scheduling, cancellation, and turn teardown.

What Changed

  • Added TurnLifecycleContributor with on_turn_start, on_turn_stop, and on_turn_abort callbacks in codex-rs/ext/extension-api.
  • Added typed TurnStartInput, TurnStopInput, and TurnAbortInput payloads that expose thread_id, turn_id, session_store, thread_store, and turn_store.
  • Registered and re-exported turn lifecycle contributors through ExtensionRegistry and ExtensionRegistryBuilder.
  • Wired Session to emit turn start, stop, and abort callbacks from the existing turn/task lifecycle paths.
  • Carried the turn-scoped ExtensionData through RunningTask and RemovedTask so stop/abort callbacks receive the same turn store created at turn start.

Verification

  • Not run locally.
@jif-oai jif-oai requested a review from a team as a code owner May 13, 2026 11:13
@jif-oai jif-oai changed the title feat: turn lifecycle contributors feat: add turn lifecycle contributors May 13, 2026
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented May 13, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Keep it up!

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

@jif-oai jif-oai merged commit 27e67a8 into main May 13, 2026
26 of 27 checks passed
@jif-oai jif-oai deleted the jif/turn-lifecyle branch May 13, 2026 11:47
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

1 participant