Reuse guardian session across approvals#14668
Conversation
Keep a persistent guardian subagent per parent session so approval reviews can reuse the same prompt cache key. Reset the child history before each review so prior guardian decisions do not leak into later reviews, while keeping the existing timeout and cancellation behavior intact. Co-authored-by: Codex <noreply@openai.com>
6a07464 to
2618df0
Compare
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2618df074e
ℹ️ 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".
Start the guardian review deadline before the reusable-subagent manager lock and carry it through subagent spawn, history reset, network approval copying, and turn submission. Keep timeout-triggered cleanup non-blocking and heap-box the heavy timeout-wrapped futures so the prompt-cache reuse test does not overflow its stack. Co-authored-by: Codex <noreply@openai.com>
Add an explicit guardian-subagent manager shutdown hook and call it from the parent session shutdown path, with a fallback on submission-loop exit if the channel closes without an explicit shutdown op. Add a regression test that caches a guardian child and asserts parent shutdown sends the child its own Op::Shutdown. Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75d8487381
ℹ️ 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".
Rename the experimental guardian approvals flag back to guardian_approval, migrate the deprecated smart_approvals alias, and update the CLI/TUI copy. Also propagate guardian review cancellation into reusable subagent spawn and replace cached session-approved hosts when syncing from the parent review session. Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
| let approved_hosts = self.session_approved_hosts.lock().await; | ||
| let approved_hosts = self.session_approved_hosts.lock().await.clone(); | ||
| let mut other_approved_hosts = other.session_approved_hosts.lock().await; | ||
| other_approved_hosts.clear(); |
There was a problem hiding this comment.
Before:
copy_session_approved_hosts_to()only didextend(...)- if the cached guardian child had old approved hosts, they stayed there forever
After:
- it clones the parent’s current approved-host set
- clears the child’s set
- repopulates it from the parent snapshot
That matters because the guardian session is now reused. Without this, the child could keep stale network approvals from earlier reviews and end
up with broader access than the parent session.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc72ff4ccf
ℹ️ 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".
Split guardian logic into focused modules, rename the reusable child session plumbing to review-session terminology, and move the guardian snapshot alongside the moved tests. Also preserve explicit false values when migrating smart_approvals to guardian_approval. Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
Add snapshot coverage for reused guardian review sessions so follow-up requests show a stable prompt-cache key without retaining prior guardian output. Co-authored-by: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9859060066
ℹ️ 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".
Reuse the cached guardian child only when the full effective review-session config matches the next review, so provider and backend changes force a respawn. Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Keep follow-up guardian approvals on the same child conversation instead of clearing history between reviews, and update the snapshot to show the appended prior review context. Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
Co-authored-by: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 418b3a9cd4
ℹ️ 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".
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b95cea921
ℹ️ 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".
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0a6417815
ℹ️ 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".
Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9822da0541
ℹ️ 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".
Co-authored-by: Codex <noreply@openai.com>
|
@codex review this |
Summary
smart_approvals->guardian_approvalfeature flag rename in the same PR to minimize release latency on a very tight timelineRequest