Skip to content

fix(responses): preserve incomplete terminal state - #219

Open
gruffwy wants to merge 3 commits into
caigee-cmd:mainfrom
gruffwy:fix/responses-incomplete-terminal-state
Open

gruffwy wants to merge 3 commits into
caigee-cmd:mainfrom
gruffwy:fix/responses-incomplete-terminal-state

Conversation

@gruffwy

@gruffwy gruffwy commented Sep 20, 2026

Copy link
Copy Markdown

Problem

Responses requests whose upstream completion ends with finish_reason: length are currently reported as completed and logged as successful. That loses the truncation signal for both API clients and operators.

Behavior

  • Map finish_reason: length to status: incomplete.
  • Include incomplete_details.reason: max_output_tokens.
  • Emit response.incomplete instead of response.completed for streaming responses.
  • Record request logs with an incomplete status.
  • Include incomplete requests in statistics and expose them in the dashboard and request-log filter.
  • Keep success-rate calculation based on fully successful requests.

Tests

  • go test ./internal/gateway ./internal/accounts
  • go test ./internal/store -run '^TestSummarizeRequestLogs$' -count=1
  • GOFLAGS=-buildvcs=false go test ./internal/app -run 'TestImportConstraints|TestDutyBoundaries' -count=1
  • (cd frontend && npm run sync)
  • (cd frontend && npm run lint) — 0 errors; 17 pre-existing warnings
  • git diff --check

Environment notes

The full internal/store package run still hits existing Windows-only environment failures around SQLite temporary-file cleanup and Unix permission-bit expectations; the directly affected statistics test passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant