core-agent-ide/codex-rs/otel/src
Owen Lin 6ea041032b
fix(core): prevent hanging turn/start due to websocket warming issues (#14838)
## Description

This PR fixes a bad first-turn failure mode in app-server when the
startup websocket prewarm hangs. Before this change, `initialize ->
thread/start -> turn/start` could sit behind the prewarm for up to five
minutes, so the client would not see `turn/started`, and even
`turn/interrupt` would block because the turn had not actually started
yet.

Now, we:
- set a (configurable) timeout of 15s for websocket startup time,
exposed as `websocket_startup_timeout_ms` in config.toml
- `turn/started` is sent immediately on `turn/start` even if the
websocket is still connecting
- `turn/interrupt` can be used to cancel a turn that is still waiting on
the websocket warmup
- the turn task will wait for the full 15s websocket warming timeout
before falling back

## Why

The old behavior made app-server feel stuck at exactly the moment the
client expects turn lifecycle events to start flowing. That was
especially painful for external clients, because from their point of
view the server had accepted the request but then went silent for
minutes.

## Configuring the websocket startup timeout
Can set it in config.toml like this:
```
[model_providers.openai]
supports_websockets = true
websocket_connect_timeout_ms = 15000
```
2026-03-17 10:07:46 -07:00
..
events Apply argument comment lint across codex-rs (#14652) 2026-03-16 16:48:15 -07:00
metrics fix(core): prevent hanging turn/start due to websocket warming issues (#14838) 2026-03-17 10:07:46 -07:00
config.rs feat: show runtime metrics in console (#10278) 2026-01-30 22:20:02 -08:00
lib.rs fix(otel): make HTTP trace export survive app-server runtimes (#14300) 2026-03-11 12:33:10 -07:00
otlp.rs fix(otel): make HTTP trace export survive app-server runtimes (#14300) 2026-03-11 12:33:10 -07:00
provider.rs fix(otel): make HTTP trace export survive app-server runtimes (#14300) 2026-03-11 12:33:10 -07:00
targets.rs chore(otel): reorganize codex-otel crate (#13800) 2026-03-06 14:58:18 -08:00
trace_context.rs fix(otel): make HTTP trace export survive app-server runtimes (#14300) 2026-03-11 12:33:10 -07:00