CLI V1 - Getting an error when restoring a session...
# proj-sdk
c
CLI V1 - Getting an error when restoring a session, due to the
litellm_extra_body
diff from deserialized I suggest removing this from the diff... if it is in the diff. I'm not actually sure why it sees a diff, because I didn't find the values, maybe the CLI creates it at restore time?
✅ 2
@nutritious-balloon-65098 Look into this: clone yourself openhands/openhands, and openhands/agent-sdk, and investigate the CLI code in openhands-cli on litellm_extra_body, and in agent-sdk. Find why was there a diff and fix it, push a PR to the correct repo. I think nothing changed the values in the .json files, so somehow a value created at runtime must have been compared with a value from a .json? You can test the cli app yourself to see if you can replicate, with —resume
n
I'm on it! can track my progress here.
Here’s a concise summary of the work completed and what changed since the last update. What I changed (in OpenHands/agent-sdk) • Root cause: The CLI injects dynamic session metadata into LLM.litellm_extra_body at load/restore. On resume, the SDK compared runtime-injected values against persisted JSON and flagged a diff, even though the persisted files were unchanged. • Fix: Treat litellm_extra_body as a runtime override during reconciliation, same as secrets (api_key, aws_*). ◦ File: openhands-sdk/openhands/sdk/llm/llm.py ◦ Change: Added "litellm_extra_body" to LLM.OVERRIDE_ON_SERIALIZE so the runtime value overrides persisted before strict comparison. • Tests: ◦ Added tests/sdk/llm/test_llm_reconciliation.py to ensure litellm_extra_body diffs are ignored and runtime values are used. ◦ Fixed tests/cross/test_agent_reconciliation.py by removing stray/duplicated lines causing IndentationError and ensuring the reconciliation path runs cleanly. Verification • agent-sdk: ◦ pre-commit (ruff format/lint, pyright, pycodestyle) pass. ◦ New reconciliation tests pass. • openhands-cli: ◦ Running CLI tests with PYTHONPATH pointed at local agent-sdk: 143 passed. ◦ Programmatic resume smoke test worked: no diff/reconciliation errors (LLM call failed due to missing real API key, which is expected in this environment). Checklist • Investigated CLI vs agent-sdk code paths for litellm_extra_body. Done • Identified runtime vs persisted mismatch as cause. Done • Implemented minimal, focused fix in the correct repo (agent-sdk). Done • Added tests to prevent regression. Done • Lint/tests passing. Done • Verified CLI resume path no longer errors. Done (within environment constraints) Branch/PR • Created branch: fix/cli-resume-litellm-extra-body • Opened draft PR: https://github.com/OpenHands/software-agent-sdk/pull/1115 ◦ Title: Fix resume reconciliation by treating litellm_extra_body as runtime override ◦ Includes code fix and tests ◦ Co-authored-by: openhands <openhands@all-hands.dev> Questions for you • Would you like me to mark the PR as ready for review and convert from draft? • Do you want any additional tests (e.g., CLI integration test explicitly checking resume behavior), or is the current unit test coverage sufficient? If you want any changes to the PR title/description or branch name, let me know and I’ll update accordingly. <sub>View full conversation</sub>
c
PR LGTM!