Fix Codex RPC timeout classification - #3022
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 17, 2026, 6:34 PM ET / 22:34 UTC. ClawSweeper reviewWhat this changesThe PR makes the Codex app-server timeout win before subprocess termination can turn the response stream closure into a malformed-response error. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain Keep open: the focused patch is source-plausible and current main still has the pre-termination timeout race, but this external PR still needs inspectable after-fix runtime proof before merge. Priority: P2 Review scores
Verification
How this fits togetherCodexBar launches the Codex app-server subprocess and reads JSON-RPC replies from stdout to refresh provider usage. Each request races a response reader against a deadline, then returns usage data or a classified provider error. flowchart LR
A[Usage refresh] --> B[Codex app-server subprocess]
B --> C[JSON-RPC stdout reply]
C --> D{Reply or deadline}
D -->|Reply| E[Decode usage]
D -->|Deadline| F[Terminate subprocess]
E --> G[Provider result]
F --> G
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the timer-first classification, add a deterministic ordering regression if feasible, and retain a redacted spawned-process runtime trace as merge evidence. Do we have a high-confidence way to reproduce the issue? No live reproduction was supplied, but source inspection and the existing spawned-process hanging-RPC test define a high-confidence source-level reproduction path. Is this the best way to solve the issue? Yes: choosing the timer result before stdout-owning process teardown is the narrowest maintainable repair for the stated race, subject to after-fix runtime proof. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f7723d33a169. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Thanks @Chipagosfinest! This landed via #3025, which carried your commits onto current main and fixed the stale architecture-gatekeeper anchors that were failing CI (your diff was fine — the base predated recent churn in UsageFetcher.swift). The changelog credits you. |
What changed
Classify a Codex app-server request as timed out before terminating the subprocess that owns stdout.
Why
The previous timeout task terminated the process and then threw. Closing stdout could wake the request body first, causing the same timeout to escape as a misleading EOF/malformed-response error. Selecting the timer result before process termination makes the reported failure deterministic.
Scope
Verification
swift test --filter CodexUsageFetcherFallbackTests— 13 tests passed, including the real spawned-process hung RPC casesmake check— passed with zero SwiftFormat or SwiftLint violationsSupersedes the timeout portion of #2759.