Commit Graph

123 Commits

Author SHA1 Message Date
Peter Steinberger
8ec92f544c test: clarify extension resilience test names 2026-05-08 13:41:40 +01:00
Peter Steinberger
9ef37d1907 test: tighten assertions and harness coverage 2026-05-08 05:28:12 +01:00
Brandon
eecda912ee fix(msteams): surface network errors blocking bot JWT validation and outbound replies (#77674) (#78081)
* fix(msteams): surface network errors blocking Teams bot JWT validation and outbound replies (#77674)

When login.botframework.com or smba.trafficmanager.net egress is blocked,
errors previously disappeared completely. JWT validator swallowed network
errors and returned false (401 looked identical to a bad credential), and
outbound send failures with transport-level codes had no hint pointing to
the Connector endpoint.

- sdk.ts: rethrow ECONNREFUSED/ENOTFOUND/EHOSTUNREACH/ETIMEDOUT/ECONNRESET
  from the JWKS key fetch so callers can distinguish firewall blocks from bad
  credentials; add isJwksNetworkError() helper
- monitor.ts: catch rethrown network errors in JWT middleware and log at
  runtime.error level with an actionable message pointing to
  login.botframework.com:443; upgrade allowlist resolution failures from
  runtime.log (optional/silent) to runtime.error
- errors.ts: add "network" kind to classifyMSTeamsSendError for transport-level
  errors (ECONNREFUSED, ENOTFOUND, etc.); add formatMSTeamsSendErrorHint for
  "network" kind pointing to smba.trafficmanager.net and egress rules
- monitor-handler.ts, message-handler.ts: remove spurious ?. from runtime.error
  calls (RuntimeEnv.error is a required non-optional field)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(msteams): surface blocked botframework egress

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Brad Groux <3053586+BradGroux@users.noreply.github.com>
2026-05-05 23:11:06 -05:00
Alex Knight
6ae09d029c msteams: persist sent-message markers best-effort (#75585)
* msteams: persist sent-message markers best-effort

* docs: clarify Teams restart persistence changelog

* msteams: remove redundant sent-message TTL comment

* msteams: preserve sent-message marker TTL on recovery
2026-05-03 17:25:20 +10:00
Peter Steinberger
0fe007f71b refactor: trim extension test hooks 2026-05-01 14:32:30 +01:00
Peter Steinberger
ffe67e9cdc refactor(channels): route inbound turns through kernel 2026-04-30 04:08:47 +01:00
Peter Steinberger
02ebac6250 refactor(channels): share turn dispatch results 2026-04-30 02:58:40 +01:00
Peter Steinberger
9a9cd0c0ab refactor(channels): add shared turn kernel 2026-04-29 23:16:16 +01:00
Peter Steinberger
8866544ffe test: slim browser and msteams imports 2026-04-24 13:33:48 +01:00
Peter Steinberger
6f139dee2e perf: trim msteams authz graph mock 2026-04-24 00:09:16 +01:00
Peter Steinberger
bd49117a50 perf: slim msteams hot test imports 2026-04-24 00:04:48 +01:00
Peter Steinberger
039d1010fe test: fix landing gate helpers 2026-04-21 00:43:50 +01:00
Peter Steinberger
e2abd4bc62 test(ci): fix msteams and heartbeat red lanes 2026-04-20 23:33:49 +01:00
Peter Steinberger
85450b3da9 test: share msteams message handler mocks 2026-04-20 23:15:58 +01:00
Peter Steinberger
3f8ac729f2 test: share msteams runtime setup 2026-04-20 23:15:58 +01:00
Peter Steinberger
51da1f70fa test: share msteams message handler fixtures 2026-04-20 21:52:13 +01:00
lukeboyett
c39314c14a fix(agents): prefer target agent's bound Matrix account for subagent spawns (#67508)
Merged via squash.

Prepared head SHA: 9300111038
Co-authored-by: lukeboyett <46942646+lukeboyett@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
2026-04-18 14:02:53 -04:00
pashpashpash
383c854313 CI: fix mainline regression blockers (#65269)
* MSTeams: align logger test expectations

* Gateway: fix CI follow-up regressions

* Config: refresh generated schema baseline

* VoiceCall: type webhook test doubles

* CI: retrigger blocker workflow

* CI: retrigger retry workflow

* Agents: fix current mainline agentic regressions

* Agents: type auth controller test mock

* CI: retrigger blocker validation

* Agents: repair OpenAI replay pairing order
2026-04-13 06:18:37 +09:00
Vincent Koc
b62251817e fix(msteams): restore graph media diagnostics 2026-04-12 09:17:09 +01:00
sudie-codes
2c211d171e fix(msteams): channel file attachments broken by overly-broad HTML fallback (#58617, #51749) (#64645)
* fix(msteams): gate channel attachment fallback on <attachment> tags (#58617, #51749)

* test(msteams): remove dead mock branch in graph.test.ts
2026-04-11 23:33:07 -05:00
Vincent Koc
37ddd018fb test(msteams): share reaction handler harness 2026-04-12 05:25:58 +01:00
Vincent Koc
d00ab06048 test(msteams): share thread handler test setup 2026-04-12 03:21:55 +01:00
sudie-codes
2084441b51 fix(msteams): SharePoint media fetch fails on Node 24+ (#63396) (#64652)
* fix(msteams): fix SharePoint media fetch on Node 24+ and stop swallowing errors (#63396)

* fix(msteams): extend Node 24 dispatcher fix to Bot Framework attachment view downloads
2026-04-11 19:53:26 -05:00
Vincent Koc
8a7ad8f0e0 fix(msteams): remove reaction handler type cycle 2026-04-11 14:55:25 +01:00
sudie-codes
355794c24a msteams: add reaction support with delegated auth and pagination helper (#51646)
* msteams: add reaction support (inbound handlers + outbound Graph API)

* msteams: address PR #51646 review feedback

* msteams: remove react from advertised actions (requires Delegated auth)

* msteams: address PR #51646 remaining review feedback (dmPolicy, groupPolicy, reactions auth)

- Fix 1: DM reaction authorization now uses resolveDmGroupAccessWithLists to enforce
  dmPolicy modes (open/disabled/allowlist/pairing), matching the message handler.
- Fix 2: Group policy in reaction handler already uses resolveDefaultGroupPolicy
  for global defaults; moved declaration earlier to share with DM path.
- Fix 3: Restore read-only "reactions" (list) action with listReactionsMSTeams,
  which uses GET and works with Application auth. Keep "react" (write) gated
  behind delegated-auth.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: add shared Graph pagination helper (fetchAllGraphPages)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: add OAuth2 delegated auth flow (PKCE + authorization code)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: integrate delegated auth (config, token storage, react enablement)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: fix critical bugs found in architect review

- Fix fetchGraphJson→postGraphJson for setReaction/unsetReaction (was sending GET instead of POST)
- Fix CSRF bypass in OAuth parseCallbackInput (missing state no longer falls back silently)
- Remove stale delegated-auth warning logs (delegated auth is now implemented)
- Add CSRF test case for parseCallbackInput

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: fix 6 PR #51646 review blockers (PKCE/state separation, CSRF, imports, routing, delegated auth bootstrap)

* msteams: fix channel.runtime.ts duplicate imports + graph.ts test mock compat

* msteams: fix lint/boundary blockers revealed by CI after rebase

- token.ts/graph.test.ts: add curly braces around single-statement ifs
  (eslint/curly).
- oauth.flow.ts: rename unused parseCallbackInput param to _expectedState.
- reaction-handler.test.ts: rename unused buildDeps param to _runtime.
- send.reactions.ts: drop unnecessary non-null assertions on tuple entries.
- setup-surface.ts: drop empty-object spread fallback flagged by
  unicorn/no-useless-fallback-in-spread.
- graph.ts: move GraphPagedResponse/PaginatedResult type defs below
  requestGraph so the raw fetch() stays on line 47 to match the existing
  no-raw-channel-fetch allowlist entry.
- oauth.token.ts: route the Azure AD token exchange and refresh calls
  through fetchWithSsrFGuard (matches the pattern in sdk.ts), removing
  the unguarded raw fetch() callsites flagged by
  lint:tmp:no-raw-channel-fetch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(msteams): restore absolute Graph pagination helper

* fix(msteams): satisfy reaction handler lint

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Brad Groux <3053586+BradGroux@users.noreply.github.com>
2026-04-11 07:41:47 -05:00
sudie-codes
0f19271092 msteams: add message actions — pin, unpin, read, react, reactions (#53432)
* msteams: add pin/unpin, list-pins, and read message actions

Wire up Graph API endpoints for message read, pin, unpin, and list-pins
in the MS Teams extension, following the same patterns as edit/delete.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: address PR review comments for pin/unpin/read actions

- Handle 204 No Content in postGraphJson (Graph mutations may return empty body)
- Strip conversation:/user: prefixes in resolveConversationPath to avoid Graph 404s
- Remove dead variable in channel pin branch
- Rename unpin param from messageId to pinnedMessageId for semantic clarity
- Accept both pinnedMessageId and messageId in unpin action handler for compat

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: resolve user targets + add User-Agent to Graph helpers

- Resolve user:<aadId> targets to actual conversation IDs via conversation
  store before Graph API calls (fixes 404 for DM-context actions)
- Add User-Agent header to postGraphJson/deleteGraphRequest for consistency
  with fetchGraphJson after rebase onto main

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: resolve DM targets to Graph chat IDs + expose pin IDs

- Prefer cached graphChatId over Bot Framework conversation IDs for user
  targets; throw descriptive error when no Graph-compatible ID is available
- Add `id` field to list-pins rows so default formatters surface the pinned
  resource ID needed for the unpin flow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: add react and reactions (list) message actions

* msteams: fix reaction count undercount and remove unpin messageId fallback

* msteams: wire pinnedMessageId through CLI/tool schema, add channel pin beta warnings, add list-pins pagination

* msteams: address PR #53432 remaining review feedback

* fix(msteams): route channel actions via teamId/channelId path (#53432)

* msteams: add unpin pinnedMessageId test coverage (#53432)

* fix(msteams): keep graph routing scoped to graph actions

* fix(msteams): align graph routing context types

* msteams: route fetchGraphAbsoluteUrl through fetchWithSsrFGuard

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Brad Groux <3053586+BradGroux@users.noreply.github.com>
2026-04-10 20:25:57 -05:00
Peter Steinberger
270630ba35 refactor: simplify channel setup conversions 2026-04-11 01:11:05 +01:00
Peter Steinberger
11b0016e9e refactor: simplify provider channel conversions 2026-04-11 01:08:23 +01:00
Peter Steinberger
bc27278d6d test: fix msteams thread parent fixture 2026-04-10 20:50:44 +01:00
sudie-codes
01ea7e4921 feat(msteams): auto-inject parent message context for thread replies (#54932) (#63945)
* feat(msteams): auto-inject parent message context for thread replies (#54932)

* msteams: use Promise.allSettled for thread context, remove no-op buildInjectedKey

* fix(msteams): gate thread parent context by visibility

---------

Co-authored-by: Brad Groux <3053586+BradGroux@users.noreply.github.com>
2026-04-10 14:42:02 -05:00
Peter Steinberger
527601d7a5 fix: align channel owner context test types 2026-04-10 18:14:14 +01:00
sudie-codes
2b5b58194b fix(msteams): include tenantId and aadObjectId on proactive sends (#58774) (#63949)
* fix(msteams): capture and forward tenantId/aadObjectId on proactive sends (#58774)

* msteams: preserve tenantId/aadObjectId on sparse merges, thread recipientId on proactive sends
2026-04-10 12:09:14 -05:00
Vincent Koc
8c88fb68b7 fix(msteams): align handler tests with conversation store 2026-04-10 09:03:10 +01:00
sudie-codes
828ebd43d4 feat(msteams): handle signin/tokenExchange and signin/verifyState for SSO (#60956) (#64089)
* feat(msteams): handle signin/tokenExchange and signin/verifyState for SSO (#60956)

* test(msteams): mock conversationStore.get in thread session fixture

---------

Co-authored-by: Brad Groux <bradgroux@users.noreply.github.com>
2026-04-10 02:38:01 -05:00
Vincent Koc
4a275cf6b1 fix(extensions): split shared runtime type seams 2026-04-10 08:16:27 +01:00
Tak Hoffman
4bf94aa0d6 feat: add local exec-policy CLI (#64050)
* feat: add local exec-policy CLI

* fix: harden exec-policy CLI output

* fix: harden exec approvals writes

* fix: tighten local exec-policy sync

* docs: document exec-policy CLI

* fix: harden exec-policy rollback and approvals path checks

* fix: reject exec-policy sync when host remains node

* fix: validate approvals path before mkdir

* fix: guard exec-policy rollback against newer approvals writes

* fix: restore exec approvals via hardened rollback path

* fix: guard exec-policy config writes with base hash

* docs: add exec-policy changelog entry

* fix: clarify exec-policy show for node host

* fix: strip stale exec-policy decisions
2026-04-10 01:16:03 -05:00
Pengfei Ni
78389b1f02 fix(msteams): resolve Graph chat ID for personal DM media downloads (#62219) (#63063)
* fix(msteams): resolve Graph chat ID for personal DM media downloads (#62219)

Bot Framework personal DM conversation IDs use an opaque `a:...` format
that the Graph `/chats/{chatId}/messages` endpoint rejects as "Invalid
ThreadId". When the direct Bot Framework attachment download fails and
the code falls back to the Graph API path, inbound media (images, files)
is silently dropped.

Resolve the real Graph chat ID via `resolveGraphChatId()` before
constructing Graph message URLs, with conversation-store caching so
subsequent messages skip the API lookup.

* fix(msteams): preserve graphChatId across conversation store upserts

mergeStoredConversationReference only preserved timezone from the
existing entry — graphChatId was silently overwritten on every
activity-triggered upsert, defeating the cache and causing repeated
Graph API lookups on every DM turn.

Mirror the existing timezone guard so graphChatId survives upserts
that don't carry it.
2026-04-09 22:57:02 -05:00
sudie-codes
ab9be8dba5 fix(msteams): fetch DM media via Bot Framework path for a: conversation IDs (#62219) (#63951)
* fix(msteams): fetch DM media via Bot Framework path for a: conversation IDs (#62219)

* fix(msteams): log skipped BF DM media fetches

---------

Co-authored-by: Brad Groux <bradgroux@users.noreply.github.com>
2026-04-09 21:04:11 -05:00
sudie-codes
9edfefedf7 fix(msteams): route thread replies to correct thread via replyToId (#58030) (#62715) 2026-04-08 21:22:09 -05:00
sudie-codes
38aa1edf76 fix(msteams): isolate channel thread sessions by replyToId (#58615) (#62713)
* fix(msteams): isolate thread sessions by replyToId (#58615)

* fix(msteams): align thread ID extraction + fix test types
2026-04-08 21:22:05 -05:00
Peter Steinberger
46480f531a test: dedupe msteams authz fixtures 2026-04-08 10:43:48 +01:00
Agustin Rivera
a31cb15561 Guard missed base64 decode paths (#62007)
* fix(media): guard missed base64 decode paths

Co-authored-by: zsxsoft <git@zsxsoft.com>

* fix(media): wire maxBytes into image-generate-tool and consolidate base64 guard helpers

* docs(changelog): add base64 decode guard entry

* fix(image-generate): validate configured media cap

---------

Co-authored-by: zsxsoft <git@zsxsoft.com>
Co-authored-by: Devin Robison <drobison@nvidia.com>
2026-04-07 15:25:19 -06:00
Peter Steinberger
a15a5a1edc refactor: dedupe lowercase helper readers 2026-04-07 13:44:41 +01:00
Peter Steinberger
625fd5b3e3 refactor: centralize inbound mention policy 2026-04-07 07:51:00 +01:00
Vincent Koc
cd09f41fe0 fix(ci): repair extension test and msteams seams 2026-04-06 23:17:48 +01:00
Peter Steinberger
0b7f6fa9d0 refactor: dedupe msteams handler record helper 2026-04-06 22:54:48 +01:00
Peter Steinberger
af62a2c2e4 style: fix extension lint violations 2026-04-06 14:53:55 +01:00
Peter Steinberger
5c32dddb1c fix(ci): restore heartbeat task batching checks 2026-04-04 15:09:48 +01:00
Peter Steinberger
87d840e9ee fix: tighten Teams and device typing 2026-04-04 19:39:22 +09:00
Brad Groux
fce81fccd8 msteams: add typingIndicator config and prevent duplicate DM typing indicator (#60771)
* msteams: add typingIndicator config and avoid duplicate DM typing

* fix(msteams): validate typingIndicator config

* fix(msteams): stop streaming before Teams timeout

* fix(msteams): classify expired streams correctly

* fix(msteams): handle link text from html attachments

---------

Co-authored-by: Brad Groux <bradgroux@users.noreply.github.com>
2026-04-04 04:34:24 -05:00