Repository navigation
fix(step-3.7-flash): stretch retry envelope to weather StepFun 10 RPM cap - #3497
Conversation
Adds the step-3.7-flash model to resolve_model_config.py per ADDINGMODEL.md. - Adds step-3.7-flash to MODELS dictionary - Adds test_step_3_7_flash_config() test function Fixes #3476 Co-authored-by: openhands <openhands@all-hands.dev>
Add an explicit pre-flight check, with decision matrices, for verifying vision (multimodal input) and reasoning (reasoning_effort / extended thinking) support when registering a new model. The new section makes it clear that: - Vision is gated on LiteLLM's supports_vision() metadata; if the model is multimodal per provider docs but LiteLLM is not yet aware, the vision integration test will skip (not fail) until LiteLLM is updated upstream. disable_vision: True should NOT be added in that case. - reasoning_effort is auto-detected from LiteLLM's supported params; setting it without LiteLLM support is a no-op because drop_params=True strips it. Anthropic-style extended thinking is handled via EXTENDED_THINKING_MODELS in model_features.py. Triggered by review feedback on PR #3477 (step-3.7-flash): step-3.7-flash supports both vision and reasoning per StepFun/OpenRouter docs, but LiteLLM has not mapped the model yet, so the SDK skips the vision and Anthropic-thinking-block tests rather than failing them. Co-authored-by: openhands <openhands@all-hands.dev>
…_body
Step 3.7 Flash exposes selectable reasoning levels (high/medium/low) via
OpenRouter, but LiteLLM does not yet expose 'reasoning_effort' as a
supported OpenAI param for 'openrouter/stepfun/step-3.7-flash'. So
pinning the top-level 'reasoning_effort' field would be dropped by
drop_params=True before send.
Use litellm_extra_body to forward OpenRouter's native reasoning block
{'reasoning': {'effort': 'high'}} to the provider directly. Same pattern
as qwen3-max-thinking, which forwards {'enable_thinking': True}.
Also update ADDINGMODEL.md so the 'Vision and Reasoning Capability
Check' decision matrix documents this passthrough fallback, and update
the test_step_3_7_flash_config assertion accordingly.
Vision is still gated on LiteLLM / proxy 'supports_vision' metadata and
cannot be force-enabled from llm_config (no opt-in flag exists; only
disable_vision to opt out), so it's left to upstream LiteLLM / proxy
updates.
Co-authored-by: openhands <openhands@all-hands.dev>
The eval LiteLLM proxy registers this model as 'step-3.7-flash' (short
alias), routing to openai/step-3.7-flash at api.stepfun.ai/v1, with
model_info.supports_vision=true already configured infra-side.
Our previous config used 'litellm_proxy/openrouter/stepfun/step-3.7-flash'.
This worked for request routing (proxy pass-through), but the SDK's
_get_model_info_from_litellm_proxy does an exact string match on
model_name == model.removeprefix('litellm_proxy/'), so it looked for
'openrouter/stepfun/step-3.7-flash' in /v1/model/info, missed the
registry entry, and fell back to LiteLLM's static metadata
(supports_vision=false). Result: vision_is_active() returned False and
the t08_image_file_viewing integration test was skipped.
Also remove the previously-added litellm_extra_body
{'reasoning': {'effort': 'high'}}: that was the OpenRouter native
reasoning block, which doesn't apply now that we're routing via
openai/... to StepFun's native API. Empirical evidence: with that opt-in,
completion tokens dropped 175k -> 85k and one behavior test regressed,
suggesting the param wasn't honored and may have perturbed behavior.
Update ADDINGMODEL.md's Vision and Reasoning Capability Check section to
document the proxy model_name alignment gotcha (the SDK's exact-string
lookup against the proxy registry) and to caution that
reasoning-passthrough keys must match the upstream the proxy actually
routes to (openai/ vs openrouter/), not just the provider's branding.
Co-authored-by: openhands <openhands@all-hands.dev>
… cap The eval-monitor shows 0% Critic 1 Acceptance for every recent step-3.7-flash run (swebench test/full, swtbench full): all instances land in output_errors.jsonl, output.jsonl stays empty, so acceptance = output / critic1 = 0%. Datadog logs from the eval-agent-server pods are saturated with: litellm.RateLimitError: Error code: 429 - OpenAIException - request limited RPM reached, current: 11, limit: 10. StepFun's current API tier caps step-3.7-flash at 10 RPM. The eval runs many instances in parallel, every step hits the same RPM bucket, and the SDK's default retry envelope (5 attempts, ~3 min total: 8/16/32/64/64s) exhausts before the bucket resets. Every conversation eventually raises LLMRateLimitError and gets recorded as an error. Bump num_retries / retry_min_wait / retry_max_wait on the step-3.7-flash entry so the SDK retry loop can outlast a fully-saturated 60s bucket. This is a config-only change in the eval-resolver dict; these are first-class fields on LLM (see openhands-sdk/openhands/sdk/llm/llm.py). Closes #3496. Co-authored-by: openhands <openhands@all-hands.dev>
Python API breakage checks — ✅ PASSEDResult: ✅ PASSED |
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
Code Review
Taste Rating
🟢 Good taste — Clean, focused fix addressing a real operational problem.
Analysis
This PR solves a genuine production issue: parallel inference with step-3.7-flash exhausts the SDK's default retry budget (5 attempts, ~3 min total) before StepFun's 60s rate-limit bucket resets under the 10 RPM cap.
What's done well:
-
Exact
model_namematching — The config useslitellm_proxy/step-3.7-flash(proxy's registered alias) rather than the longerlitellm_proxy/openrouter/stepfun/step-3.7-flashform. This ensures_get_model_info_from_litellm_proxymatches the registry entry and picks upsupports_vision=true. The documentation update explains this critical detail clearly. -
Appropriate retry envelope — Bumping from defaults (5/8/64) to (12/30/120) provides enough headroom to outlast a fully-saturated 60s bucket under parallel load. The specific values are justified and documented.
-
Comprehensive documentation — The ADDINGMODEL.md update adds decision matrices for vision and reasoning capability detection. While the examples use StepFun, the patterns are generalizable and teach the methodology.
-
Flexible test assertions — Tests use
>=thresholds rather than exact values, allowing for future tuning without test updates. -
No breaking changes — Only adds a new model entry; no existing functionality modified.
Minor Note
The 60-line documentation addition is detailed but specific to the vision/reasoning capability workflow. Consider whether this guidance belongs in ADDINGMODEL.md or a separate runbook (e.g., run-eval/CAPABILITY_CHECKLIST.md) to keep ADDINGMODEL.md focused on the model entry schema.
[RISK ASSESSMENT]
- Overall PR:
⚠️ Risk Assessment: 🟢 LOW - Adding new model configuration only; no changes to existing functionality or shared code paths.
- Well-documented with production justification linked.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
all-hands-bot
left a comment
There was a problem hiding this comment.
🟡 QA Report: PARTIAL
The eval resolver now accepts step-3.7-flash, reaches the LiteLLM proxy, and emits the intended alias plus 12/30/120 retry envelope; I did not run a full saturated eval.
Does this PR achieve its stated goal?
Partially verified. The PR achieves the concrete config-resolution behavior needed by Run Eval: on the base branch, MODEL_IDS=step-3.7-flash fails as an unknown model, while on this PR branch the same command resolves the model, performs a real proxy preflight successfully, and writes models_json with litellm_proxy/step-3.7-flash, num_retries: 12, retry_min_wait: 30, and retry_max_wait: 120. I could not verify the full production claim that this survives a saturated StepFun 10 RPM bucket without launching an external eval run and consuming shared LLM/provider capacity.
| Phase | Result |
|---|---|
| Environment Setup | ✅ make build completed successfully and created the project .venv. |
| CI Status | 🟡 Run Tests checks observed passing; several Agent Server build/push jobs were still in progress when checked. |
| Functional Verification | ✅ Resolver before/after path works and performs a real LLM proxy preflight; saturated eval behavior not exercised. |
Functional Verification
Test 1: Run Eval model resolver before/after for step-3.7-flash
Step 1 — Reproduce / establish baseline without the fix:
Checked out origin/main and ran:
MODEL_IDS=step-3.7-flash GITHUB_OUTPUT=/tmp/resolve_base.out uv run python .github/run-eval/resolve_model_config.pyObserved:
rc=1
ERROR: Model ID 'step-3.7-flash' not found. Available models: claude-4.5-opus, claude-4.6-opus, claude-opus-4-7, ...
This confirms the base branch cannot run the eval resolver for the affected model ID at all.
Step 2 — Apply the PR's changes:
Switched back to PR head 7468b3f4a760b1d1424eb1918ec9bec837e7f1b5 on fix/step-3-7-flash-rpm-retry-envelope.
Step 3 — Re-run with the fix in place:
Ran the same resolver command:
MODEL_IDS=step-3.7-flash GITHUB_OUTPUT=/tmp/resolve_head.out uv run python .github/run-eval/resolve_model_config.pyObserved:
rc=0
Resolved 1 model(s): step-3.7-flash
Checking proxy connectivity: https://llm-proxy.app.all-hands.dev
✓ Proxy reachable at https://llm-proxy.app.all-hands.dev
Preflight LLM check for 1 model(s)...
--------------------------------------------------
Checking Step 3.7 Flash... (6.0s)
✓ Step 3.7 Flash: OK
--------------------------------------------------
✓ All 1 model(s) passed preflight check
models_json=[{"id":"step-3.7-flash","display_name":"Step 3.7 Flash","llm_config":{"model":"litellm_proxy/step-3.7-flash","temperature":0.0,"num_retries":12,"retry_min_wait":30,"retry_max_wait":120}}]
This shows the actual resolver path a Run Eval workflow uses now accepts the model, performs a real proxy-backed preflight successfully, and emits the claimed retry envelope and proxy alias.
Unable to Verify
I did not trigger a full swebench/swtbench eval or intentionally saturate StepFun's shared 10 RPM bucket. That would consume external eval/LLM resources and can take substantially longer than local QA. As a result, I verified the config passed to the runtime, but not the downstream acceptance-rate improvement under real parallel load. Future QA guidance in AGENTS.md could specify when reviewers are authorized to launch a small eval run, which benchmark/input size to use, and what resource limits are acceptable.
Issues Found
None.
This review was generated by an AI agent (OpenHands) on behalf of the user.
|
@OpenHands fix pre commit checks |
|
I'm on it! juanmichelini can track my progress at all-hands.dev |
Co-authored-by: openhands <openhands@all-hands.dev>
|
OpenHands encountered an error: **Failed to send message to agent server: HTTP 503 error: no available server See the conversation for more information. |
… cap (OpenHands#3497) Co-authored-by: openhands <openhands@all-hands.dev>
Closes #3496.
Why
The OpenHands Eval Monitor shows 0% Critic 1 Acceptance for every recent
litellm_proxy/step-3.7-flashrun — e.g. swebench run26911702062. Therun-infer-progress.txtfor that run readsoutput, critic1, critic2, critic3 = 0, 5, 0, 0: all 5 instances completed in critic_attempt_1 but went tooutput_errors.jsonl, sooutput.jsonlis empty and acceptance =output / critic1 = 0%. The sameoutput=0pattern was visible across the parallel swebench-full and swtbench-full step-3.7-flash runs.Datadog logs from the runtime pods (
service:eval-agent-server,image_tag:b0fedcd*,@levelname:ERROR) are saturated with the same exception:StepFun's current API tier caps
step-3.7-flashat 10 RPM. The eval runs many instances in parallel, every step hammers the same RPM bucket, and the SDK's default retry envelope —num_retries=5,retry_min_wait=8,retry_max_wait=64, exponential backoff, ~3 min total — exhausts long before the bucket resets. Every conversation eventually raisesLLMRateLimitError, which is recorded as an error.What
Config-only change in
.github/run-eval/resolve_model_config.py: bump the retry envelope on thestep-3.7-flashentry so the SDK retry loop can outlast a fully-saturated 60 s bucket.num_retriesretry_min_wait(s)retry_max_wait(s)num_retries,retry_min_wait, andretry_max_waitare already first-class fields onLLM(seeopenhands-sdk/openhands/sdk/llm/llm.py), so no SDK code changes are needed.The
test_step_3_7_flash_configtest intests/cross/test_resolve_model_config.pywas updated with lower-bound assertions (≥10 / ≥15 / ≥90) so the retry envelope can't silently regress to defaults.Verification
To verify end-to-end, kick off a
swebenchRun Eval workflow withmodel_ids=step-3.7-flashandeval_limit=5;output.jsonlshould grow in lockstep withoutput.critic_attempt_1.jsonlinstead of staying at 0.Out of scope
This is the cheapest fix that doesn't require infra changes. Longer-term we should also: (a) top up the StepFun tier so the model has realistic headroom, (b) add per-model concurrency limits in the eval harness so we don't oversubscribe RPM-constrained providers, and (c) have the LiteLLM proxy forward upstream
Retry-Afterheaders. Those are tracked in #3496.This PR was opened by an AI agent (OpenHands) on behalf of @juanmichelini.
@juanmichelini can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.13-nodejs22-slimgolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:c9cbd0b-pythonRun
All tags pushed for this build
About Multi-Architecture Support
c9cbd0b-python) is a multi-arch manifest supporting both amd64 and arm64c9cbd0b-python-amd64) are also available if needed