fix(msteams): page channel thread replies#98884
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 12:42 AM ET / 04:42 UTC. Summary PR surface: Source +25, Tests +85. Total +110 across 2 files. Reproducibility: yes. from source inspection: 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 one canonical Teams helper fix that reuses Do we have a high-confidence way to reproduce the issue? Yes, from source inspection: current main fetches one Is this the best way to solve the issue? Yes, the helper-level pagination plus newest-window selection is the narrow maintainable fix shape. The remaining blocker is live external API proof or explicit maintainer acceptance of that proof gap, not a different code layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f7d7148cf047. Label changesLabel justifications:
Evidence reviewedPR surface: Source +25, Tests +85. Total +110 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
|
|
Updated the PR body Evidence after the ordering follow-up. The branch now sorts parseable |
|
Pushed a lint follow-up and refreshed the PR body Evidence. Latest focused proof: |
|
Refreshed the PR body Evidence on current head Live Teams tenant proof is still explicitly unavailable in this environment; the PR body now states the remaining proof gap and the exact maintainer/live proof needed for a real 50+ reply channel thread and 50-page cap latency/throttling check. @clawsweeper re-review |
|
Current-head follow-up for #98884: I rechecked this loop state from the current PR body/checks. The branch already has current-head focused proof for The remaining gap is not another mock/unit test: ClawSweeper asked for real Teams/Graph proof from a live channel thread with more than 50 replies, including redacted This environment has no |
|
Maintainer/live-proof handoff for #98884: I looked into whether I could provide the remaining Microsoft Teams / Graph evidence myself. The practical blocker is that I do not currently have a Microsoft work/school tenant account with Teams channel access, and creating a temporary Microsoft 365 tenant plus seeding a real channel thread with more than 50 replies would be a lot of setup for one PR proof run. The current branch already has focused mock/helper proof and green checks on head
I tried to find a contributor-side way to supply this, but it requires a work/school Microsoft 365 tenant, Teams data, and Graph consent for permissions such as Could a maintainer or someone with an existing Teams test tenant either provide the live Graph paging artifact, or explicitly decide that the current mocked Graph pagination evidence is enough for this small fix? |
Closes #98870
What Problem This Solves
Fixes an issue where Microsoft Teams channel users in long thread conversations would lose the newest replies from agent context once the thread had more than 50 replies.
Why This Change Was Made
Teams Graph exposes additional channel-message replies through
@odata.nextLink, while the list-replies endpoint supports$topbut not$orderby. This change uses the existing bounded Graph pagination helper for thread replies, sorts replies bycreatedDateTimebefore limiting when timestamps are parseable, and falls back to arrival-order slicing when Graph omits or returns an unparseable timestamp.User Impact
Agents responding in long Teams channel threads can now see the most recent relevant replies instead of being limited to the oldest first page of replies. The newest-window selection no longer depends on whether Graph returns reply pages oldest-first or newest-first.
Evidence
fetchThreadRepliesnow requests replies through bounded Graph pagination and returns the newest limited reply window without relying on Graph response order.pnpm install --frozen-lockfilecompleted successfully after the worktree initially lackednode_modules.node scripts/run-vitest.mjs extensions/msteams/src/graph-thread.test.tspassed before follow-up: 1 test file, 28 tests.node scripts/run-vitest.mjs extensions/msteams/src/graph-thread.test.tspassed: 1 test file, 30 tests.node scripts/run-vitest.mjs extensions/msteams/src/graph-thread.test.tspassed: 1 test file, 30 tests.6efb75654c039efa10e2814434620aa6ba9e1006,node scripts/run-vitest.mjs extensions/msteams/src/graph-thread.test.ts extensions/msteams/src/graph.test.tspassed: 2 test files, 49 tests.git diff --checkpassed after the lint follow-up and again on current head6efb75654c039efa10e2814434620aa6ba9e1006.pnpm exec oxlint extensions/msteams/src/graph-thread.test.ts extensions/msteams/src/graph-thread.tspassed after the lint follow-up.PYTHONUTF8=1 python .agents\skills\autoreview\scripts\autoreview --mode localpassed after the ordering follow-up withautoreview clean: no accepted/actionable findings reported.graph-threadtests cover the paginated helper call, newest-reply limit behavior, minimum/maximum limit handling, empty results, the explicit 50-page cap, newest-window selection when Graph pages arrive oldest-first, newest-window selection when Graph pages arrive newest-first, and arrival-order fallback whencreatedDateTimeis missing or unparseable.graph.test.tsrun exercises the sharedfetchAllGraphPageshelper thatfetchThreadRepliesnow calls, including multi-page@odata.nextLinkchains, Graph root stripping forv1.0/betanext links,maxPagestruncation, and earlyfindOnebehavior. This proves the PR is wired through the existing Graph pagination helper rather than only a standalone reply-order mock.$topwith a maximum of 50 and says other OData query parameters are not supported; Graph paging docs direct callers to follow@odata.nextLinkuntil it is absent.MSTEAMS_*,MICROSOFT_*,AZURE_*, orGRAPH_*credentials and nochannels.msteamscredentials in the local user config, so I could not safely query a real tenant. Remaining maintainer/live proof needed: run against a real channel thread with more than 50 replies, capture redacted Graph output showing@odata.nextLinkpages and newest replies included in the final context window, and record latency/throttling behavior for the bounded 50-page cap.