Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 30, 2026, 12:33 AM ET / 04:33 UTC. ClawSweeper reviewWhat this changesMoves Microsoft Teams OAuth token exchange and refresh deadlines into guarded fetch and adds regression coverage for a stalled DNS preflight. Merge readiness⛔ Blocked before merge - 4 items remain This remains a useful P1 Teams delegated-auth repair: current main still places the deadline only on the HTTP request signal, while the guarded fetcher needs its top-level timeout to abort DNS/proxy preflight. The conflicting branch must be rebased without losing current-main token-envelope validation, and its injected transport proof is not sufficient real-behavior proof for an external PR. Priority: P1 Review scores
Verification
How this fits togetherThe Microsoft Teams plugin exchanges and refreshes delegated Azure tokens before Teams operations can use them. Its token request passes through OpenClaw's guarded fetcher, which performs DNS/proxy safety checks before dispatching HTTP. flowchart LR
A[Teams delegated auth] --> B[Token exchange or refresh]
B --> C[Guarded fetch]
C --> D[DNS and proxy preflight]
D --> E[Microsoft token endpoint]
C --> F[Delegated token or timeout error]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +33, Tests +58. Total +91 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase the focused timeout change onto current main, preserve token-envelope validation, and attach a redacted after-fix production-boundary transport trace showing stalled preflight timing out before HTTP dispatch. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main applies its deadline only to RequestInit.signal, while the guarded fetcher uses top-level timeoutMs to abort its DNS preflight. The submitted run supports that mechanism but is injected rather than a production transport reproduction. Is this the best way to solve the issue? Yes, conditionally: placing the timeout at the existing guarded-fetch owner is the narrow fix because that owner wraps DNS/proxy preflight. The branch must first be rebased so it preserves current-main token-response shape validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ecb0386e89b3. LabelsLabel justifications:
EvidenceWhat 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
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
|
Added standalone exact-head runtime proof (non-Vitest) on PR body updated with the transcript. @clawsweeper re-review |
|
@clawsweeper re-review Please finish review against the standalone exact-head non-Vitest proof already posted and reflected in the PR body ( Standalone proof comment: #111317 (comment) |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
What Problem This Solves
Fixes an issue where Microsoft Teams delegated token refresh / exchange could hang past the 10s token-fetch deadline when SSRF DNS/proxy preflight never completes.
fetchMSTeamsTokensonly aborted viaAbortSignal.timeout()oninit.signal, which does not cover guarded-fetch preflight, so a stalled lookup can leave the Teams channel unable to refresh auth and stay connected.Why This Change Was Made
Pass
MSTEAMS_DEFAULT_TOKEN_FETCH_TIMEOUT_MSas top-levelfetchWithSsrFGuard({ timeoutMs }), matching siblinggraph.ts/ Graph attachment callers and the post-#105549 guard-owned timeout contract. RemoveAbortSignal.timeout()fromRequestInit. Optional test-onlyfetchImpl/lookupFn/timeoutMshooks let the refresh entry point exercise the real guarded-fetch owner without mocking it away.User Impact
Before: Teams token refresh could hang indefinitely during DNS/proxy preflight despite the 10s token-fetch budget, leaving the channel disconnected after token expiry.
After: Refresh/exchange rejects with
TimeoutError/request timed outwhen preflight stalls, and HTTPfetchis never called.Evidence
bb797ba40c8751caaa17bc6aa7e23d2e13da1949extensions/msteams/src/oauth.token.tsrefreshMSTeamsDelegatedTokens→fetchMSTeamsTokens→fetchWithSsrFGuard({ timeoutMs })with never-resolvinglookupFnextensions/msteams/src/oauth.token.preflight-timeout.test.ts+ updatedoauth.test.ts(asserts top-leveltimeoutMs, noinit.signal)graph.tsalready forwards guardtimeoutMsUnit + preflight proof (exit 0)
Standalone exact-head runtime proof (exit 0, non-Vitest)
PROOF_ROOT=. PROOF_HEAD=$(git rev-parse HEAD) PROOF_TIMEOUT_MS=80 \ node --import tsx /tmp/msteams-token-preflight-timeout-proof.mjsReal behavior proof
Behavior or issue addressed: MS Teams token refresh/exchange no longer hangs when SSRF DNS/proxy preflight never completes; deadline is owned by
fetchWithSsrFGuardtimeoutMs.Canonical reachability path: Teams auth refresh →
refreshMSTeamsDelegatedTokens→fetchMSTeamsTokens→fetchWithSsrFGuard({ timeoutMs: MSTEAMS_DEFAULT_TOKEN_FETCH_TIMEOUT_MS })→ preflight lookup abort before HTTP dispatch.Boundary crossed: Azure AD token endpoint DNS/proxy preflight → local guarded-fetch timeout →
TimeoutError(request timed out).Shared helper / provider constraint check: Reuses
fetchWithSsrFGuardtop-leveltimeoutMs(notinit.signal/AbortSignal.timeout()). Aligns withextensions/msteams/src/graph.tsand fix(feishu): pass timeoutMs through app-registration guarded fetch #105549. Default remainsMSTEAMS_DEFAULT_TOKEN_FETCH_TIMEOUT_MS(10s). No new config/env.Real environment tested: macOS, Node via
node --import tsxstandalone harness on exact headbb797ba40c8751caaa17bc6aa7e23d2e13da1949(plus Vitest regression).Exact steps or command run after this patch:
PROOF_ROOT=. PROOF_HEAD=$(git rev-parse HEAD) PROOF_TIMEOUT_MS=80 node --import tsx /tmp/msteams-token-preflight-timeout-proof.mjsEvidence after fix: Standalone transcript above:
timed_out=true name=TimeoutError message=request timed out elapsed_ms=112 fetch_called=0thenPASS.Observed result after fix: Stalled preflight rejects with
TimeoutError/request timed outbefore HTTP dispatch (fetch_called=0).What was not tested: Live Azure AD token refresh with real tenant credentials; full 10s production-floor duration (proof uses an 80ms stand-in).
Fix classification: Root cause fix
AI-assisted (Cursor)
I understand what the code does
Change is focused and does not mix unrelated concerns