Skip to content

Run compact hooks for remote compaction v2#22828

Merged
jif-oai merged 4 commits into
mainfrom
jif/hooks-compact
May 15, 2026
Merged

Run compact hooks for remote compaction v2#22828
jif-oai merged 4 commits into
mainfrom
jif/hooks-compact

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

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

Why

Remote compaction v2 is the /responses implementation of session-history compaction, but it still needs to preserve the observable contract of the legacy /responses/compact path. In particular, users and integrations that rely on PreCompact and PostCompact hooks should not see different behavior when remote_compaction_v2 is enabled.

What Changed

  • Runs PreCompact before issuing the remote compaction v2 request, including Interrupted analytics when a pre-hook stops execution.
  • Runs PostCompact after a successful v2 compaction and aborts the turn if the post-hook stops execution.
  • Adds compact_remote_parity coverage that compares legacy and v2 compaction across manual transcript shapes, automatic pre-turn compaction, automatic mid-turn compaction, hook payloads, replacement history, follow-up request payloads, and API-key service_tier=fast behavior.
  • Registers the new parity suite under core/tests/suite.

Relevant code:

Verification

  • Added core/tests/suite/compact_remote_parity.rs to assert parity between legacy remote compaction and remote compaction v2 for the affected request, hook, rollout-history, and follow-up paths.
  • Existing compact_remote_v2 unit coverage still exercises v2 replacement-history retention and compaction-output collection.

@jif-oai jif-oai requested a review from a team as a code owner May 15, 2026 11:42
@jif-oai jif-oai changed the title feat: add hooks on remote compaction v2 Run compact hooks for remote compaction v2 May 15, 2026
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented May 15, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Delightful!

ℹ️ 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 5d30764 into main May 15, 2026
31 checks passed
@jif-oai jif-oai deleted the jif/hooks-compact branch May 15, 2026 13:26
@github-actions github-actions Bot locked and limited conversation to collaborators May 15, 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