Repository navigation
fix(sdk): decrypt encrypted fallback profiles - #4568
Sehlani042 wants to merge 2 commits into
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
|
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was created by an AI agent (OpenHands) on behalf of the repository maintainers.
Formal APPROVED on current head dd0a74bd
This formal APPROVED review is submitted on the current head so branch protection can consume it. It supersedes the prior dismissed APPROVED on 59f82df and the COMMENTED review on dd0a74bd.
Change Since Prior Approval
The only commit difference between the previously approved head (59f82df) and the current head (dd0a74bd) is the automated cleanup removing .pr/test-results.png — a non-functional artifact deletion. No source code, test, or configuration changes were introduced. The implementation and live Docker validation findings from the prior review remain fully applicable.
Summary of Verified Findings
All prior review findings remain resolved on the current head:
-
Planning conversation hardcoded
LocalWorkspace— ✅ Resolved.buildStartPlanningConversationRequest(line 1387) andbuildStartPlanningConversationRequestWithEncryptedSettings(line 1575) both acceptexecutionRuntimeand selectDockerExecutionWorkspacewhen the server advertises Docker execution. All three entry points (main conversation, planner, encrypted-settings wrapper) are covered. -
Type narrowing loss — ✅ Resolved. All
executionRuntimeparameters and return types useAgentServerInfo["execution_runtime"], resolving to"local" | "docker" | undefined. Typos fail at compile time. -
Evidence gap — ✅ Resolved by live validation against SDK head
7096d432:/server_inforeturnsexecution_runtime: "docker"- Parent conversation creation with
DockerExecutionWorkspace+/workspaceworks against a real Docker execution server - Planner child request with
parent_conversation_id+plannerparenttag succeeds withDockerExecutionWorkspace,/workspace, and correct parent relationship - 73/73 focused tests pass across
agent-server-adapter.test.ts(30) andagent-server-conversation-service.test.ts(43)
CI Status
All current-head CI is green: test-and-build (ubuntu), test-and-build (windows), mock-llm-e2e (70/70), mock-llm-docker-e2e (70/70), and build/push pipelines all pass.
Risk Assessment
🟢 LOW — All prior findings are resolved. The only change since the prior approval is an automated artifact cleanup commit. The code is clean, type-safe, and verified at both the unit and live end-to-end level. The remaining action item is merging the SDK dependency (software-agent-sdk#4883), which is outside this PR's control.
Verdict: Approve — the implementation is complete and verified.
Generated by OpenHands AI on behalf of the user.
|
Thanks for the PR — I reviewed the implementation. The cipher-binding approach and default-cipher-with-explicit-precedence in One blocking issue: stale branch will regress Please rebase onto Minor/optional: the |
|
Addressed the current-main compatibility issue in 854463d without force-pushing.
Verification on the merged head: both complete related test files pass (53 passed); Ruff format/lint, pycodestyle, Pyright, import-dependency checks, Tool registration, and |
HUMAN:
AGENT:
Why
Encrypted LLM profiles are decrypted on the main conversation path, but fallback profiles are resolved lazily through a separate
LLMProfileStorethat did not receive the conversation cipher. As a result,FallbackStrategycould pass a Fernet ciphertext (gAAAAA...) to the provider as an API key. This also affected strategies that had cached a fallback before being attached to a conversation.Summary
FallbackStrategy, invalidate previously resolved fallback caches when the cipher changes, and pass the cipher explicitly when lazily loading each fallback profile.profile_store_dirbehavior when initializing the conversation's profile store.Issue Number
Fixes #4558
How to Test
Reproduction and regression:
include_secrets=Trueand aCipher.FallbackStrategy; the old path exposes the encryptedgAAAAA...token.LocalConversation(..., cipher=cipher)with that strategy.LocalConversation(profile_store_dir=..., cipher=...)and verify both the custom directory and decryption remain effective.Commands and results:
uv run pytest -q \ tests/sdk/llm/test_llm_profile_store.py \ tests/sdk/llm/test_llm_fallback.py \ tests/sdk/conversation/test_switch_model.py # 117 passeduv run pre-commit run --files \ openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py \ openhands-sdk/openhands/sdk/llm/fallback_strategy.py \ tests/sdk/conversation/test_switch_model.py \ tests/sdk/llm/test_llm_fallback.py # Ruff format/lint, PEP8, Pyright, import rules, and Tool registration passedThe repository-wide dynamic-attribute hook reports four findings in untouched current-main files (
stream_context.pyandtelemetry.py). The same four findings reproduce in a detachedorigin/main@9c3571a69worktree, so they are not introduced by this patch.git diff --checkalso passes.Video/Screenshots
Not applicable; this is an SDK behavior fix covered by deterministic executable regressions.
Design Doc
Not included; the change is limited to cipher propagation and cache invalidation across existing SDK objects while preserving current-main profile-store configuration.
Type
Notes
Codex assisted with issue triage, implementation, current-main reconciliation, and test execution. The patch was constrained to the fallback-profile cipher path and checked for competing pull requests before publication.