Repository navigation
fix(sdk): skip profile files that are not valid UTF-8 - #6536
Merged
Merged
Conversation
Closed
75 of 86 tasks
VascoSch92
enabled auto-merge (squash)
November 6, 2026 13:26
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.
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
AgentProfileStorereads each profile withread_text()(UTF-8) but only caughtOSErrorandJSONDecodeError. A profile file holding non-UTF-8 bytes therefore raisedUnicodeDecodeErrorout oflist_summaries, so a single corrupt file broke every listing, and out ofset_llm_profile_ref, aborting the ref cascade for all remaining profiles.Summary
UnicodeDecodeErroras a corrupt profile in both places:list_summariesskips the file with the same warning it uses for invalid JSON, andset_llm_profile_refreturns without rewriting it.test_list_summaries_skips_undecodable_fileandtest_set_llm_profile_ref_skips_undecodable_filefrom theworktree-test-edge-casesbranch (commit f2fcf6e) without theirxfail(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
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.pyis 51 passed.ruff check/formaton the touched files are clean.Type
Notes
None.