[plugin sdk] Project session extension slots#75609
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: not applicable. as a bug reproduction; this is an additive Plugin SDK feature PR. For review, source inspection and exact-head CI confirm the new slot projection and trusted-policy read paths are covered on the PR head. Next step before merge Security Review detailsBest possible solution: Land the additive SDK seam after maintainer API review, keeping the guarded projection/cleanup coverage and leaving the broader recipe documentation to the linked docs PR. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; this is an additive Plugin SDK feature PR. For review, source inspection and exact-head CI confirm the new slot projection and trusted-policy read paths are covered on the PR head. Is this the best way to solve the issue? Yes for this slice. The PR keeps the public API addition narrow, validates and persists slot ownership, scopes config-backed reads to trusted policy evaluation, and adds focused contract coverage; final API acceptance is still a maintainer decision. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5fa7d3b1a4a0. |
6a384e7 to
184daa1
Compare
184daa1 to
34e1e30
Compare
|
Fixed in |
34e1e30 to
d69cc3d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34e1e302c1
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
This PR extends the Plugin SDK session-extension registration surface to optionally mirror projected session-extension state into guarded top-level SessionEntry “slots”, and adds scoped session-extension reads for trusted tool policies.
Changes:
- Add
sessionEntrySlotKey/sessionEntrySlotSchemato session extension registrations and validatesessionEntrySlotKeyagainst reserved/prototype keys. - Mirror projected session-extension values into
SessionEntry[slotKey]on patch and clear the mirror on unset/cleanup. - Add trusted-tool-policy support for scoped session-extension reads via a
getSessionExtensionhelper, plus contract coverage and SDK baseline/changelog updates.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plugins/trusted-tool-policy.ts | Adds per-policy scoped getSessionExtension helper and caching for trusted policies. |
| src/plugins/session-entry-slot-keys.ts | Introduces reserved key set + normalizer for safe SessionEntry slot keys. |
| src/plugins/registry.ts | Validates sessionEntrySlotKey during session extension registration. |
| src/plugins/host-hooks.ts | Extends public session extension registration types with slot key/schema fields. |
| src/plugins/host-hook-state.ts | Implements slot mirroring on patchPluginSessionExtension and adds sync session-extension read helper. |
| src/plugins/host-hook-cleanup.ts | Ensures promoted slot keys are cleared during plugin/session cleanup. |
| src/plugins/hook-types.ts | Extends tool hook context types to include optional session-extension read helper (and config). |
| src/plugins/contracts/session-entry-projection.contract.test.ts | Adds contract tests for slot mirroring, reserved-key guard, cleanup behavior, and trusted policy reads. |
| src/agents/pi-tools.ts | Threads config into tool wrapping so before-tool-call hooks can access it. |
| src/agents/pi-tools.before-tool-call.ts | Passes config through tool hook context and runs trusted policies with the enriched context. |
| docs/.generated/plugin-sdk-api-baseline.sha256 | Updates SDK API baseline hashes for the public type additions. |
| CHANGELOG.md | Adds release note entry for SessionEntry slot projection + trusted-policy session reads. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c86678531c
ℹ️ 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".
0f47792 to
d9b670a
Compare
|
Merged via squash.
Thanks @100yenadmin! |
Merged via squash. Prepared head SHA: d9b670a Co-authored-by: 100yenadmin <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d9b670a Co-authored-by: 100yenadmin <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d9b670a Co-authored-by: 100yenadmin <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d9b670a Co-authored-by: 100yenadmin <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d9b670a Co-authored-by: 100yenadmin <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Summary
sessionEntrySlotKey/sessionEntrySlotSchemato session extension registrations.SessionEntryslot on patch, and clears the mirror on unset.SessionEntryfields or prototype keys.This replaces the consolidated #73384 / #74483 stack with a smaller fresh-main slice. The previous consolidated branch became extremely brittle under constant upstream churn: rebases repeatedly invalidated generated baselines, review threads, and CI assumptions, which made the PR harder to review than the underlying changes warranted. This PR files one hook/seam area at a time so maintainers can review, test, and merge each contract independently without re-opening the whole workflow stack.
Links
Non-goals
SessionEntryslots directly writable by plugins; they remain mirrors of projected extension state.Test Plan
pnpm test src/plugins/contracts/session-entry-projection.contract.test.tspnpm check:test-typespnpm lint:corepnpm plugin-sdk:api:checkgit diff --checknpm run check:no-conflict-markers