Skip to content

Support asynchronous command hooks - #37533

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/8094552e4afe7b47b09a61bb575bb20f4e491d8d
Aug 8, 2026
Merged

Support asynchronous command hooks#37533
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/8094552e4afe7b47b09a61bb575bb20f4e491d8d

Conversation

@copyberry

@copyberry copyberry Bot commented Aug 8, 2026

Copy link
Copy Markdown

Support asynchronous command hooks

Why

Hook configurations can mark command handlers as asynchronous, but Codex previously skipped those handlers outside SessionEnd.

What changed

  • Run asynchronous command hooks in the background with a per-session concurrency limit, while keeping SessionEnd hooks synchronous.
  • Prevent asynchronous hooks from blocking, stopping, rewriting, or otherwise controlling the operation that launched them.
  • Deliver warnings and additional context at safe turn boundaries: inject results into an active turn after sampling, or buffer them ahead of the next user prompt when the session is idle.
  • Preserve in-flight hooks across configuration reloads, scope spilled output to the thread, and abort outstanding work during session shutdown.

Testing

Add unit and integration coverage for background scheduling, concurrency, output parsing, active and idle result delivery, configuration reloads, and shutdown cleanup.

## Why

Hook configurations can mark command handlers as asynchronous, but Codex previously skipped those handlers outside `SessionEnd`.

## What changed

- Run asynchronous command hooks in the background with a per-session concurrency limit, while keeping `SessionEnd` hooks synchronous.
- Prevent asynchronous hooks from blocking, stopping, rewriting, or otherwise controlling the operation that launched them.
- Deliver warnings and additional context at safe turn boundaries: inject results into an active turn after sampling, or buffer them ahead of the next user prompt when the session is idle.
- Preserve in-flight hooks across configuration reloads, scope spilled output to the thread, and abort outstanding work during session shutdown.

## Testing

Add unit and integration coverage for background scheduling, concurrency, output parsing, active and idle result delivery, configuration reloads, and shutdown cleanup.

GitOrigin-RevId: 8094552e4afe7b47b09a61bb575bb20f4e491d8d
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/8094552e4afe7b47b09a61bb575bb20f4e491d8d branch from aa29579 to 6f647ca Compare August 8, 2026 04:25
@copyberry
copyberry Bot merged commit 6f647ca into main Aug 8, 2026
30 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/8094552e4afe7b47b09a61bb575bb20f4e491d8d branch August 8, 2026 04:26
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 8, 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.

5 participants