Skip to content

Add SessionEnd hooks for thread teardown#33895

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/5d19a658677a137caf836ed5042dcb43f5eb6d1a
Jul 17, 2026
Merged

Add SessionEnd hooks for thread teardown#33895
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/5d19a658677a137caf836ed5042dcb43f5eb6d1a

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 17, 2026

Copy link
Copy Markdown

Add SessionEnd hooks for thread teardown

What changed

  • Add the SessionEnd hook event to hook configuration, protocol schemas, analytics, and the hooks browser.
  • Run matching hooks for root threads during shutdown, including app-server archive, delete, idle unload, and graceful shutdown. Flush the transcript first and provide the session ID, transcript path, working directory, and reason: "other".
  • Keep teardown bounded: hook output is advisory, the default timeout is one second, configured timeouts are capped at three seconds, and async hooks run synchronously with a warning.

Testing

  • Cover transcript availability, matcher selection, timeout normalization, ignored control output, subagent exclusion, archive/delete ordering, and graceful shutdown of multiple loaded threads.

## What changed

- Add the `SessionEnd` hook event to hook configuration, protocol schemas, analytics, and the hooks browser.
- Run matching hooks for root threads during shutdown, including app-server archive, delete, idle unload, and graceful shutdown. Flush the transcript first and provide the session ID, transcript path, working directory, and `reason: "other"`.
- Keep teardown bounded: hook output is advisory, the default timeout is one second, configured timeouts are capped at three seconds, and async hooks run synchronously with a warning.

## Testing

- Cover transcript availability, matcher selection, timeout normalization, ignored control output, subagent exclusion, archive/delete ordering, and graceful shutdown of multiple loaded threads.

GitOrigin-RevId: 5d19a658677a137caf836ed5042dcb43f5eb6d1a
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/5d19a658677a137caf836ed5042dcb43f5eb6d1a branch from a2014d1 to 7bd4408 Compare July 17, 2026 19:59
@copyberry
copyberry Bot merged commit 7bd4408 into main Jul 17, 2026
14 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/5d19a658677a137caf836ed5042dcb43f5eb6d1a branch July 17, 2026 20:00
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 17, 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