Skip to content

Enforce single-writer ownership for paginated threads - #34986

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/81d49a2fffc73ba8135752b4944f27feafa4c0d6
Jul 23, 2026
Merged

Enforce single-writer ownership for paginated threads#34986
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/81d49a2fffc73ba8135752b4944f27feafa4c0d6

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 23, 2026

Copy link
Copy Markdown

Enforce single-writer ownership for paginated threads

Why

Only one app-server process should keep a paginated thread open for writing at
a time, while other processes must still be able to read it.

What changed

  • Acquire a per-thread filesystem lock when creating or resuming a paginated
    thread, and retain it for the lifetime of the live recorder.
  • Reject a competing thread/resume request with JSON-RPC error -32600 and
    release ownership when the writer is discarded, deleted, or shut down.
  • Remove stale lock files without disturbing active writers.

Testing

Added coverage for competing processes, ownership transfer after shutdown,
stale-lock cleanup, and lock release during discard and deletion.

## Why

Only one app-server process should keep a paginated thread open for writing at
a time, while other processes must still be able to read it.

## What changed

- Acquire a per-thread filesystem lock when creating or resuming a paginated
  thread, and retain it for the lifetime of the live recorder.
- Reject a competing `thread/resume` request with JSON-RPC error `-32600` and
  release ownership when the writer is discarded, deleted, or shut down.
- Remove stale lock files without disturbing active writers.

## Testing

Added coverage for competing processes, ownership transfer after shutdown,
stale-lock cleanup, and lock release during discard and deletion.

GitOrigin-RevId: 81d49a2fffc73ba8135752b4944f27feafa4c0d6
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/81d49a2fffc73ba8135752b4944f27feafa4c0d6 branch from 38ad864 to 5c94796 Compare July 23, 2026 18:22
@copyberry
copyberry Bot merged commit 5c94796 into main Jul 23, 2026
32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/81d49a2fffc73ba8135752b4944f27feafa4c0d6 branch July 23, 2026 18:24
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 23, 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.

3 participants