Messages are not written to codex-tui.log if Codex exits too quickly
What version of Codex is running?
codex-cli 0.21.0
Which model were you using?
oss
What platform is your computer?
Darwin 24.6.0 x86_64 i386
What steps can reproduce the bug?
- Use a fresh environment (no preexisting configuration, ollama is not installed, etc.)
- Install Codex from npm
``bash``
npm i -g @openai/codex@0.21.0
- Tail Codex's log file
``bash``
tail -F ~/.codex/log/codex-tui.log
- Attempt to run codex with the
--ossflag anddebugortracelogging enabled
``bash``
RUST_LOG=trace codex --oss
What is the expected behavior?
A warning log entry should have been written to codex-tui.log.
What do you see instead?
Nothing is written to the log.
Additional information
It appears that probe_server function in codex-rs/ollama/src/client.rs#L79 should either log "Failed to connect to Ollama server..." or "Failed to probe server at...". Neither is written to the log file.
I'm not a Rust programmer, but while investigating this I found this guidance from the tracing-appender crate's documentation:
Note: _guard is a WorkerGuard which is returned by tracing_appender::non_blocking to ensure buffered logs are flushed to their output in the case of abrupt terminations of a process. See WorkerGuard module for more details.
It appears that the guard returned by the non_blocking call in codex/codex-rs/tui/src/lib.rs is assigned to a variable but never used. As a result, buffered log messages are lost when the worker is terminated.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗