fix(msteams): release failed Graph collection bodies#109970
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 25, 2026, 3:11 PM ET / 19:11 UTC. ClawSweeper reviewWhat this changesThe PR cancels a failed Microsoft Graph hosted-content collection response body before returning the existing empty-media fallback, and adds a regression test. Merge readinessThe supplied PR evidence supports a narrow Microsoft Teams resource-cleanup fix, but the checkout could not be read in this review run, so current-main behavior, surrounding call paths, and feature history could not be independently verified. Keep this PR open for ordinary maintainer review of its current clean merge result. Priority: P2 Review scores
Verification
How this fits togetherThe Microsoft Teams plugin downloads a message's Graph attachments and hosted-content collections to produce media for inbound messages. A failed collection lookup currently falls back to no hosted media; this change releases that unused response stream before the fallback returns. flowchart LR
A[Teams message] --> B[Graph media downloader]
B --> C[Hosted-content collection request]
C --> D{Collection response OK?}
D -->|Yes| E[Parse media items]
D -->|No| F[Cancel response body]
F --> G[Return empty hosted media]
E --> H[Attachment media result]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1, Tests +47. Total +48 across 2 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land a refreshed, focused cleanup only if the current merge result still preserves the existing non-OK fallback and the added test covers the current Graph collection helper. Do we have a high-confidence way to reproduce the issue? Unclear for an unfixed current-main checkout: the supplied real-entrypoint proof demonstrates the intended 404 path after the patch, while the patch and regression test make the prior unclosed-body path source-reproducible. Is this the best way to solve the issue? Unclear: canceling the unused non-OK response body at the collection helper is a narrow and plausible owner-boundary fix, but current-main callers and sibling response-consumption paths were not independently available for comparison. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0e2c60e605d0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
1677e8b to
1d89e67
Compare
868fed5 to
9203b21
Compare
bcba75e to
a0fd950
Compare
a0fd950 to
514c647
Compare
514c647 to
e84893e
Compare
What Problem This Solves
Fixes an issue where MS Teams Graph hosted-content collection lookups could leave a non-OK response body open while falling back to an empty media result.
Why This Change Was Made
The Graph collection fallback behavior is unchanged: non-OK collection responses still produce an empty item list with the observed status. The fallback branch now cancels any response body before returning.
User Impact
MS Teams media handling keeps skipping unavailable hosted-content collections while releasing failed Graph collection response streams promptly.
Evidence
./node_modules/.bin/tsx proof-msteams-graph-collection.tsimported the realdownloadMSTeamsGraphMediaentrypoint, exercised a 404 hostedContents collection response, and used a 200 empty collection negative-control response.node scripts/run-vitest.mjs extensions/msteams/src/attachments.graph.test.ts -- -t "cancels non-OK Graph collection bodies"node scripts/run-vitest.mjs extensions/msteams/src/attachments.graph.test.tsproof-msteams-graph-collection.ts
AI-assisted: built with Codex