t4925: Model-level backoff in headless-runtime-helper.sh#4927
t4925: Model-level backoff in headless-runtime-helper.sh#4927alex-solovyev merged 1 commit intomainfrom
Conversation
Change backoff granularity from provider-level to model-level so that rate-limiting one model (e.g. claude-sonnet) doesn't block other models from the same provider (e.g. claude-opus). Auth errors still back off at provider level since credentials are shared. Key changes: - record_provider_backoff() accepts model param, keys on model for rate_limit/provider_error, on provider for auth_error - New model_backoff_active() checks both model-level and provider-level - choose_model() uses model_backoff_active() instead of provider-level - cmd_backoff CLI accepts both model IDs and provider names - Fix file_mtime() stat order (Linux stat -f returns filesystem info) - Tests: set AIDEVOPS_HEADLESS_MODELS for self-contained runs, disable sandbox (strips STUB_* env vars), add 4 model-level backoff tests Closes #4925
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Caution Review failedPull request was closed or merged during review WalkthroughRefactored backoff mechanism from provider-level to model-level granularity. Models from the same provider now have independent rate-limit backoffs, while auth errors still trigger provider-wide blocks. Added model-level backoff check function and updated storage to use model keys instead of provider keys. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sun Mar 15 03:38:17 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|



Summary
claude-sonnet) doesn't block other models from the same provider (e.g.claude-opus)file_mtime()stat order bug on Linux that caused auth signatures to change between calls, silently clearing backoff stateChanges
headless-runtime-helper.shrecord_provider_backoff(): New 4th parammodel. Forauth_error, keys on provider name. Forrate_limit/provider_error, keys on full model ID (e.g.anthropic/claude-sonnet-4-6)backoff_active_for_key(): New internal function that checks a specific backoff key against the DBmodel_backoff_active(): New function that checks both model-level backoff (rate limits) and provider-level backoff (auth errors)choose_model(): Usesmodel_backoff_active()instead ofprovider_backoff_active()— checks per-model, not per-providercmd_backoffCLI: Accepts both model IDs (anthropic/claude-sonnet-4-6) and provider names (anthropic)cmd_run(): Passes full model ID torecord_provider_backoff()file_mtime(): Fix stat order — trystat -c '%Y'(Linux) beforestat -f '%m'(macOS). On Linux,stat -f '%m'returns filesystem free blocks, not file mtimeAIDEVOPS_HEADLESS_SANDBOX_DISABLED=1env var to skip sandbox (needed for tests)tests/test-headless-runtime-helper.shAIDEVOPS_HEADLESS_MODELSexplicitly for self-contained test runsAIDEVOPS_HEADLESS_SANDBOX_DISABLED=1(sandbox stripsSTUB_*env vars)Before/After
Before:
AIDEVOPS_HEADLESS_MODELS="anthropic/claude-sonnet-4-6,anthropic/claude-opus-4-6"— sonnet gets 429 → backoff recorded foranthropic→ opus skipped → worker failsAfter: sonnet gets 429 → backoff recorded for
anthropic/claude-sonnet-4-6→ opus checked separately → opus selected → worker runsCloses #4925
Summary by CodeRabbit
Release Notes