code-mode: expose transport-neutral session runtime#29292
Closed
cconger wants to merge 1 commit into
Closed
Conversation
This was referenced Jun 21, 2026
d573397 to
8fe1bf1
Compare
df3758f to
2bbab3a
Compare
8fe1bf1 to
b29a55b
Compare
2bbab3a to
ccffcce
Compare
b29a55b to
e81e125
Compare
ccffcce to
18fb5ed
Compare
jif-oai
approved these changes
Jun 21, 2026
e81e125 to
f3f8aa4
Compare
18fb5ed to
5ff1f52
Compare
f3f8aa4 to
fbf545e
Compare
5ff1f52 to
f3de9a8
Compare
fbf545e to
bf52c09
Compare
f3de9a8 to
7545b94
Compare
7545b94 to
2f2de77
Compare
4a76c0a to
457f6f2
Compare
56dffe9 to
df256e8
Compare
1152f3f to
5df525b
Compare
5baec19 to
b79d2d5
Compare
5df525b to
a6be94f
Compare
b79d2d5 to
f12f4c9
Compare
This was referenced Jun 22, 2026
f12f4c9 to
fb775b6
Compare
a6be94f to
3081aba
Compare
fb775b6 to
1b0c2f7
Compare
3081aba to
098e9f0
Compare
jif-oai
reviewed
Jun 22, 2026
| @@ -53,10 +56,13 @@ pub(super) async fn finish_callbacks( | |||
| ) { | |||
| if matches!(completion, CallbackCompletion::Cancel) { | |||
Collaborator
There was a problem hiding this comment.
Nit: Cancellation can still wedge shutdown if it arrives after we enter DrainNotifications
| if matches!(completion, CallbackCompletion::Cancel) { | ||
| cancellation_token.cancel(); | ||
| finish_cancelled_tasks(notification_tasks, "notification").await; | ||
| finish_cancelled_tasks(tool_tasks, "tool").await; |
Collaborator
There was a problem hiding this comment.
Could we make those 2 wait concurrent or share one deadline? Sounds odd to run them serially... mainly in a tokio runtime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
An out-of-process code-mode host needs the same transport-neutral runtime used by the in-process adapter, without depending on actor internals. Cancellation also must not let a non-cooperative callback wedge cell termination or session shutdown indefinitely.
What
SessionRuntime, its request/event types, cell capability types, and delegate contract as public crate API.ObserveOutcomeandTerminateOutcometypes from code-mode: expose create and observe operations #29291 do not change here.cell_closeddelegate callback from both runtime and session delegate surfaces at this layer.Host/Core callback sequence
sequenceDiagram participant Host as SessionRuntime host participant Core as Core delegate alt nested tool callback Host->>Core: invoke_tool(NestedToolCall, CancellationToken) Core-->>Host: Result<JsonValue, String> else notification callback Host->>Core: notify(call_id, CellId, text, CancellationToken) Core-->>Host: Result<(), String> end opt cell/session cancellation Host-->>Core: CancellationToken is canceled Host->>Host: wait up to 100 ms Host->>Host: abort unfinished callback task end Note over Host,Core: cell_closed is absent in this commitStack boundary
Removing
cell_closedis intentional here: actor shutdown is not the terminal-state signal Core needs. #29310 reintroduces it with precise semantics—once the terminal outcome is committed, even if its result remains buffered.Validation
just test -p codex-code-modejust test -p codex-code-mode-protocolStack parent: #29397.