Skip to content

fix(sdk): skip profile files that are not valid UTF-8 - #6536

Merged
VascoSch92 merged 2 commits into
OpenHands:mainfrom
yftx293:fix/profile-store-undecodable
Nov 6, 2026
Merged

VascoSch92 merged 2 commits into
OpenHands:mainfrom
yftx293:fix/profile-store-undecodable

Conversation

@yftx293

@yftx293 yftx293 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

HUMAN:

Fixed the undecodable profile file from #6348. I reviewed the diff and the tests; one bad file must not take down a listing or abort a ref cascade.


AGENT:

Why

AgentProfileStore reads each profile with read_text() (UTF-8) but only caught OSError and JSONDecodeError. A profile file holding non-UTF-8 bytes therefore raised UnicodeDecodeError out of list_summaries, so a single corrupt file broke every listing, and out of set_llm_profile_ref, aborting the ref cascade for all remaining profiles.

Summary

  • Treat UnicodeDecodeError as a corrupt profile in both places: list_summaries skips the file with the same warning it uses for invalid JSON, and set_llm_profile_ref returns without rewriting it.
  • Port the pinned tests test_list_summaries_skips_undecodable_file and test_set_llm_profile_ref_skips_undecodable_file from the worktree-test-edge-cases branch (commit f2fcf6e) without their xfail(strict=True) markers, per the [Bug]: Edge-case tests expose ~70 bugs across the SDK, agent server, tools and workspaces #6348 menu's acceptance criteria.

Issue Number

Part of #6348 (menu sub-items: "list_summaries catches OSError/JSONDecodeError but not UnicodeDecodeError" and "set_llm_profile_ref does not treat UnicodeDecodeError as a corrupt profile")

How to Test

uv run pytest tests/sdk/profiles/test_agent_profile_store.py -k undecodable

Before this change both cases raise UnicodeDecodeError; after, the corrupt file is skipped and the healthy profile is still listed. tests/sdk/profiles/test_agent_profile_store.py is 51 passed. ruff check/format on the touched files are clean.

Type

  • Bug fix

Notes

None.

@VascoSch92 VascoSch92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@VascoSch92
VascoSch92 enabled auto-merge (squash) November 6, 2026 13:26
@VascoSch92
VascoSch92 merged commit 6c698a0 into OpenHands:main Nov 6, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants