Files
openclaw/extensions/msteams/src/request-timeout.test.ts
colton-octaria dc8c0aaaf2 fix(msteams): recover inbound channel and group-chat files safely (#90738)
* fix(msteams): read file attachments on Teams channel messages

Three bugs blocked reading files attached to channel messages:
- Graph /teams/{id} used channelData.team.id (the 19:..@thread.tacv2 thread id)
  instead of team.aadGroupId (the AAD group GUID) -> 400.
- The Graph fetch was gated on an <attachment id> HTML marker that channel
  @mention activities don't carry -> fetch skipped.
- A thread reply was fetched at /messages/{replyId} (404) then fell back to the
  bare thread root, returning the root's file for every reply. Replies live at
  /messages/{root}/replies/{replyId}.

Fixes #89594

* fix(msteams): gate Graph media fallback on text/html stub; run trigger tests in channel context

* fix(msteams): canonicalize Graph attachment recovery

Build one canonical Graph message URL per Teams activity, recover marker-free channel and group-chat file shares, and retain bounded current-main attachment handling.

Co-authored-by: Colton Williams <colton@coltons-apps.tech>

* fix(msteams): canonicalize Graph media recovery

Recover channel and group-chat files through one fail-closed Graph identity path, bound inbound enrichment, and remove invalid app-only Graph fallbacks.

Co-authored-by: Colton Williams <colton@coltons-apps.tech>
Co-authored-by: Joshua Packwood <joshua.packwood@gmail.com>

---------

Co-authored-by: Colton Williams <colton@coltons-apps.tech>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Joshua Packwood <joshua.packwood@gmail.com>
2026-07-10 02:34:12 +01:00

24 lines
700 B
TypeScript

// Msteams tests cover shared inbound request deadlines.
import { describe, expect, it, vi } from "vitest";
import { withMSTeamsRequestDeadline } from "./request-timeout.js";
describe("withMSTeamsRequestDeadline", () => {
it("does not start work after the operation deadline has expired", async () => {
const work = vi.fn(async () => "late");
await expect(
withMSTeamsRequestDeadline({
deadline: {
label: "MS Teams inbound preprocessing",
timeoutMs: 10,
deadlineAtMs: Date.now() - 1,
},
label: "late Teams lookup",
work,
}),
).rejects.toThrow(/timed out/i);
expect(work).not.toHaveBeenCalled();
});
});