fix(msteams): paginate channel thread replies so newest replies aren't dropped#100100
fix(msteams): paginate channel thread replies so newest replies aren't dropped#100100gunjanjaswal wants to merge 5 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 4, 2026, 6:16 PM ET / 22:16 UTC. Summary PR surface: Source +9, Tests +30. Total +39 across 2 files. Reproducibility: yes. source-level reproduction is high confidence: current main fetches one Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the helper-level pagination fix after redacted long-thread Teams or Graph proof, or after maintainers explicitly accept the bounded fanout and mocked-only Graph risk. Do we have a high-confidence way to reproduce the issue? Yes, source-level reproduction is high confidence: current main fetches one Is this the best way to solve the issue? Yes for code shape: the narrow fix belongs in the Teams AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 832cb3c48880. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +9, Tests +30. Total +39 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Closing this. #98884 already covered the same fix (pagination plus createdDateTime selection) with more proof, and it hit the same wall: ClawSweeper needs live Teams tenant proof that neither attempt can produce right now. No point in a second PR spinning on the same blocker. Leaving #98870 open for a maintainer with a tenant to pick up. |
Closes #98870
What Problem This Solves
Fixes an issue where the Teams channel thread context an agent sees is missing the newest replies on any thread with more than 50 replies.
fetchThreadRepliesrequested a single page of/messages/{id}/replies, and since Graph caps$topat 50 and returns replies oldest-first, long threads exposed only the oldest 50 replies to the agent and silently dropped the most recent, usually most relevant, messages.Why This Change Was Made
fetchThreadRepliesnow pages through the thread withfetchAllGraphPages(the helper this module already uses forlistChannelsForTeamandlistTeamsByName, which follows@odata.nextLink) and returns the newestlimitreplies. Newest selection is bycreatedDateTimewith a fallback to arrival order, so it no longer depends on undocumented page ordering. Per-page$topclamping is unchanged, so short threads behave exactly as before.Because the replies endpoint is oldest-first with no
$orderby, reaching the newest replies means walking the whole thread. The walk is bounded by a namedMAX_REPLY_PAGES = 50(up to 2500 replies scanned). Open question for maintainers: happy to lower that cap if the extra sequential Graph reads on the inbound context path are a concern, though a lower cap means very long threads fall back to fewer of the newest replies.User Impact
On Teams channel threads with more than 50 replies, the agent now gets the most recent replies as context instead of only the oldest 50, so its responses reflect the current state of the conversation.
Evidence
fetchAllGraphPages, which already handles@odata.nextLinkpagination and is covered ingraph.test.ts, so there is no new Graph interaction here, just the existing helper applied to replies.graph-thread.test.ts(run in CI): newest 50 selected from 60 paginated replies, newest window bycreatedDateTimeregardless of page order, plus the path,$topclamp, and empty-thread cases on the paginated helper.