Skip to content

code-mode: linearize cell terminal state#29286

Merged
cconger merged 2 commits into
mainfrom
cconger/code-mode-runtime-compact-03c-terminal-state
Jun 21, 2026
Merged

code-mode: linearize cell terminal state#29286
cconger merged 2 commits into
mainfrom
cconger/code-mode-runtime-compact-03c-terminal-state

Conversation

@cconger

@cconger cconger commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Introduce a single cell terminal-state machine for completion and termination.
  • Make stored-value commits atomic with the winning terminal outcome.
  • Buffer terminal results for later observation and cover termination-before-commit behavior.

Why

Completion, termination, observation, and stored-value updates must agree on one linearized outcome under cancellation races.

Impact

Terminal delivery becomes deterministic and terminated cells cannot commit state after termination wins.

Validation

  • Focused terminal-state regression passed.
  • Stack-tip validation: just test -p codex-code-mode -p codex-code-mode-protocol (70 passed).
  • Parent branch: cconger/code-mode-runtime-compact-03b-session-runtime.

/// Implementations must honor callback cancellation and must not return from
/// `closed` until the session can no longer route requests to the cell.
/// Implementations should forward callback cancellation to downstream work.
/// The actor stops awaiting callbacks once cancellation begins. Implementations

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not true but I guess covered later?

@cconger
cconger force-pushed the cconger/code-mode-runtime-compact-03b-session-runtime branch from 34b6189 to 5d836cb Compare June 21, 2026 18:00
Base automatically changed from cconger/code-mode-runtime-compact-03b-session-runtime to main June 21, 2026 18:18
@cconger
cconger force-pushed the cconger/code-mode-runtime-compact-03c-terminal-state branch from 82722d4 to 728e1ad Compare June 21, 2026 18:24
@cconger
cconger marked this pull request as ready for review June 21, 2026 18:58
@cconger
cconger merged commit f774455 into main Jun 21, 2026
45 of 47 checks passed
@cconger
cconger deleted the cconger/code-mode-runtime-compact-03c-terminal-state branch June 21, 2026 19:05

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 728e1add33

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

_ = cancellation_token.cancelled(), if !termination => {
termination = true;
yield_timer = None;
drop(command_rx.take());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve queued observers during termination

When terminate() cancels the cell after a begin_wait/observe call has already enqueued an Observe command but before run_cell polls it, this biased cancellation branch runs first and drops command_rx, which drops the queued observer's response sender. That admitted wait then resolves as Closed/missing instead of receiving the same terminal event as the terminator; previously the command queue preserved FIFO ordering between the earlier observe and later terminate. Drain or route already queued observations before closing the receiver.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot locked and limited conversation to collaborators Jun 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants