Skip to content

fix: let codex-wake-on-exit hand a flow to a new thread - #533

Merged
scode merged 1 commit into
mainfrom
codex-wake-on-exit-takeover
Nov 19, 2026
Merged

scode merged 1 commit into
mainfrom
codex-wake-on-exit-takeover

Conversation

@scode

@scode scode commented Nov 18, 2026

Copy link
Copy Markdown
Owner

A watcher run can only wake the thread that armed it, because its
callback is queued to that thread ID. The skillette told agents to
retain "an owned live watcher" without saying what owned meant. When a
new thread picked a flow up from its durable log, the helper refused
the old run as foreign and gave it no way forward, so agents checked
the PIDs with ps and kept the old thread's watcher. Its callback then
went to a thread nothing had loaded, and the flow stalled silently. A
baseline eval reproduced this in both trials where the old watcher was
still live.

Ownership is now the manifest's thread ID and nothing else, status
reports on any thread's run, and supersede is the one cross-thread
action: it cancels the old watcher and marks the run as taken. The old
owner's ack and the successor's supersede race for the same exclusive
claim file, because a queued callback does reach an unloaded exec
thread once that thread is resumed, and without the claim both threads
would act on the same run.

The first candidate showed a second problem: a manually resumed old
owner took the flow back from its successor in 2 of 4 trials. A thread
whose run was superseded now asks the user before doing any flow work.
Two threads the user runs on the same flow at the same moment are still
not serialized; the helper can only arbitrate claims on a run, not work
a live thread has already started, so the skillette states that as a
limit.

A watcher run can only wake the thread that armed it, because its
callback is queued to that thread ID. The skillette told agents to
retain "an owned live watcher" without saying what owned meant. When a
new thread picked a flow up from its durable log, the helper refused
the old run as foreign and gave it no way forward, so agents checked
the PIDs with ps and kept the old thread's watcher. Its callback then
went to a thread nothing had loaded, and the flow stalled silently. A
baseline eval reproduced this in both trials where the old watcher was
still live.

Ownership is now the manifest's thread ID and nothing else, status
reports on any thread's run, and supersede is the one cross-thread
action: it cancels the old watcher and marks the run as taken. The old
owner's ack and the successor's supersede race for the same exclusive
claim file, because a queued callback does reach an unloaded exec
thread once that thread is resumed, and without the claim both threads
would act on the same run.

The first candidate showed a second problem: a manually resumed old
owner took the flow back from its successor in 2 of 4 trials. A thread
whose run was superseded now asks the user before doing any flow work.
Two threads the user runs on the same flow at the same moment are still
not serialized; the helper can only arbitrate claims on a run, not work
a live thread has already started, so the skillette states that as a
limit.
@scode
scode marked this pull request as ready for review November 18, 2026 23:55
@scode
scode merged commit 278169f into main Nov 19, 2026
5 checks passed
@scode
scode deleted the codex-wake-on-exit-takeover branch November 19, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant