fix(sessions): dedupe subagent IDs across disk paths - #1238
Open
rioyu123 wants to merge 1 commit into
Open
Conversation
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.
Summary
This pull request makes filesystem-backed
list_subagents()return each logical agent ID once when the same ID exists under multiple physical subpaths.list_subagents_from_store()and its TypeScript parity contractWhy
Subagent transcripts can exist both directly under
subagents/and under nested workflow directories. The disk helper previously returned duplicate IDs for those paths even though callers can only address a subagent by ID and the store-backed helper already deduplicates them.The change is intentionally limited to
list_subagents(): traversal, exception behavior,get_subagent_messages(), and public signatures remain unchanged.Test plan
pytest tests/test_sessions.py::TestListSubagents tests/test_session_helpers_store.py::TestSubagentsFromStore -q -p no:cacheprovider- 29 passedruff format --check src/claude_agent_sdk/_internal/sessions.py tests/test_sessions.pyruff check src/claude_agent_sdk/_internal/sessions.py tests/test_sessions.pymypy src- cleanpytest tests --ignore=tests/test_changelog.py -q -p no:cacheprovider- 1471 passed, 14 skippedtests/test_changelog.py; those are unrelated to this patch and are addressed separately in fix(tests): read changelog as UTF-8 #1236AI assistance disclosure
I used AI assistants for implementation review. I independently reproduced the bug, verified the regression test against the old behavior, reviewed the resulting diff, and ran the checks above.