fix: [codex-harness] parse Desktop app-server user agents#64666
Conversation
Greptile SummaryThis PR fixes a version-parsing bug in Confidence Score: 5/5Safe to merge — minimal, targeted regex fix with comprehensive tests for both the new positive case and new negative edge cases. All findings are P2 or lower. The regex change is correct, backward-compatible, and more spec-compliant than the old version. New tests cover the fixed case and the previously unguarded boundary condition. No files require special attention. Reviews (1): Last reviewed commit: "Codex: parse Desktop app-server user age..." | Re-trigger Greptile |
|
Not a direct match, but possibly related. I filed #64744 for a silent hang in the same codex harness Symptoms are adjacent but different:
Both point at the same underlying fragility: Your fix (correcting the parser) resolves one concrete cause. A companion change that also passes a bounded In my case I've verified the underlying handshake works: manual Details + full repro in #64744. |
7e60ec4 to
7cfbef4
Compare
7cfbef4 to
751b4d3
Compare
751b4d3 to
08a99b9
Compare
|
Landed via temp rebase onto main.
Thanks @cyrusaf! |
Summary
Codex Desktop/0.118.0 (...).0.118.0minimum version gate is unchanged. CLI-shaped user agents still parse, and missing or malformed versions still fail closed.Context
Codex app-server reports its version in the leading user-agent product field:
<originator>/<codex-version> ....When OpenClaw spawns the app-server from a normal CLI-style environment, the originator can be a no-whitespace token such as
openclaw, which matched the existing parser and tests. When OpenClaw runs from a Codex Desktop-originated environment, it inheritsCODEX_INTERNAL_ORIGINATOR_OVERRIDE=Codex Desktop; the same app-server then reports a leading product likeCodex Desktop/0.118.0 (...).That Desktop originator is valid for the app-server, but OpenClaw treated it as unknown because the parser rejected whitespace before
/.Root Cause
readCodexVersionFromUserAgent()required the product/originator before/to match a no-whitespace token. That madeCodex Desktop/0.118.0returnundefined, which tripped the compatibility diagnostic even though the version itself satisfied the minimum.The fix parses the leading slash-delimited semver while allowing spaces in the originator. It still requires a semver-like version and a clean delimiter/end boundary after the version.
Testing
pnpm test extensions/codex/src/app-server/client.test.tspnpm test extensions/codex/src/app-server/shared-client.test.ts extensions/codex/src/app-server/models.test.ts extensions/codex/src/app-server/transport-websocket.test.tspnpm checkviascripts/committerManual Verification
CODEX_INTERNAL_ORIGINATOR_OVERRIDE=Codex Desktop, a real localcodex app-server --listen stdio://initialize response returnedCodex Desktop/0.118.0 (Mac OS 26.4.0; arm64) dumb (openclaw; e2e-local).listCodexAppServerModels()returned models.Security / Compatibility
No new permissions, token handling, network calls, command execution surface, config/env changes, or migration. Backward compatible.