app-server: support daemon-safe restart handling#21831
Conversation
owenlin0
left a comment
There was a problem hiding this comment.
one of the things we'll have to figure out with the app-server singleton is to not make originator process-global 😅
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8620c103e
ℹ️ 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".
| } | ||
| let originator = name.clone(); | ||
| let user_agent_suffix = format!("{name}; {version}"); | ||
| let mutates_global_identity = name != DAEMON_PROBE_CLIENT_NAME; |
There was a problem hiding this comment.
Do not trust clientInfo to identify daemon probes
Any client controls clientInfo.name, so a websocket/unix client can initialize as codex_app_server_daemon and avoid setting the process originator/user-agent suffix. If no real client has initialized yet, later backend calls use the default codex_cli_rs identity instead of the actual client identity, defeating the new attribution behavior for non-probe clients.
Useful? React with 👍 / 👎.
Why
The app-server daemon work needs two app-server behaviors to be safe when lifecycle management is driven by a helper process:
What changed
codex_app_server_daemoninitialization as a probe-only client for process-global originator and user-agent suffix state.SIGHUPas graceful-only while leavingSIGTERMand Ctrl-C forceable.SIGHUPdelivery while a turn is still running.Testing
cargo test -p codex-app-serverSIGHUPcoverage passed.suite::conversation_summary::get_conversation_summary_by_relative_rollout_path_resolves_from_codex_homeandsuite::conversation_summary::get_conversation_summary_by_thread_id_reads_rollouttests because their initialize handshake timed out.cargo test -p codex-app-server --test all suite::conversation_summary::