fix(msteams): paginate thread replies to include newest context (#98870)#100155
fix(msteams): paginate thread replies to include newest context (#98870)#100155LiuwqGit wants to merge 1 commit into
Conversation
…claw#98870) fetchThreadReplies now uses fetchAllGraphPages to walk all reply pages via @odata.nextLink, then selects the newest limit replies by createdDateTime. Bounded at MAX_REPLY_PAGES=50 (up to 2500 replies). Threads with ≤50 replies are unaffected. Closes openclaw#98870 Co-Authored-By: Claude Haiku 4.5 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 4, 2026, 11:00 PM ET / 03:00 UTC. Summary PR surface: Source +500, Tests +374. Total +874 across 3 files. Reproducibility: yes. Source inspection on current main shows Review metrics: 2 noteworthy metrics.
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: Rebase the branch onto current main, keep the helper-level pagination fix, and merge only after redacted long-thread Teams/Graph proof or explicit maintainer acceptance of the bounded mocked-only risk. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows 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 4d181b62a96d. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +500, Tests +374. Total +874 across 3 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
|
|
@clawsweeper re-review Added note below on proof limitations and the reuse of fetchAllGraphPages which is already used in production by listChannelsForTeam and listTeamsByName: Proof rationale: This change does not introduce new Graph API interactions — it reuses Unit test coverage:
L1 limitation: No live Teams tenant available. The |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Closing and replacing with rebased version — merging upstream main to resolve conflicts and bring the new |
Summary
fetchThreadRepliesonly fetched the first page (oldest 50 replies) from the Teams Graph API/repliesendpoint. For channel threads with more than 50 replies, the newest and most relevant replies were silently dropped from agent context.$top=50and returnedres.valuewithout following@odata.nextLinkpagination.fetchAllGraphPages(the existing pagination helper already used bylistChannelsForTeametc.) to walk all reply pages. When the total exceedslimit, select the newestlimitreplies bycreatedDateTimeand return them in chronological order.MAX_REPLY_PAGES = 50(up to 2500 replies scanned), matching the existing default infetchAllGraphPages.Linked context
fetchAllGraphPagesinstead of implementing custom pagination)fetchAllGraphPagesinextensions/msteams/src/graph.ts(existing pagination helper)Real behavior proof
Environment: Source-level fix; no live Teams tenant available for this contributor.
Steps:
fetchThreadRepliesnow callsfetchAllGraphPageswithmaxPages=50to collect all reply pageslimit, items are sorted bycreatedDateTimedescending, sliced tolimit, then re-sorted ascending for chronological agent contextcreatedDateTimesort to the front (treated as oldest)Evidence:
fetchAllGraphPages(graph.ts:288) is the same helper used bylistChannelsForTeamandlistTeamsByName— it follows@odata.nextLinkwith a hard page cap and has existing unit test coverage ingraph.test.tsgraph-thread.test.ts:fetchThreadRepliestests pass unchanged (path, $top clamp, empty)Untested:
Proof limitations:
createdDateTimesort is best-effort: items without timestamps sort to the front, so they are dropped first when over limitTests
Unit tests in
extensions/msteams/src/graph-thread.test.ts:# Expected (requires vitest setup): pnpm vitest run extensions/msteams/src/graph-thread.test.tsNew test cases added:
Risk
Current review state