[codex] implement standalone code-mode process host - #30111
Conversation
93c2ba5 to
9dcaccb
Compare
9882678 to
ed321a2
Compare
9dcaccb to
b6b8769
Compare
ed321a2 to
829922a
Compare
f5b2e7e to
a5d75bf
Compare
jif-oai
left a comment
There was a problem hiding this comment.
Approving because this has no production impact for now but once this is fully wired we will have to hunt races and any other fancy rough edges. I can help with this
| } | ||
| match request { | ||
| HostRequest::OpenSession { session_id } => { | ||
| let result = self |
There was a problem hiding this comment.
We commit the session before knowing SessionReady fits on the wire.
This is nit but a near-frame-limit session ID can make the request fit but the response overflow, leaving an open session behind after the client receives an error
There was a problem hiding this comment.
Agree this is a gap, but certainly pathological.
| peer.fail(reason); | ||
| } | ||
| }); | ||
| sessions.insert( |
There was a problem hiding this comment.
We bound requests, cells, and delegate calls, but not active sessions...
There was a problem hiding this comment.
sessions does have some memory pressure through saved values, but otherwise pretty lightweight.
I feel like session load matches thread load state pretty closely but can think about what guarantees we would want to enforce here.
| self.respond(request_id, result); | ||
| } | ||
| HostRequest::ShutdownSession { session_id } => { | ||
| let session = self |
There was a problem hiding this comment.
nit race: This releases the session ID before shutdown and cell-route draining finish
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5d75bfdc0
ℹ️ 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".
| peer.fail("timed out shutting down code-mode host state".to_string()); | ||
| } | ||
| drop(state); | ||
| let failure = peer.failure(); |
There was a problem hiding this comment.
Preserve writer failures observed during shutdown
When shutdown begins while the writer task is still inside write_frame, any broken-pipe/error that the writer supervisor records after this snapshot is lost because failure is read before awaiting writer_supervisor. In that transport-failure race, run can return Ok(()) even though the host failed to write a queued frame; read peer.failure() after the supervisor has finished instead of before dropping the last local peer handle.
Useful? React with 👍 / 👎.
a5d75bf to
a1c7a73
Compare
Summary
codex-code-mode-hoststdio serviceWhy
This stage makes the host process independently runnable and reviewable before exposing any remote client in Codex. Transport or runtime failure closes the connection and relies on process replacement rather than transactional recovery.
Stack
This is 3 of 4 in the process-owned code-mode session stack.
Validation
just test -p codex-code-mode-host— 7 host-only tests passedjust fix -p codex-code-mode-hostjust bazel-lock-updatejust bazel-lock-checkjust fmt