Skip to content

Track app-server running turns incrementally - #49084

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/e7d7ebb33b9ff4d24dc70d8f01ae981378fed5f8
Sep 28, 2026
Merged

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

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Track app-server running turns incrementally

Why

Every thread state mutation scanned all tracked runtimes to recount running turns while holding the state lock. This count supports graceful restart draining introduced in #12517.

What changed

Maintain running_turn_count in ThreadWatchState, adjusting it when a runtime's running flag changes or a running thread is removed. Publish the cached count while preserving notifications only when the count changes.

Testing

Extend the running-turn watch test to cover duplicate starts, two simultaneous running threads, and removal of a running thread, with counts checked against the runtime map.

## Why

Every thread state mutation scanned all tracked runtimes to recount running turns while holding the state lock. This count supports graceful restart draining introduced in #12517.

## What changed

Maintain `running_turn_count` in `ThreadWatchState`, adjusting it when a runtime's `running` flag changes or a running thread is removed. Publish the cached count while preserving notifications only when the count changes.

## Testing

Extend the running-turn watch test to cover duplicate starts, two simultaneous running threads, and removal of a running thread, with counts checked against the runtime map.

GitOrigin-RevId: e7d7ebb33b9ff4d24dc70d8f01ae981378fed5f8
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/e7d7ebb33b9ff4d24dc70d8f01ae981378fed5f8 branch from 86bad91 to 88e9a83 Compare September 28, 2026 21:33
@copyberry
copyberry Bot merged commit 88e9a83 into main Sep 28, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/e7d7ebb33b9ff4d24dc70d8f01ae981378fed5f8 branch September 28, 2026 21:33
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 28, 2026

This branch was previously deployed

1 inactive deployment
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.

5 participants