Fix base_url for OpenHands provider which was brok...
# dev-pr-review
c
Fix base_url for OpenHands provider which was broken by an upstream SDK PR (@quick-window-91705 we might need a patch release for this, this breaks new user setup flow šŸ˜ž ) https://github.com/OpenHands/OpenHands-CLI/pull/168
šŸ‘€ 1
q
c
Oops, but sorry, I'm not sure I understand, if it wasn't passing a
base_url
, didn't the SDK supply the
app
proxy URL?
c
šŸ‘† the issue is that CLI will save the settings to a local JSON and re-load it everytime The json will have
base_url=null
q
@calm-artist-7206 gonna hold off on release for a bit so you've had a chance to look through the change
c
ugh this reminds me of this bug https://github.com/OpenHands/software-agent-sdk/pull/1299#issuecomment-3607725829 šŸ˜… now i realized that is probably the PR that breaks this..
(and i applied the wrong fix to get it working šŸ˜ž )
@nutritious-balloon-65098 please review all the mentioned PR & comment in this slack thread, understand what changes were made to get release 1.4.0 to pass the
test-examples
CI, revert that and invesitigate the root cause of that failure (likely due to the
openhands/
provider +
base_url
error we are discussing here)
n
I'm on it! Xingyao Wang can track my progress here.
c
gonna hold off on release for a bit so you've had a chance to look through the change
Just to clarify, I think hardcoding it in the CLI should work, I'm just thinking that maybe we can also fix the condition in the SDK then...
nod 1
acknowledged 1
q
Ah gotcha thanks Gonna proceed with patch release then
šŸ‘ 1
n
Summary of Investigation and Fix I've successfully investigated and fixed the
base_url
issue with the
openhands/
provider that broke the CLI's new user setup flow. Here's what I found and fixed: Root Cause Identified PR #1273 introduced a breaking change in
llm.py
(line 373): • Changed from:
d["base_url"] = "<https://llm-proxy.app.all-hands.dev/>"
• To:
d["base_url"] = d.get("base_url", "<https://llm-proxy.app.all-hands.dev/>")
The Problem: When CLI saves settings to JSON with
base_url=null
and reloads them, the dictionary contains
{"base_url": None}
. Python's
dict.get(key, default)
only returns the default when the key is missing, not when it's explicitly
None
. This caused LiteLLM to fail with a missing base_url error. The Workaround in 1.4.0 (commit 54d93bc1): Changed the test workflow to bypass the
openhands/
provider entirely by using
litellm_proxy/
directly with a hardcoded URL. Changes Made 1. Fixed
llm.py
(line 373): Changed to
d.get("base_url") or "<https://llm-proxy.app.all-hands.dev/>"
to handle explicit
None
values correctly 2. Reverted workflow workaround: Changed
.github/workflows/run-examples.yml
back to using
openhands/claude-haiku-4-5-20251001
with
${{ secrets.LLM_BASE_URL }}
3. Added comprehensive tests (
test_llm.py
): ā—¦ Test with explicit
None
base_url (reproduces CLI bug) ā—¦ Test with custom base_url (ensures override still works) Verification • āœ… All 467 LLM tests pass • āœ… Manual testing confirms all scenarios work correctly • āœ… Pre-commit hooks pass • āœ… Changes committed with descriptive message Would you like me to: 1. Push these changes to a new branch and create a pull request? 2. Keep the changes local for now? 3. Any other specific workflow you prefer? <sub>View full conversation</sub>
šŸ‘ 2
āœ… Pull Request Created Successfully I've successfully investigated, fixed, and pushed the
base_url
issue with the
openhands/
provider. Pull Request: https://github.com/OpenHands/software-agent-sdk/pull/1341 What Was Done āœ… Investigation Complete: • Reviewed Slack thread and related PRs (CLI #168, #171, SDK #1299, #1273) • Identified root cause in PR #1273 where
dict.get()
doesn't handle explicit
None
values • Found the workaround applied in release 1.4.0 (commit 54d93bc1) āœ… Fix Implemented: • Changed
d.get("base_url", default)
to
d.get("base_url") or default
in
llm.py
• Reverted workflow workaround to use
openhands/
provider again • Added 2 comprehensive test cases covering explicit
None
and custom URL scenarios āœ… Testing: • All 467 LLM tests pass • Pre-commit hooks pass • Manual testing confirms all scenarios work The Fix in One Line Changed from
dict.get(key, default)
to
dict.get(key) or default
to properly handle cases where CLI saves
base_url=null
to JSON and reloads it as
None
. This unblocks the CLI release and restores the proper functioning of the
openhands/
provider for new user setup flows. <sub>View full conversation</sub>