Repository navigation
refactor(msteams): simplify attachment size and redirect handling - #130595
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 26, 2026, 10:23 PM ET / August 27, 2026, 02:23 UTC. ClawSweeper reviewWhat this changesThis PR replaces Microsoft Teams’ local inline-base64 size estimator with Node’s byte-length calculation, simplifies dispatcher-mode redirect handling, and expands attachment tests. Merge readinessKeep open: the refactor has one blocking test assertion that contradicts the configured authorization allowlist. The production redirect delegation is appropriately owned by the shared SSRF guard, but the focused test must be corrected before merge. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe Microsoft Teams plugin turns incoming attachment references into bounded local media. Its attachment fetch path applies Teams authorization rules, then delegates redirect and DNS-pinning enforcement to OpenClaw’s shared SSRF guard before saving media. flowchart LR
A[Teams attachment] --> B[Attachment downloader]
B --> C[Teams auth fallback]
C --> D[Attachment fetch policy]
D --> E[Shared SSRF guard]
E --> F[Redirect and DNS checks]
F --> G[Saved media]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource -52, Tests +59. Total +7 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Update the dispatcher-mode test to expect the allowed bearer token, retain the production refactor, and rerun the focused attachment suite plus exact-head CI. Do we have a high-confidence way to reproduce the issue? Yes—source inspection establishes that the focused dispatcher-mode test will observe the retained bearer token, contrary to its null-header assertion. The focused Vitest command in the PR body is the direct confirmation path, but was not run in this read-only review. Is this the best way to solve the issue? No: the test expectation is not the best validation because it asserts forbidden behavior for an allowlisted initial host. Expecting the configured bearer token preserves the intended authorization and redirect contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ba6034c27505. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Maintainer-requested cleanup of redundant Microsoft Teams attachment handling. The attachment owner repeats base64 size accounting after validation and retains a redirect loop whose later iterations cannot run, making the actual guard ownership harder to follow.
Why This Change Was Made
Use the already-imported
Buffer.byteLengthonly after the unchanged inline-base64 validator, and express the injected-dispatcher path as its existing single request. Keep initial DNS and hostname checks, redirect validation, authorization handling, response identity, and the normal SDK-owned five-redirect limit unchanged. No new dependency, SDK surface, configuration, or network policy.The existing auth-redirect test also injected a dispatcher through a downloader mock that is no longer called. Remove that ineffective setup and assert the actual guarded-fetch request sequence instead; strengthen the real dispatcher and inline-size boundary tests.
User Impact
No intended user-visible change. Existing attachment acceptance, limits, authorization, errors, and redirect behavior remain the same. Production LOC: +41/-93 (net -52); tests: +136/-77 (net +59), using standard Git diff.
Evidence
43be187b6727a47030dbbba4256eaad89937bded. The three affected files were unchanged on freshly checked main18c801daa1165f0bb7f30576b52f6642ff023233; related open Teams PRs did not supersede this cleanup.git diff --check, and the changed-code gate's initial/static/dead-export guards passed. The full local changed-code gate failed at extension type checking on stale or missing installed dependencies, with no Teams diagnostic: for example, installed CUA 0.19.3 versus pinned 0.20.0, pi-tui 0.82.1 versus 0.84.2, markdown-it 14.3.0 versus 15.0.0, and missing IMAP/geolocation packages. The shared dependency installation was left untouched. This is a recorded local gate failure, not a passing full gate; ordinary exact-head CI must supply the pinned type/lint proof before landing.aed33f24fb9636994e3b56daa1657bb08db26141, including production/test types, lint, guards, build artifacts and the full Teams test configuration: 96 files and 1,530 tests passed under Node 24 with Vitest 4.1.11. The hosted job used the frozen-lockfile setup and exercised all four focused attachment test files. This closes the pinned hosted validation gap without altering the local shared install.Focused command:
No separate full build was needed for this internal refactor: imports, lazy loading, package boundaries, and published surfaces are unchanged; ordinary CI's build-artifacts job passed. No live Teams tenant was exercised; no external API behavior is changed or claimed proven by these tests. Native preparation and merge verification remain required before landing.
AI-assisted; implementation and source contracts inspected.