Skip to content

Conversation

@linw1995
Copy link
Owner

Summary

This PR refactors error handling and request retry logic to reduce code duplication across the codebase.

Changes

  • Extract fail_early! macro in src/combo/starter.rs: Reduces repetitive error handling code that sends failed events and returns early
  • Extract with_retry! macro in both crates/anthropic and crates/openai: Consolidates retry logic with backoff, notification, and error transformation
  • Add convenience helper require_from_env() in src/combo/session.rs: Simplifies session socket client initialization with proper error handling
  • Add ChatMessage constructor methods in crates/openai/src/types.rs: Provides system(), user(), assistant(), and tool_result() static methods for cleaner message creation

@linw1995 linw1995 added the enhancement New feature or request label Jan 29, 2026
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 19.64286% with 90 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.69%. Comparing base (a46f02c) to head (64e1112).
⚠️ Report is 12 commits behind head on dev.

Files with missing lines Patch % Lines
crates/openai/src/client.rs 0.00% 36 Missing ⚠️
crates/openai/src/types.rs 25.00% 30 Missing ⚠️
crates/anthropic/src/client/messages.rs 0.00% 14 Missing ⚠️
src/combo/starter.rs 20.00% 4 Missing ⚠️
src/provider/openai.rs 20.00% 4 Missing ⚠️
src/cmd/prompt.rs 66.66% 1 Missing ⚠️
src/combo/session.rs 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #156      +/-   ##
==========================================
- Coverage   50.22%   47.69%   -2.54%     
==========================================
  Files          93      100       +7     
  Lines       25033    27252    +2219     
==========================================
+ Hits        12574    12999     +425     
- Misses      12459    14253    +1794     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@linw1995 linw1995 merged commit fd33b41 into dev Jan 29, 2026
3 checks passed
@linw1995 linw1995 deleted the refactor/claude-auto branch January 29, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants