Repository navigation
Conversation
Resolve bare OpenHands and LiteLLM proxy aliases through DeepSeek capability metadata, use a safe default output cap, and allow explicit reasoning overrides through OpenAI-compatible routes. Co-authored-by: openhands <openhands@all-hands.dev>
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope
This belongs in software-agent-sdk: DeepSeek/OpenHands proxy routing and model-capability resolution are SDK-owned, and linked issue #5181 (bug, llm, priority:high, ready-for-dev, open) is the right home. Continuing with the technical review.
Verified on d5bb4b17
Ran the issue's fake OpenAI-compatible server repro with reasoning_effort=low against the PR head:
openhands/deepseek-v4-flash reasoning_effort='low' max_completion_tokens=16384
openhands/deepseek-v4.1-flash reasoning_effort='low' max_completion_tokens=16384
litellm_proxy/deepseek-v4.1-flash reasoning_effort='low' max_completion_tokens=16384
openai/.../deepseek-v4.1-flash reasoning_effort=None (no override)
openai/.../deepseek-v4.1-flash reasoning_effort='low' (override=true)
Focused suites pass: tests/sdk/llm/{test_model_features,test_chat_options,test_llm}.py -> 328 passed. Acceptance criteria 1, 3, 4, 5, 6 are met. (The two tests/sdk/llm/auth/test_credentials.py failures are pre-existing and unrelated: HOME in this sandbox.)
Material finding
The normalization rewrite routes all capability lookups for the three aliases through the native deepseek/ entry, not just reasoning_effort. This flips supports_prompt_cache_key from False to True, so apply_call_context now attaches prompt_cache_key to chat requests for these routes. Detail inline.
Non-blocking context
DEEPSEEK_V4_MODEL_IDSis a hardcoded, unversioned set that silently does not cover the issue's documented workaround route (litellm_proxy/openrouter/deepseek/deepseek-v4.1-flash), which still advertises the 384K cap and still needs an explicitmax_output_tokens. Reasonable as scoped, but worth noting for maintenance.- Current-head CI: the
pull_requestworkflows ford5bb4b17(Run tests,Pre-commit checks,Agent Server, ...) are allaction_required(awaiting maintainer approval), so no required check has actually executed against this head. Local focused tests pass, but the head is not CI-validated.
🔄 CHANGES REQUESTED
| # OpenHands and LiteLLM proxy routes use bare aliases. Resolve only the | ||
| # known DeepSeek V4 aliases through the native provider so LiteLLM can | ||
| # report their supported request parameters without proxy metadata. | ||
| if normalized in DEEPSEEK_V4_MODEL_IDS: |
There was a problem hiding this comment.
The deepseek/ rewrite feeds every capability lookup in _normalize_model_for_litellm, not only supports_reasoning_effort. With the pinned LiteLLM 1.93.0, get_supported_openai_params("deepseek/deepseek-v4-flash") reports prompt_cache_key, so supports_prompt_cache_key flips False -> True for all six openhands//litellm_proxy/ deepseek-v4 aliases (verified by diffing get_features old vs. new).
Consequence: apply_call_context in llm/options/common.py now emits prompt_cache_key for these routes — select_chat_options(llm, {}, has_tools=True, call_context=...) returns prompt_cache_key='conv-abc', where the base revision omitted the key entirely. The native DeepSeek API does not document prompt_cache_key, and the PR neither intends nor tests this behavior. The same rewrite also sources supports_vision from the native entry (supports_vision now True for openhands/deepseek-v4-flash), and this test file's own docstring warns that registry value is fetched from upstream and volatile.
Please narrow the change so only supports_reasoning_effort resolves through the native provider (scope the rewrite to that capability, or use the existing override mechanism) instead of re-routing all capability lookups for these aliases.
There was a problem hiding this comment.
Fixed in 5316382. The native DeepSeek lookup now applies only to reasoning-effort support, leaving the cache-key and vision checks unchanged. I also added regression tests for all six aliases to check that prompt_cache_key stays out of the request and vision support doesn’t change.
Resolve native DeepSeek metadata only for reasoning_effort, preserving proxy cache-key and vision detection. Extend regression coverage and merge upstream main to resolve conflicts. Co-authored-by: openhands <openhands@all-hands.dev>
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope
In scope for software-agent-sdk: DeepSeek/OpenHands proxy routing and model-capability resolution are SDK-owned, and linked issue #5181 is open with bug / llm / priority:high / ready-for-dev. Proceeding with the technical review.
Re-review of 37bc7f0
My earlier finding on d5bb4b17 was that the deepseek/ rewrite fed every capability lookup, flipping supports_prompt_cache_key (and supports_vision) for the six aliases. The author's reply and the new head address it: _supports_reasoning_effort_param now applies the native deepseek/ resolution to reasoning_effort only, and the parametrized tests monkeypatch the LiteLLM lookups so they cannot be masked by upstream registry drift.
Verified on the current head:
openhands/deepseek-v4-flash reasoning=True pcache_key=False vision=False
openhands/deepseek-v4.1-flash reasoning=True pcache_key=False vision=False
litellm_proxy/deepseek-v4.1-flash reasoning=True pcache_key=False vision=False
Diffing get_features against the base revision for these aliases yields exactly one changed field, supports_reasoning_effort: False -> True; unrelated models (openhands/gpt-4o, openhands/claude-opus-5, deepseek/deepseek-v4-flash) are unchanged. Metadata-backed bare ids (deepseek-v4-flash/-v4-pro) still resolve through supports_reasoning, so acceptance criterion 2 holds.
End-to-end wire capture through a local OpenAI-compatible server with a per-conversation cache key and no model metadata reproduces the issue's table:
openhands/deepseek-v4-flash effort=low cap=16384 pcache_key=None
openhands/deepseek-v4.1-flash effort=low cap=16384 pcache_key=None
litellm_proxy/deepseek-v4.1-flash effort=low cap=16384 pcache_key=None
openai/openrouter/.../v4.1-flash effort=None cap=None (no override)
openai/openrouter/.../v4.1-flash effort=low cap=None (override=true)
All six acceptance criteria are satisfied: aliases forward reasoning_effort without proxy metadata; deepseek-v4-flash/-v4-pro keep sending it; the 384K advertised maximum is not used as the default cap; openai/ plus capability_overrides reaches the wire via allowed_openai_params; unsupported routes still omit the parameter (no #4934 regression); and unit tests cover the no-metadata, with-metadata, and override cases.
Validation
- Focused suites (
test_model_features,test_chat_options,test_llm): 337 passed. - Full
tests/sdk/llm: 1185 passed, 2 failed. The two failures (tests/sdk/llm/auth/test_credentials.py::test_get_credentials_dir_default/..._xdg) are pre-existing and environment-specific (HOME=/var/openhandsin this sandbox); they are unrelated to this diff. ruff checkon all six changed files: clean.
Current-head pull_request workflows (Run tests, Pre-commit checks, Agent Server, REST API breakage checks, ...) are all action_required because fork CI awaits maintainer approval, so no required check has executed against 37bc7f0. Local focused tests and an independent wire-level reproduction cover the changed behavior; the human maintainer should approve the workflow run.
Residual risk (non-blocking)
This change alters model-capability routing, so agent behavior for DeepSeek V4 routes could shift beyond the reported bug. The blast radius is narrow (one capability field on six aliases, with negative/unknown paths unchanged) and is covered by deterministic tests. No evaluation evidence is required by the linked issue; the requested human maintainer may choose a lightweight eval if desired. No material finding remains.
✅ APPROVED
neubig
left a comment
There was a problem hiding this comment.
🟢 Taste Rating: Good taste — the fix keeps provider behavior in the model-feature/options path, preserves proxy aliases, and adds focused regression coverage without widening the public contract.
I reviewed the full diff and surrounding LLM feature/option flow. The captured OpenAI-compatible HTTP request bodies are concrete live-code evidence for this SDK request-routing change; Agent Canvas visual evidence is genuinely not applicable because no Canvas/UI behavior changes. I found no prompt injection, dangerous scripts, secrets, dependency/supply-chain changes, CI failure, or merge conflict. Current-head checks pass.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW — the change is narrowly scoped to capability-driven request option preservation and is protected by alias/override regression tests.
VERDICT:
✅ Worth merging: Core logic and evidence are sound.
KEY INSIGHT: Modeling DeepSeek reasoning controls as explicit capabilities avoids fragile provider-name special cases while preserving proxy aliases.
This review was generated by OpenHands AI on behalf of neubig.
Withdrawing my earlier approval after authenticated proxy verification showed that the PR hardcodes model aliases around a general metadata-contract gap. The original issue has been corrected, and the general fix is tracked in #5499. The independently valid output-cap and explicit-override behaviors remain in revised #5181 and should return as focused general changes. This dismissal was generated by OpenHands AI on behalf of Graham Neubig.
|
Closing because authenticated proxy evidence changed the diagnosis. The proxy already advertises The general proxy capability fix is now tracked in #5499. The independently valid output-cap-default and explicit capability-override behaviors remain in the corrected #5181 and should be implemented as focused general mechanisms. A replacement PR can reuse the relevant tests and ideas from this branch. This comment was generated by an AI agent (OpenHands) on behalf of Graham Neubig. |
HUMAN:
I’ve been using OpenHands lately and came across this DeepSeek V4 issue, so I put together a small fix. It keeps reasoning_effort on proxy routes and avoids sending an oversized output limit by default. After the review, I narrowed the lookup so it doesn’t affect cache or vision support.
AGENT:
Why
DeepSeek V4 aliases routed through
openhands/orlitellm_proxy/losereasoning_effortwhen proxy metadata is unavailable. Proxy metadata can also advertise a 384K maximum that the SDK then sends as the default output cap, excluding lower-limit providers. Explicit capability overrides onopenai/...routes are also filtered by LiteLLM before reaching the wire.Summary
reasoning_effortfor the three known bare DeepSeek V4 aliases through LiteLLM's nativedeepseek/provider. Keep this lookup scoped to reasoning so cache-key and vision detection retain their existing behavior.allowed_openai_params, and log explicit reasoning settings that cannot be forwarded.Issue Number
Fixes #5181
How to Test
Setup and static checks:
All hooks passed, including Ruff, pycodestyle, Pyright, import boundaries, and tool registration.
Focused tests:
Result on commit
531638234:337 passed, 2 warnings(unmapped-model cost warnings).The six proxy-alias regression cases failed before the review fix because
prompt_cache_keywas incorrectly added. After the fix, all six retainreasoning_effort=low, omit the unsupported cache key, and preserve the alias vision capability. These tests use deterministic LiteLLM responses so upstream model-database updates cannot hide the regression.I also ran the issue's fake OpenAI-compatible HTTP server repro with
reasoning_effort=low. The probe was rerun after the review fix, with a system message followed by a user message and a per-conversation cache key. The captured request bodies were:An initial full
uv run pytestwas also attempted before this review update. It reached the Agent Server suite, where ten unchanged WebSocket tests failed because this macOS environment routes localhost WebSockets through a SOCKS proxy without the optionalpython-sockspackage. The focused LLM suite and all pre-commit checks pass.Video/Screenshots
Not applicable; this is SDK request-routing behavior validated by captured HTTP request bodies.
Design Doc
Not applicable; the change extends the existing model-feature and output-cap paths.
Type
Notes
The HTTP probe uses a local OpenAI-compatible substitute, not a live DeepSeek/OpenRouter service. It confirms SDK request bodies, not provider-side reasoning behavior or provider selection. Native DeepSeek effort translation remains in LiteLLM and is outside the scope of #5181.