Repository navigation
fix(msteams): surface the Bot Framework/Graph HTTP body on send failures ENG-16131 - #54
Merged
Merged
Conversation
Outbound send/upload errors were formatted with `formatUnknownError(err)`,
which for an axios-shaped error (the Teams SDK Bot Connector client) returns
only the opaque default message "Request failed with status code 400". The
actual rejection reason from Bot Framework / Microsoft Graph lives on
`err.response.data` and was discarded, so operators saw an HTTP 400 with no
indication of *why* a file/message send was rejected.
- `extractErrorCode` now checks `response.data` in addition to `response.body`,
so error-code classification works for both the axios (Bot Connector) and
Graph SDK error shapes.
- New `formatMSTeamsErrorDetail(err)` appends the response body's
`{ error: { code, message } }` (or a stringified body) to the base message,
de-duplicating when the detail is already present.
- All five send-path catch blocks (send/file-send/proactive/edit/delete) now
use it in place of `formatUnknownError`.
This is diagnostic-only: no send behavior changes. It unblocks root-causing the
arguijo Teams `upload-file` HTTP 400 failures, whose true Graph reason is
currently invisible in the gateway log.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
I'll analyze this and get back to you. |
There was a problem hiding this comment.
Approved. Tight, well-scoped diagnostic PR.
- Scope is right: Part A (error surfacing) only, with the functional fix correctly deferred until a live failure prints the real Graph body — sound reasoning, no premature guessing.
extractResponseBodyDetailmirrors the both-body-shape loop (response.bodyGraph SDK +response.dataaxios/Bot Connector) already used inextractErrorCode; consistent, no duplicated concern, and the de-dup guard avoids doubling the base message.- All five catch blocks (send/file-send/proactive/edit/delete) swapped uniformly — additive, no behavior change.
- Tests cover the cases that matter: axios body code extraction, append, no-body fallback, de-dup, non-standard body stringify. 35 passing + tsgo/oxlint clean.
- No secrets, no new authz/injection surface; the stringified detail is Graph rejection reasons, not payload/PII.
Ship it.
|
I'll analyze this and get back to you. |
Author
|
/cr |
|
I'll analyze this and get back to you. |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
monac24
added a commit
that referenced
this pull request
Jul 16, 2026
Bump version to capture on top of boon.3: - #53 (ENG-15627 §5b/G4): report true operation outcome, not false terminal failure — kill/remove + non-terminal tool errors. - #54: surface the Bot Framework/Graph HTTP body on msteams send failures. Base = 2026.6.11-boon.3 (1bfc850). No code change in this commit — version bump only; the fixes are already merged on boon. Co-authored-by: Claude Opus 4.8 <[email protected]>
monac24
added a commit
that referenced
this pull request
Jul 16, 2026
The prepack changelog gate (scripts/package-changelog.mjs) requires a matching ## <version> section; the boon.4 version bump (#57) omitted it, failing boon-release.yml at the pack step. Add the section (#53 operation-outcome, #54 msteams send-failure body). Verified locally: extractCurrentPackageChangelog finds it. Co-authored-by: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
On the live arguijo host, every Teams
upload-fileaction fails with:Text replies to the same thread succeed — only file upload fails — so auth/connectivity is fine and the 400 is specific to how the send request is built. But the actual Bot Framework / Microsoft Graph rejection reason is invisible: the log only shows the opaque
Request failed with status code 400, so we can't tell which field Graph rejected.Root cause of the missing detail
The outbound send/upload catch blocks format the error with
formatUnknownError(err), which for anErrorjust returnserr.message. The Teams SDK Bot Connector client is axios-based, and axios puts the parsed response body onerr.response.data— which was never read. (extractErrorCodeonly looked aterr.response.body, the Graph-SDK shape.) So the real{ error: { code, message } }was discarded on every send failure.Change (diagnostic-only — no send behavior changes)
extractErrorCodenow checks bothresponse.data(axios / Bot Connector) andresponse.body(Graph SDK), so error-code classification works regardless of which client threw.formatMSTeamsErrorDetail(err)appends the response body'scode: message(or a stringified body) to the base message, de-duplicating when the detail is already contained in the base.formatMSTeamsErrorDetailin place offormatUnknownError.After this, the next live failure will log the concrete Graph/Connector reason (e.g. an unsupported-attachment-in-channel message), which is needed to land the actual functional fix for the channel
upload-file400.Scope note
This is deliberately Part A only (error surfacing). A suspected functional fix — gating the native
file.infocard to group chats and delivering a SharePoint share-link in channels — is intentionally not included, because that root cause can't be confirmed until this PR makes the real Graph error body visible. Follow-up will be a separate PR once a live failure prints the exact rejected field.Testing
extensions/msteams/src/errors.test.ts— new cases: error-code extraction from an axiosresponse.databody;formatMSTeamsErrorDetailappends the body, falls back to the base message, de-duplicates, and stringifies a non-standard body.vitest runmsteams errors + send suites: 35 passed.pnpm tsgo:extensionsandpnpm tsgo:extensions:test: clean (exit 0).oxlinton changed files: clean.Refs ENG-14349 / ENG-14431 (arguijo Teams attachment delivery).
🤖 Generated with Claude Code
Summary by cubic
Surface Bot Framework/Microsoft Graph error bodies on MS Teams send failures so logs show the real rejection reason instead of just “Request failed with status code 400”. No behavior changes; this unblocks diagnosing
upload-file400s on arguijo (ENG-14349, ENG-14431).extractErrorCodenow readsresponse.data(axios/Bot Connector) as well asresponse.body(Graph SDK).formatMSTeamsErrorDetail(err)to append{error.code}: message(or stringified body) to the base message, with de-duplication.formatUnknownErrorwith the new formatter across send paths (send, file upload, proactive, edit, delete).Written for commit ecc6c60. Summary will update on new commits.