Fix agent reconciliation to allow agent_context updates#1371
Merged
Conversation
Allow agent_context to be updated during conversation resume. This fixes the issue where resuming a conversation from a different directory or switching between ACP and regular CLI mode would fail due to: - Different skill paths (absolute paths change with working directory) - Different skills (e.g., ACP mode adds user_provided_resources skill) - Different system_message_suffix (contains working directory) The reconciliation now uses the current environment's agent_context, similar to how it handles LLM updates. Co-authored-by: openhands <openhands@all-hands.dev>
Contributor
Remove redundant if/elif branches that performed the same operation. The simplified logic is clearer: always use the current environment's agent_context when it exists. Co-authored-by: openhands <openhands@all-hands.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When resuming a conversation from a different directory or switching between ACP and regular CLI mode, the agent state validation fails with a ValueError showing differences in:
user_provided_resourcesskill)This prevents users from resuming conversations across different environments.
Solution
Modified
resolve_diff_from_deserialized()inagent/base.pyto reconcileagent_contextduring conversation resume, similar to how LLM configuration is already handled. The reconciliation now:Testing
Added comprehensive test
test_conversation_restart_with_different_agent_context()that simulates:Test validates the fix
Without the fix (code commented out), the test fails with the exact error from the bug report:
With the fix, the test passes along with all other reconciliation tests.
All 44 tests in the cross directory pass ✓
Impact