Skip to content

Bind permission grants to the originating turn - #49880

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/641502fbfd43553c2c42424d4aaa53ae8020c850
Oct 1, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/641502fbfd43553c2c42424d4aaa53ae8020c850

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Bind permission grants to the originating turn

Why

Background code-mode cells can continue running after a new turn starts. Looking up grants and strict review requirements through the active turn can make those cells lose their approved access or use another turn's permissions.

What changed

  • Keep turn-scoped grants and strict review state in TurnContext, retained by captured steps and background cells.
  • Record permission responses against the requesting turn, including requests made after a later turn starts.
  • Share live session-scoped grants across turns while keeping turn-scoped grants isolated.
  • Use the originating turn's permissions and review requirements for tool execution, patches, MCP calls, file uploads, and terminal input.

Testing

Add regression coverage for background cells retaining grants across turn changes, turn versus session scope, permission requests after the next turn starts, and strict review enabled while write_stdin is queued.

## Why

Background code-mode cells can continue running after a new turn starts. Looking up grants and strict review requirements through the active turn can make those cells lose their approved access or use another turn's permissions.

## What changed

- Keep turn-scoped grants and strict review state in `TurnContext`, retained by captured steps and background cells.
- Record permission responses against the requesting turn, including requests made after a later turn starts.
- Share live session-scoped grants across turns while keeping turn-scoped grants isolated.
- Use the originating turn's permissions and review requirements for tool execution, patches, MCP calls, file uploads, and terminal input.

## Testing

Add regression coverage for background cells retaining grants across turn changes, turn versus session scope, permission requests after the next turn starts, and strict review enabled while `write_stdin` is queued.

GitOrigin-RevId: 641502fbfd43553c2c42424d4aaa53ae8020c850
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/641502fbfd43553c2c42424d4aaa53ae8020c850 branch from e0325fc to 1f52d40 Compare October 1, 2026 05:33
@copyberry
copyberry Bot merged commit 1f52d40 into main Oct 1, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/641502fbfd43553c2c42424d4aaa53ae8020c850 branch October 1, 2026 05:33
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 1, 2026

This branch was previously deployed

1 inactive deployment
issue-triage — 1f52d407 Deployed Oct 1, 2026 by bennyaph1211 via Identify potential duplicates (all issues) #50445
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.