Commit Graph
1 Commits
Author SHA1 Message Date
Nick HollonandGitHub d89c7e100e fix(sdk-py): percent-encode thread_id and assistant_id in thread stream requests (#9213)
## Summary

Two REST helpers on the thread stream built their paths by interpolating
the raw identifier:

- `thread.agent.get_tree()` built `/assistants/{assistant_id}/graph`
- the state fetch behind `thread.output` built
`/threads/{thread_id}/state`

httpx collapses `..` segments and treats `#` as a fragment, so an
identifier containing those characters was rewritten into a different
path before the request was sent. Both now go through
`_quote_path_param` in the async and sync stream modules, matching the
other SDK endpoints and the stream transports.

## Tests

`tests/streaming/test_thread_stream_path_encoding.py` drives
`threads.stream(...)` followed by `thread.output` or
`thread.agent.get_tree()`, async and sync, with identifiers containing
`..`, `/`, and `#`. It asserts that the request path keeps each
identifier as a single encoded segment. All four tests fail without the
change.

`make format`, `make lint`, and `make test` pass in `libs/sdk-py`.
2026-10-06 09:57:28 -04:00