core-agent-ide/codex-rs/app-server/tests/suite
Owen Lin ea56186c2b
fix(app-server): set originator header from initialize JSON-RPC request (#8873)
**Motivation**
The `originator` header is important for codex-backend’s Responses API
proxy because it identifies the real end client (codex cli, codex vscode
extension, codex exec, future IDEs) and is used to categorize requests
by client for our enterprise compliance API.

Today the `originator` header is set by either:
- the `CODEX_INTERNAL_ORIGINATOR_OVERRIDE` env var (our VSCode extension
does this)
- calling `set_default_originator()` which sets a global immutable
singleton (`codex exec` does this)

For `codex app-server`, we want the `initialize` JSON-RPC request to set
that header because it is a natural place to do so. Example:
```json
{
  "method": "initialize",
  "id": 0,
  "params": {
    "clientInfo": {
      "name": "codex_vscode",
      "title": "Codex VS Code Extension",
      "version": "0.1.0"
    }
  }
}
```
and when app-server receives that request, it can call
`set_default_originator()`. This is a much more natural interface than
asking third party developers to set an env var.

One hiccup is that `originator()` reads the global singleton and locks
in the value, preventing a later `set_default_originator()` call from
setting it. This would be fine but is brittle, since any codepath that
calls `originator()` before app-server can process an `initialize`
JSON-RPC call would prevent app-server from setting it. This was
actually the case with OTEL initialization which runs on boot, but I
also saw this behavior in certain tests.

Instead, what we now do is:
- [unchanged] If `CODEX_INTERNAL_ORIGINATOR_OVERRIDE` env var is set,
`originator()` would return that value and `set_default_originator()`
with some other value does NOT override it.
- [new] If no env var is set, `originator()` would return the default
value which is `codex_cli_rs` UNTIL `set_default_originator()` is called
once, in which case it is set to the new value and becomes immutable.
Later calls to `set_default_originator()` returns
`SetOriginatorError::AlreadyInitialized`.

**Other notes**
- I updated `codex_core::otel_init::build_provider` to accepts a service
name override, and app-server sends a hardcoded `codex_app_server`
service name to distinguish it from `codex_cli_rs` used by default (e.g.
TUI).

**Next steps**
- Update VSCE to set the proper value for `clientInfo.name` on
`initialize` and drop the `CODEX_INTERNAL_ORIGINATOR_OVERRIDE` env var.
- Delete support for `CODEX_INTERNAL_ORIGINATOR_OVERRIDE` in codex-rs.
2026-01-09 08:17:13 -08:00
..
v2 fix(app-server): set originator header from initialize JSON-RPC request (#8873) 2026-01-09 08:17:13 -08:00
archive_thread.rs chore: unify conversation with thread name (#8830) 2026-01-07 17:04:53 +00:00
auth.rs [chore] move app server tests from chat completion to responses (#8939) 2026-01-08 22:27:55 +00:00
codex_message_processor_flow.rs [chore] move app server tests from chat completion to responses (#8939) 2026-01-08 22:27:55 +00:00
config.rs fix: added test helpers for platform-specific paths (#7954) 2025-12-13 00:14:12 +00:00
create_thread.rs [chore] move app server tests from chat completion to responses (#8939) 2026-01-08 22:27:55 +00:00
fork_thread.rs feat: fork conversation/thread (#8866) 2026-01-08 12:54:20 -08:00
fuzzy_file_search.rs chore: use anyhow::Result for all app-server integration tests (#5836) 2025-10-28 08:10:23 -07:00
interrupt.rs [chore] move app server tests from chat completion to responses (#8939) 2026-01-08 22:27:55 +00:00
list_resume.rs chore: unify conversation with thread name (#8830) 2026-01-07 17:04:53 +00:00
login.rs [chore] move app server tests from chat completion to responses (#8939) 2026-01-08 22:27:55 +00:00
mod.rs feat: fork conversation/thread (#8866) 2026-01-08 12:54:20 -08:00
output_schema.rs feat: expose outputSchema to user_turn/turn_start app_server API (#8377) 2026-01-05 10:27:00 -08:00
send_message.rs [fix] app server flaky send_messages test (#8874) 2026-01-08 20:41:21 +00:00
set_default_model.rs feat: arcticfox in the wild (#6906) 2025-11-19 16:31:06 +00:00
user_agent.rs fix(app-server): set originator header from initialize JSON-RPC request (#8873) 2026-01-09 08:17:13 -08:00
user_info.rs chore: use anyhow::Result for all app-server integration tests (#5836) 2025-10-28 08:10:23 -07:00