Repository navigation
Let update_session clear the key and make project_id optional for single sessions - #206
Merged
Merged
Conversation
`update_session(new_key=None)` now clears the session's key; omitting `new_key` leaves it unchanged. `project_id` is now optional for `get_session`, `update_session`, and `delete_session` and is only sent when provided, since it is required only for multi-project organizations. The `update_session` docstring notes that a property value of `None` unsets that property. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yf4xszPJuZbmsVHpZeUGr
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yf4xszPJuZbmsVHpZeUGr
mguida22
approved these changes
Nov 6, 2026
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.
Changelog
update_sessioncan now clear a session's key withnew_key=None, andproject_idis optional forget_session,update_sessionanddelete_session.Docs
None
Description
The v1 API treats
keyonPATCH /sessions/{keyOrId}as nullable, wherenullclears it. It also makesprojectIdoptional on the single-session endpoints; it's needed only in multi-project organizations. The client couldn't clear a key, becausenew_key=Nonemeant "omit", and it requiredproject_id.update_sessionnow uses the client's existing_UNSETpattern: leaving outnew_keykeeps the key, a string sets it, andNoneclears it.project_idis optional onget_session,update_sessionanddelete_session, and is sent only when given.propertiestype hints accept lists of strings for multi-value properties. Onupdate_sessionthey also acceptNone, which unsets that property, as the docstring now says. Both already worked at runtime.Compatibility: code that passed
new_key=Noneexplicitly used to leave the key unchanged and will now clear it. Callers that leave it out or pass a string see no change.Validated with black, flake8, pyright, and pytest on Python 3.8: 206 passed, including the new tests in
tests/test_sessions.py. The ROS message tests can't install their dependencies in my environment, so CI covers those.client.update_session(session_id="ses_1", project_id="prj_1", new_key=None)left the key unchanged, andclient.get_session(session_id="ses_1")raisedTypeErrorfor the missingproject_id.The update sends
{"key": null}and clears the key.client.get_session(session_id="ses_1")sends noprojectId.🤖 Generated with Claude Code
https://claude.ai/code/session_012yf4xszPJuZbmsVHpZeUGr