Repository navigation
fix(chat): finish with length when a Responses upstream reports incomplete reason "length" - #7392
hedging8563 wants to merge 1 commit into
Conversation
…plete reason "length"
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Ingwannu
left a comment
There was a problem hiding this comment.
The shared truncation vocabulary now recognizes the reported length alias in both SSE and JSON projections while proxy EOF/stall reasons remain failures. Two repository-contract items are missing at this exact head:
- Register tests/chat/incomplete-length-reason.test.ts in BOTH the current layout explicit/domain map and its tests/fixtures/test-layout-expected*.json shard. The complete two-file diff contains neither registration. Regex placement does not replace the explicit expected map.
- Update the mapped Chat/Responses owning contract for this change to accepted incomplete-reason vocabulary and its failure boundary. The complete diff has no structure/documentation update.
Retain the negative EOF/stall/missing-terminal cases, and add an explicit streamed wire assertion if the fixture currently only collects that stream into a buffered completion. Please refresh current-head validation/readiness after the push; do not weaken the test/layout gates.
|
Carried onto current |
Summary
Volcengine Ark Coding Plan
/responsesends a capped turn withstatus: "incomplete",incomplete_details.reason: "length"(OpenAI usesmax_output_tokens).chatCompletionsIncompleteOutcomeandresponsesJsonToChatCompletiononly acceptmax_output_tokensandcontent_filter, so Chat Completions returns502 upstream stream ended early (length)instead of a 200 withfinish_reason: "length". Clients treat the 502 as a dead route and fail over although the provider answered.truncationReasonFor()table (src/responses/truncated-stop-reason.ts, already mapslength,max_tokens, ...) inchatCompletionsIncompleteOutcome.responsesJsonToChatCompletionnow calls that same function instead of its own two-value check.adapter_eof,upstream_stall_timeout,missing_terminal_event) are not in the table and still fail.Repro: POST /v1/chat/completions, model
volcengine-coding-plan/glm-5.3-flash,max_tokens: 16, non-streaming -> 502 before, 200finish_reason: "length"after.Verification (on dev bddd61f, Bun 1.4.3)
tests/chat/incomplete-length-reason.test.ts: 4 tests. Without the fix 3 fail withupstream stream ended early (length); with it all 4 pass.bun test tests/chat tests/server: the same 21 tests fail on unpatched dev and on the patched tree (checked by diffing the fail lists); the patch adds no failures. Those pre-existing failures are in provider-management/account tests, unrelated.tsc --noEmit: clean.bun run test.We run OpenCodex as a shared gateway and hit this through the Volcengine Coding Plan.
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
lengthfinish reason in both streaming and non-streaming chat completions. Content-filter outcomes and other incomplete failures remain unchanged.