fix(codex): fall back to stream items when turn.items is empty - #362
Conversation
Codex app-server can complete a turn with items: [] and itemsView: notLoaded while the assistant text only arrived via item/completed. parseCompletedTurn treated any array turn.items as authoritative, so an empty array dropped the stream-collected messages and failed with PROVIDER_PROTOCOL_ERROR. Prefer non-empty turn.items; otherwise use the collected items. Regression covers the notLoaded empty-array path. Fixes Waishnav#361
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe Codex completed-turn parser now uses streamed items when ChangesCodex turn response handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The parser now preserves streamed assistant responses for unloaded turns, and the regression test verifies successful completion. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit watched the streamers flow Comment |
|
|
Thanks for the clear repro and focused fix — confirmed locally against Codex 0.139.0 and newer. Much appreciated! |
Summary
Codex app-server can finish a turn with
turn.items: []anditemsView: "notLoaded"while the assistant text only arrived onitem/completed(agentMessage).parseCompletedTurntreated any arrayturn.itemsas authoritative, so an empty array discarded the stream-collected items and the run failed withPROVIDER_PROTOCOL_ERROR: Codex did not return a final assistant response.This prefers non-empty
turn.itemsand otherwise uses the items collected from the event stream. I hit this on 1.0.8 with codex-cli 0.139.0 while drivingdevspace agents run codexfor a short smoke prompt;codex execon the same machine was fine, so the drop was in the app-server turn parse path.v1.1.0-beta.4still has the same empty-array preference.Fixes #361
Test plan
pnpm exec tsx --test --test-concurrency=1 src/local-agent-codex.test.tsitem/completedthenturn/completedwithitems: []/itemsView: "notLoaded"→finalResponse === "CODEXOK"Summary by CodeRabbit