Skip to content

fix(providers): preserve prompt cache tokens and salvage terminal streams - #306

Merged
caigee-cmd merged 1 commit into
mainfrom
fix/prompt-cache-and-stream-salvage
Oct 18, 2026
Merged

caigee-cmd merged 1 commit into
mainfrom
fix/prompt-cache-and-stream-salvage

Conversation

@caigee-cmd

Copy link
Copy Markdown
Owner

Summary

Takes the user-facing fixes from #293 onto current main, without the host-specific docker-compose change.

  • Normalize prompt cache token metrics (cache_read_tokens, prompt_cache_hit_tokens, prompt_tokens_details) across Trae, Qoder, and WorkBuddy in both streaming and non-streaming responses.
  • Salvage upstream OpenAI streams that already finished with a terminal finish_reason but omitted literal [DONE], so downstream clients no longer see a fake 502 incomplete stream.
  • Classify Devin expired-session and Connect/seat permission_denied + internal-error shapes as auth, while keeping MCP configuration denials as invalid_request.
  • Surface login_required from in-process probe and pool state when the last error is auth, instead of treating it as cooling.

This is a fresh branch from current main. It does not include the deploy/docker-compose.yml host network from #293.

Test plan

  • go test ./...
  • go vet ./...
  • gofmt -l on the touched Go files
  • python3 scripts/release-notes.py validate
  • Added changelog/unreleased/prompt-cache-and-stream-salvage.md with backticks

…eams

Normalize cache_read_tokens / prompt_cache_hit_tokens / prompt_tokens_details
across Trae, Qoder, and WorkBuddy, and emit [DONE] when an upstream stream
already finished with a terminal finish_reason. Classify Devin expired-session
and Connect auth denials as auth, and surface login_required instead of cooling.
@caigee-cmd
caigee-cmd merged commit c66efa2 into main Oct 18, 2026
6 checks passed
@caigee-cmd
caigee-cmd deleted the fix/prompt-cache-and-stream-salvage branch October 18, 2026 11:32
shenyushun pushed a commit to shenyushun/cli2api that referenced this pull request Oct 19, 2026
The user-facing change landed via caigee-cmd#306 after caigee-cmd#293 could not be merged as-is.
Keep the original contributor on the unreleased note so the next release
credits the work that started in caigee-cmd#293.
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