-
Notifications
You must be signed in to change notification settings - Fork 1
fix(adapters): Slack streaming team_id + Teams DM Graph conversation IDs (vercel/chat#330, #403) #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
patrick-chinchill
merged 8 commits into
main
from
claude/port-slack-team-id-teams-dm-graph-J7S7H
May 28, 2026
Merged
fix(adapters): Slack streaming team_id + Teams DM Graph conversation IDs (vercel/chat#330, #403) #85
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8d899a1
fix(slack): pass interactive-payload team_id through streaming contex…
claude 4c0aa82
test(slack): port upstream structured-stream-from-action regression t…
claude bf1fae4
fix(teams): resolve canonical DM conversation ID for Graph API (verce…
claude cce5c75
refactor(teams): extract _paginate_graph_chat_messages helper
claude 993c74c
fix(teams): tighten port per PR #85 review
claude 3947238
fix(teams): cast context to TeamsDmContext for pyrefly narrowing
claude f99de08
fix(teams): guard aadObjectId regex against non-string values
claude ab15302
Merge branch 'main' into claude/port-slack-team-id-teams-dm-graph-J7S7H
patrick-chinchill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new DM-context branch calls
_AAD_OBJECT_ID_PATTERN.fullmatch(aad_object_id)directly, butaadObjectIdcomes from inbound activity JSON and can be non-string (int, object, etc.). In that casefullmatchraisesTypeError, which propagates out ofhandle_webhook(there is no surrounding catch) and turns an otherwise ignorable malformed field into a webhook failure. This breaks message handling for requests with unexpectedfrom.aadObjectIdshapes; add a string type check before evaluating the regex.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in f99de08.
re.fullmatchraisesTypeErroron non-string input, which would have escaped_cache_user_context→handle_webhookand turned a malformedfrom.aadObjectId(int/dict/list/etc.) into a 500. Added anisinstance(aad_object_id, str)gate before the regex so non-conforming activities are silently skipped (no DM caching), matching the existing defense-in-depth contract.Regression test added in
tests/test_teams_coverage.py::test_cache_user_context_handles_non_string_aad_object_idcoveringint,dict,list,None, andboolshapes. Verified the test raisesTypeError: expected string or bytes-like object, got 'int'against the pre-fix code and passes after.Validation: pyrefly 0 errors, ruff clean, full suite 3691 passed (only the pre-existing unrelated
test_github_webhook::test_throws_when_no_authfailure remains).Generated by Claude Code