Skip to content

Add session-scoped stores for stable model-facing IDs - #61339

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/2668f605251ca76d4891f70f94bfb4151ba8142c
Nov 13, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/2668f605251ca76d4891f70f94bfb4151ba8142c

Conversation

@copyberry

@copyberry copyberry Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Add session-scoped stores for stable model-facing IDs

What changed

  • Add SessionModelIdStore with SQLite and in-memory implementations for looking up and assigning aliases by session, namespace, and external key.
  • Commit SQLite assignments before returning them, and recheck under a write transaction so concurrent writers reuse the same alias.
  • Support snapshotting and initializing alias maps from generator state and ordered keys, and remove mappings when their thread is deleted.
  • Expose alias stores through ThreadStore and add distinct types for registered environment IDs and model-facing env aliases.

Testing

Add a test using two SQLite runtime instances to verify that concurrent assignments return the same alias, different keys receive different aliases, and lookups and snapshots preserve the assignments.

## What changed

- Add `SessionModelIdStore` with SQLite and in-memory implementations for looking up and assigning aliases by session, namespace, and external key.
- Commit SQLite assignments before returning them, and recheck under a write transaction so concurrent writers reuse the same alias.
- Support snapshotting and initializing alias maps from generator state and ordered keys, and remove mappings when their thread is deleted.
- Expose alias stores through `ThreadStore` and add distinct types for registered environment IDs and model-facing `env` aliases.

## Testing

Add a test using two SQLite runtime instances to verify that concurrent assignments return the same alias, different keys receive different aliases, and lookups and snapshots preserve the assignments.

GitOrigin-RevId: 2668f605251ca76d4891f70f94bfb4151ba8142c
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/2668f605251ca76d4891f70f94bfb4151ba8142c branch from d0cc277 to a4b69a0 Compare November 13, 2026 18:44
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor
Codex Review Summary: 🔄 Running

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-11-13T18:44:22.980800Z d0cc277 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit a4b69a0 into main Nov 13, 2026
9 of 23 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/2668f605251ca76d4891f70f94bfb4151ba8142c branch November 13, 2026 18:44
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 13, 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