Skip to content

fix(workbuddy): stream TTFB timeout failover (from #336) - #385

Merged
caigee-cmd merged 1 commit into
mainfrom
fix/pr-336-workbuddy-ttfb
Oct 24, 2026
Merged

caigee-cmd merged 1 commit into
mainfrom
fix/pr-336-workbuddy-ttfb

Conversation

@caigee-cmd

Copy link
Copy Markdown
Owner

Summary

Extracts the WorkBuddy stream first-byte timeout failover from external PR #336 into a standalone change.

  • Adds WORKBUDDY_STREAM_TTFB_MS (default aligned with Qoder’s ErrFirstByteTimeout pattern).
  • Wraps the existing sendChat path with doWithFirstByteTimeout so the 401 token-refresh behavior is preserved (the original PR rewrite of client.go would have dropped it).
  • Failover only when the stream head never arrives; mid-stream stalls stay on the existing read path.

Test plan

  • go test ./internal/providers/workbuddy/... (ttfb unit tests)
  • Manual: stream that never sends first byte → account fails over

Supersedes the WorkBuddy portion of #336. Do not merge #336 as-is.

Port WORKBUDDY_STREAM_TTFB_MS from #336, but wire doWithFirstByteTimeout
inside the existing sendChat 401-refresh loop instead of replacing it.

The author's branch removed sendChat entirely; that would regress token
refresh / TLS classify / KindUnavailable handling that landed on main
after the PR branched.
@caigee-cmd
caigee-cmd merged commit 276705c into main Oct 24, 2026
6 checks passed
fengye102 pushed a commit to fengye102/cli2api that referenced this pull request Oct 24, 2026
Record attribution for the Usage Cost tab, WorkBuddy TTFB failover, and
configurable log retention that landed via caigee-cmd#385–caigee-cmd#387.

Co-authored-by: YAN <[email protected]>
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