Skip to content

fix(msteams): add timeouts to file consent upload requests - #104120

Merged
steipete merged 24 commits into
openclaw:mainfrom
Alix-007:alix/msteams-file-consent-upload-timeouts
Jul 14, 2026
Merged

steipete merged 24 commits into
openclaw:mainfrom
Alix-007:alix/msteams-file-consent-upload-timeouts

Conversation

@Alix-007

@Alix-007 Alix-007 commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Microsoft Teams file-consent acceptance returns an upload URL that the bot must PUT the file contents to. OpenClaw validated that URL, then used a bare fetch; a server that accepted bytes but withheld its response could keep the delivery path pending indefinitely. See Microsoft's file handling flow.

Why This Change Was Made

Route the consent upload through the existing public SDK fetchWithTimeout primitive instead of maintaining a second abort-race helper. The Teams plugin owns only its transfer policy: a five-minute floor plus payload size at 256 KiB/s, so large valid uploads receive additional time while every request remains bounded.

The final maintainer refactor also integrates current main export cleanup: timeout constants stay private, no dead-export baseline exception is added, and the existing HTTPS/SSRF validation plus PUT headers/body and non-2xx behavior remain unchanged.

User Impact

Stalled Teams file-consent uploads now fail with TimeoutError and close the underlying request instead of hanging forever. Valid slow uploads retain a size-aware deadline rather than a fixed five-minute ceiling.

Evidence

  • Exact PR head: 3f8fdb45271b09c1405aebc11464b3be1f47ff7b.
  • AWS Crabbox run_4ece06726c26: 83/83 focused tests passed; path-scoped check:changed passed formatting, SDK baseline, dependency guards, production/test typechecks, lint, database-first guard, sidecar guard, and import-cycle checks.
  • AWS Crabbox live HTTPS run_3376de0cd177: production uploadToConsentUrl sent a real 1 KiB PUT to a loopback TLS server, raised TimeoutError after 277 ms when the response stalled, and closed the response. A separate delayed 2 KiB PUT completed in 82 ms with the expected method, content range, content type, and byte count.
  • Fresh autoreview: no accepted or actionable findings; full maintained branch confidence 0.97, final test correction confidence 0.99.
  • Hosted CI run 29352195235 covers this exact head.
  • Known live-proof gap: no authenticated Microsoft Teams tenant/SharePoint upload was available; the exact production transport path was exercised against a real HTTPS server instead.

@openclaw-barnacle openclaw-barnacle Bot added channel: msteams Channel integration: msteams size: S labels Jul 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 14, 2026, 6:53 AM ET / 10:53 UTC.

Summary
Adds bounded, size-aware abort timeouts to Microsoft Teams file-consent upload PUT requests and regression coverage for stalled and slow-success transfers.

PR surface: Source +72, Tests +147, Other +2. Total +221 across 5 files.

Reproducibility: yes. at source level: current main directly awaits the consent upload fetch without a deadline, and the supplied stalled HTTPS harness exercises the same path. A live Microsoft tenant reproduction was not performed.

Review metrics: 1 noteworthy metric.

  • Runtime deadline policy: 1 added: 300s base plus 256 KiB/s size budget. This becomes the default failure boundary for previously unbounded personal-chat file uploads and therefore needs explicit compatibility review.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] The new default intentionally changes valid existing behavior from an indefinite wait to failure after a five-minute base plus a 256 KiB/s transfer allowance; a sufficiently slow but still valid tenant upload could now fail.
  • [P1] The production transfer rate and base deadline have controlled HTTPS proof but no live Microsoft Teams tenant or SharePoint proof, so the compatibility threshold remains an owner judgment rather than a correctness defect.
  • [P2] This PR and fix(msteams): add timeouts to SharePoint file send requests #104288 modify the same timeout helper and policy; landing them without an explicit order risks conflict or policy drift between personal-chat and group/channel uploads.

Maintainer options:

  1. Approve the shared transfer policy (recommended)
    Accept the bounded behavior change, land this PR first, and require the overlapping SharePoint-send PR to rebase and reuse the resulting helper exactly.
  2. Merge the timeout work together
    Consolidate both Microsoft Teams upload paths into one PR so the helper, constants, tests, and transport proof cannot drift.
  3. Wait for live-tenant calibration
    Pause the timeout changes until maintainers have representative Microsoft tenant evidence for the five-minute base and 256 KiB/s allowance.

Next step before merge

  • [P2] An MS Teams owner should approve the permanent transfer budget and landing order with the overlapping PR; there is no concrete code defect for automated repair.

Maintainer decision needed

  • Question: Should Microsoft Teams file uploads adopt the proposed five-minute base plus 256 KiB/s size budget, with this file-consent PR landing before the overlapping SharePoint-send PR?
  • Rationale: Source, tests, and controlled HTTPS proof establish correctness, but neither Microsoft’s contract nor live-tenant evidence determines OpenClaw’s permanent minimum transfer rate or the preferred landing order for the shared helper.
  • Likely owner: steipete — The strongest current-main history signal is the recent file-consent boundary and test work in commit 347f7b9.
  • Options:
    • Approve and sequence (recommended): Approve the proposed transfer policy, land this narrower consent-upload change first, then rebase the SharePoint-send PR onto the shared helper.
    • Consolidate both paths: Pause this PR and combine the personal-consent and group/channel timeout changes into one owner-reviewed PR with one policy and proof set.
    • Require tenant calibration: Pause both PRs until a real Teams tenant upload demonstrates that the proposed deadline safely covers representative slow transfers.

Security
Cleared: The diff adds no dependency, workflow, permission, credential, or new network target, and the existing HTTPS, hostname, DNS, and private-address validation still runs before the upload.

Review details

Best possible solution:

Use one plugin-local abortable timeout helper and one owner-approved transfer policy across personal consent and SharePoint upload paths, landing this narrower PR first and rebasing #104288 onto it.

Do we have a high-confidence way to reproduce the issue?

Yes at source level: current main directly awaits the consent upload fetch without a deadline, and the supplied stalled HTTPS harness exercises the same path. A live Microsoft tenant reproduction was not performed.

Is this the best way to solve the issue?

Yes, conditionally: a shared plugin-local abortable timeout is the narrowest maintainable layer and supports the sibling SharePoint path, but the concrete production budget and landing order need owner approval.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e0fd84b019ab.

Label changes

Label justifications:

  • P2: The PR fixes a real but limited Microsoft Teams file-delivery hang without evidence of broad runtime outage or data loss.
  • merge-risk: 🚨 compatibility: Existing uploads that would eventually complete below the proposed effective transfer rate will now fail at the new deadline.
  • merge-risk: 🚨 message-delivery: A deadline that is too short can prevent an accepted Teams file from being uploaded and the final file card from being delivered.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR provides redacted real HTTPS loopback output showing an actual stalled PUT abort and a delayed successful PUT through the production upload helper; no further contributor proof is required.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR provides redacted real HTTPS loopback output showing an actual stalled PUT abort and a delayed successful PUT through the production upload helper; no further contributor proof is required.
Evidence reviewed

PR surface:

Source +72, Tests +147, Other +2. Total +221 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 83 11 +72
Tests 2 156 9 +147
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 5 241 20 +221

What I checked:

  • Current main remains unbounded: Current main validates the consent URL and awaits the upload fetch without an AbortSignal or other deadline, so a server that never responds can leave the accepted upload path pending indefinitely. (raw.githubusercontent.com) (extensions/msteams/src/file-consent.ts:198, e0fd84b019ab)
  • User-visible caller path: The consent invoke handler waits for uploadToConsentUrl before replacing the consent card; it surfaces an upload-failed message only after that promise rejects, confirming why an unbounded fetch stalls delivery. (raw.githubusercontent.com) (extensions/msteams/src/file-consent-invoke.ts:54, e0fd84b019ab)
  • Patch owner boundary: The PR routes the PUT through a reusable plugin-local abortable request-timeout helper and derives the default from payload size, rather than adding core policy or a new configuration surface. (extensions/msteams/src/file-consent.ts:216, effac1cc4d19)
  • Regression coverage: The PR adds focused coverage for stalled-request abortion, success before the deadline, success after the five-minute base bound when size budget remains, timeout resolution, and timer cleanup. (extensions/msteams/src/file-consent.test.ts:296, effac1cc4d19)
  • Real transport proof: The contributor exercised the production upload helper through real loopback HTTPS PUT requests: the stalled response raised TimeoutError and the delayed successful response completed with the expected method, headers, body, and abort signal. (extensions/msteams/src/file-consent.ts:216, 3702e4702fe5)
  • Microsoft contract: Microsoft documents that personal-chat FileConsentCard acceptance supplies an upload URL that the bot PUTs file contents to; the documentation does not prescribe a transfer timeout, leaving the concrete budget as OpenClaw policy. (learn.microsoft.com)

Likely related people:

  • steipete: Commit 347f7b9 recently changed the consent invoke/upload boundary and its regression tests, making this the strongest current-main routing signal. (github.com) (role: recent file-consent area contributor; confidence: high; commits: 347f7b955006; files: extensions/msteams/src/file-consent-invoke.ts, extensions/msteams/src/monitor-handler.file-consent.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (17 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-12T00:27:21.558Z sha 3702e47 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-12T10:12:46.255Z sha bd5ce86 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-13T03:44:31.559Z sha d152f5b :: needs maintainer review before merge. :: none
  • reviewed 2026-07-13T11:46:14.112Z sha 2c42b16 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-13T15:59:38.867Z sha d023e37 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-14T02:22:25.915Z sha ac491df :: needs maintainer review before merge. :: none
  • reviewed 2026-07-14T02:41:28.866Z sha ac491df :: needs maintainer review before merge. :: none
  • reviewed 2026-07-14T10:30:45.200Z sha effac1c :: needs maintainer review before merge. :: none

@Alix-007
Alix-007 force-pushed the alix/msteams-file-consent-upload-timeouts branch from c6ba570 to d3354ef Compare July 11, 2026 04:27
@Alix-007
Alix-007 force-pushed the alix/msteams-file-consent-upload-timeouts branch from d3354ef to 2778bc8 Compare July 11, 2026 04:33
@Alix-007

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated exact head to 2778bc8d69c01e6c54e40e76f6068b4e2f03ae9b and addressed the timeout compatibility concern from the previous review.

Changes since the prior review:

  • Rebased onto current upstream/main.
  • Changed the default Teams file consent upload deadline from 30 seconds to 5 minutes, matching this path's large-file transfer role instead of treating it like a short control-plane request.
  • Added a slow-success regression test proving uploads that complete before the request timeout are not aborted.

Validation:

node scripts/run-vitest.mjs extensions/msteams/src/file-consent.test.ts
-> 1 file passed, 65 tests passed

git diff --check
-> clean

corepack pnpm exec oxlint --tsconfig config/tsconfig/oxlint.extensions.json extensions/msteams/src/file-consent.ts extensions/msteams/src/file-consent.test.ts
-> passed

Redacted real HTTP proof from the current head:

local HTTP PUT /stall accepts the request and never sends response headers
local HTTP PUT /slow-success responds after 75ms
uploadToConsentUrl timeoutMs=80 for /stall, timeoutMs=200 for /slow-success

Output:

stalled-put: AbortError after 86ms
slow-success-put: completed in 92ms

This keeps the Teams consent upload request bounded, while proving a representative slow successful upload remains allowed before the deadline.

@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 11, 2026
@Alix-007

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated exact head to a9606ced82c4f8591b562e60c97a55539da0d560.

Changes since the prior review:

  • Moved the abortable request timeout helper into extensions/msteams/src/request-timeout.ts instead of keeping a private file-consent.ts helper.
  • Moved the five-minute Teams upload deadline into the same shared timeout owner and reused it from file-consent upload PUTs.
  • Preserved the SSRF validation, consent upload headers/body semantics, and the existing stalled/slow-success tests.

Validation:

node scripts/run-vitest.mjs extensions/msteams/src/file-consent.test.ts extensions/msteams/src/request-timeout.test.ts
-> 2 files passed, 66 tests passed

node_modules/.bin/oxlint extensions/msteams/src/request-timeout.ts extensions/msteams/src/file-consent.ts extensions/msteams/src/file-consent.test.ts
-> passed

node_modules/.bin/oxfmt --check extensions/msteams/src/request-timeout.ts extensions/msteams/src/file-consent.ts extensions/msteams/src/file-consent.test.ts
-> passed

git diff --check
-> clean

@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 13, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 13, 2026
@steipete steipete self-assigned this Jul 14, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed scripts Repository scripts size: M labels Jul 14, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer pass complete; ready to land at 3f8fdb45271b09c1405aebc11464b3be1f47ff7b.

What changed:

  • Replaced the PR-local abort race with the existing public SDK fetchWithTimeout path.
  • Kept the size-aware five-minute-plus-transfer-budget policy inside the Teams plugin.
  • Integrated current-main export cleanup: private policy constants, no dead-export baseline exception.
  • Tightened the abort fake so Promise rejections remain real Error instances.

Proof:

  • AWS Crabbox run_4ece06726c26: pnpm test extensions/msteams/src/file-consent.test.ts extensions/msteams/src/request-timeout.test.ts — 83/83 passed; path-scoped pnpm check:changed passed formatting, SDK baseline, typechecks, lint, guards, and import-cycle checks.
  • AWS Crabbox run_3376de0cd177: real HTTPS 1 KiB stalled PUT raised TimeoutError after 277 ms and closed the response; delayed 2 KiB PUT completed in 82 ms with correct PUT headers/body.
  • Hosted exact-head CI 29352195235: green, including openclaw/ci-gate.
  • Fresh autoreview: no accepted/actionable findings.

Known gap: no authenticated Teams tenant/SharePoint upload was available. The exact production upload function and real TLS transport were exercised locally; Microsoft's documented consent-upload contract does not add a separate timeout requirement.

Sibling #104288 covers a different group/channel SharePoint path and can adopt the same shared primitive independently; it does not block this consent-upload fix.

@steipete
steipete merged commit 0c8220e into openclaw:main Jul 14, 2026
102 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 15, 2026
…104120)

* fix(msteams): add timeouts to file consent upload requests

* fix(msteams): share file consent upload timeout helper

* fix(msteams): size-budget file consent upload timeout

* chore(deadcode): allowlist test-only timeout constant exports

* style(msteams): format consent timeout test

* test(msteams): reject consent aborts with errors

---------

Co-authored-by: Peter Steinberger <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…104120)

* fix(msteams): add timeouts to file consent upload requests

* fix(msteams): share file consent upload timeout helper

* fix(msteams): size-budget file consent upload timeout

* chore(deadcode): allowlist test-only timeout constant exports

* style(msteams): format consent timeout test

* test(msteams): reject consent aborts with errors

---------

Co-authored-by: Peter Steinberger <[email protected]>
steipete added a commit that referenced this pull request Oct 14, 2026
…of diagnostics (#171606)

## What Problem This Solves

Older channel-plugin code duplicates shared SDK ownership and carries defensive machinery for unsupported internal inputs, synthetic clocks, and throwing diagnostic hooks. Several normal inbound paths also put message content or pairing codes into diagnostics.

## User Impact

Message delivery, account/security policy, conversation identity, provider features, and ordinary shutdown/restart durability remain supported. Inbound message text, malformed Teams consent payloads and pairing codes no longer appear in the repaired diagnostic paths. No configuration, CLI, protocol, SDK export, dependency, schema, retention, or permission changes are required.

## Why This Change Was Made

This is the second old-code channel-plugin pass. Only production files with no origin/main commit in the preceding seven days are included; eligibility is refreshed before every push. The overlapping Feishu Markdown fence repair was removed from this branch once main independently landed it in #171222.

The packet removes **512 net production lines** (+503/-1015; tests, fixtures, test support, generated files, and declarations excluded). It reuses existing public SDK owners for plugin setup composition, secret-contract wiring, receipts, status summaries, process-global maps, error traversal, and account-scoped DM policy. There are no private-core or cross-plugin imports.

## Best-effort tradeoffs accepted

Each removed mechanism below was checked against callers, dependency behavior, and introducing history. Synthetic tests and hypothetical PR race descriptions are not treated as human production reports. Actual incident fixes, live security authority, FIFO, resource bounds, and accepted-write settlement are retained.

- Discord identify clock-skew observation (`c767b37e3b2`): the only added proof jumps the clock from a trillion milliseconds to zero; no human report is linked. A drastic backward clock jump can now prolong reconnect until clock recovery/restart; ordinary five-second parallel identify spacing remains.
- WhatsApp second synchronous close observation (#109886, `bf413374cca`): native Baileys uses EventEmitter and cannot asynchronously close between synchronous check/listener registration. A nonstandard reentrant `newListener` hook can reach the existing bounded timeout; transport-confirmed close and cleanup remain.
- Tlon formatter fallback (#1837, `51720980736`): validated decimal BigInt input cannot fail the pinned @ud formatter. A broken dependency now fails visibly instead of sending the incorrect raw ID that the original threading fix rejected.
- Matrix second private sync waiter (#62779, `0c00c3c2306`): the actual monitor waits once; only a synthetic test calls twice. An unsupported second call may replace the first callbacks; real outage/fatal/abort settlement remains.
- ClickClack outer setup catches (`752567dbc8e`): network/config failures are already caught by their owners; the extra path catches a broken logger/formatter then invokes the same logger again. Such internal failures now surface; ordinary setup diagnostics remain.
- ClickClack second workspace snapshot (`3e352d67278`): verification now resolves ID/name/slug from one provider response. A concurrent rename/removal is observed on the next verification/runtime request rather than an opportunistic second fetch.
- SMS generated-fragment revalidation (#118665, `0758316883f`): raw URL validation stays; only URLSearchParams-generated fragment bytes were checked twice. A monkeypatched/broken encoder is no longer revalidated; length, auth, URL and retry bounds remain.
- Feishu timeout-warning catch (`0028e6040a7`): the cited stuck-task/FIFO issues concern the retained five-minute cap, not a throwing logger. A broken warning hook now rejects that queue call visibly; subsequent same-key work continues.
- Feishu private timeout customization (`0028e6040a7`, `fab8d29d211`, #101949): only tests passed disabled/oversized/custom values. Unsupported direct imports can no longer tune/disable the private cap; all production callers retain five-minute progress/FIFO behavior.
- Reef logger-fatal deferred/race (#162669; synthetic hook in #110870): ordinary transport-error containment and shutdown from the recorded live relay incident stay. A throwing error logger is reported by the scheduler instead of intentionally killing an otherwise healthy inbox.
- Matrix nonfinite media size fallback (`9b71382efb6`, #149128): the sole production producer passes Buffer.byteLength; NaN cases were synthetic cleanup fixtures. Unsupported private NaN calls now carry that supplied value; MIME, encryption, image fields and duration remain.
- Buzz subscription count coercion (`6c7a96e588e`): the sole caller supplies array.length. Unsupported negative/fractional private values are not repaired; the actual room/resource cap remains.
- Teams upload-byte coercion (#104120, `0c8220ebf9a`): both callers supply Buffer.length. Unsupported malformed private counts follow transfer arithmetic; timer clamping and upload budgets stay.
- Nostr zero-count score fallback (`7b6cbf58697`): private entries are synchronously created and incremented together. An unsupported new zero-outcome insertion could score NaN; actual outage/circuit-breaker/failover behavior stays.
- Buzz profile-limit coercion (`ba2510e8fa8`): the only explicit producer supplies the bounded integer budget. Unsupported direct malformed limits are not normalized; ordinary caps, zero-budget and untrusted-event checks stay.
- Feishu card-launcher clock injection/max-Date guard (`05634708e05`): only a synthetic year-275760 test supplies the private clock. A corrupt clock may create an unusable expiry until recovery/restart; effect-side expiry, actor/chat and approval validation stay.
- QA private empty media-batch guard (#115290, `641c82b5bd0`): all three callers prove a nonempty batch. Unsupported direct empty calls take the ordinary text path; real media caps and atomic loading remain.
- Slack private global-map slot revalidation (original sharing fix `55318df83ff`): normal module sharing/replacement is retained. No human private-slot corruption report is linked; third-party mutation/deletion of our private Symbol slot is no longer checked on every read, and restart repairs unsupported corruption.
- Buzz synchronous subscription-construction compensation (`b48984792f4`, `828f88c5ca5`, #130300): native nostr-tools construction emits no callbacks and authored filters are plain/nonempty. Unsupported throwing/cyclic private filters or replaced constructors surface without immediate count/generation/timer compensation; close/deadline/restart recovers temporary state.
- Buzz post-construction inline-EOSE/abort retry (same provenance): native callbacks are asynchronous. A non-native constructor emitting EOSE inline no longer gets a second cleanup attempt; real EOSE-before-CLOSE, late EOSE, close-once, deadlines, queued slots, abort listeners, membership authority and shutdown remain. Fixtures now schedule EOSE with queueMicrotask while retaining assertions.
- Signal clean-end recovery duplication (#10240, `dff4a04c1f5`): clean EOF and transient failures share one backoff tail. An impossible non-abort internal sleep rejection or broken status/logger callback now surfaces rather than entering compensating reconnect; real sleep rejects on abort and actual recovery stays.
- WhatsApp optional native socket-end fallback (`69225003820`): actual callers use WASocket with required end(). An unsupported fake without end fails plainly; normal teardown and its error reporting stay.
- Nextcloud post-synchronous-route abort check (#159067, `5fd7c3d95e0`): the old awaited server-start path became synchronous route registration. A reentrant registry callback abort may briefly publish ready; installed abort cleanup, post-spool-ready check, auth and durable settlement stay.
- Buzz history-count clamps (`132e39bff64`): the actual positive room count and queue-capacity invariant guarantee the result. Unsupported private negative/oversized counts are not repaired; actual FIFO/resource reservations remain.
- LINE frozen-error wrapper (#100996, `f859d78b612`): native SDK HTTPFetchError is mutable; Object.freeze was a synthetic fixture, not a cited human incident. An unsupported frozen replacement error can now fail annotation with TypeError; actual partial-send/recovery contracts stay.
- LINE duplicate missing-receipt invariant (`05eda57b3c7`, #99600, #142092, #165718): all native sends return validated IDs and required receipts. Unsupported fake results use canonical bridge normalization instead of the former private throw; physical-send progress, caption quoting, receipt order and declared capabilities stay. The bridge also preserves already-sanctioned chatId metadata.
- Feishu display-cache extreme-clock guards (`23e1aac9b2c`): introduced with a synthetic max-Date test, no linked human report. Corrupt clocks follow ordinary arithmetic; account scope, positive/negative TTL and the 500-entry bound remain.
- Mattermost reaction-identity extreme-clock guards (`77b334a9845`): only invalid/max-Date tests support the machinery, no linked human report. Corrupt clocks follow arithmetic; token/base-URL scope, ten-minute expiry, delegated conversation/post/self-DM checks and request authority remain.

Other cuts remove duplicate facts/checks under one existing owner and introduce no additional failure tradeoff: Signal subscription/abort state, Zalouser Promise settlement and DM setter, Nextcloud claimed version/lane validation, Teams media/header validation and empty-array merging, Buzz refresh-state identity, Nostr flush identity, Matrix encryption gating, Mattermost runtime-config guard, immutable plugin setup bases, and private Discord/iMessage test overrides.

Matrix's private zero-answer poll fallback is also removed: its sole caller has already passed the shared minimum-two-options validator (`c49b6cc241a`, #163574). No reachable input loses a fallback. Teams attachment header rejection remains owned by the canonical bounded media saver; malformed/oversize headers now use the existing `attachmentView save failed` warning instead of the special malformed-header tag or silent oversized-header skip. The unavailable result and byte protection remain unchanged.

## Evidence

Focused owning-boundary/sibling tests and independent isolated reviews were run per checkpoint. Latest batches passed: Discord/LINE/Matrix/Synology 76 cases (157.00s wrapper), LINE/Feishu/Mattermost 66 cases (132.62s), Mattermost reaction 12 cases, Zalo Personal setup 17 cases (48.97s), and Teams consent/parser/lifecycle 52 cases (29.18s). The Teams malformed-content regression failed on the original handler before the one-line repair. The new Zalo test fixture initially assumed the wrong promotion target; source inspection and an explicit two-account fixture corrected it without changing production behavior or weakening retained assertions.

Production/test extension typechecks and targeted type-aware lint/format pass. Runtime and Madge checks report zero cycles. Existing SDK export checks pass. Earlier fresh cliStartup build and affected built-entry import proof passed; no performance improvement is claimed from dirty-tree profiling. No live accounts, operator state, driver installation, Gateway or remote lease was used.

Final Matrix poll/send/shared-normalization proof passes 55 cases across three shards (138.50s wrapper). Independent full-branch review and the supplemental poll review found no actionable P0–P2 findings.

Two local baseline gates are inherited from the branch base: suppression inventory expects 87 versus the untouched proxy's 88 (current main has repaired the entry); aggregate check-changed stops on stale untouched max-lines entry src/agents/btw.ts after conflict/line-cap gates pass. No allowlist/budget expansion was made. Earlier cold-start timing-sensitive failures remain observations, not claimed repaired/inherited; the complete changed cold-start file subsequently passed all eight cases with unchanged timers/assertions.

The first exact-head hosted run [38503961141](https://github.com/openclaw/openclaw/actions/runs/38503961141) completed in 643 seconds: 51 jobs passed, 25 planned jobs skipped, and the baseline ratchet plus its aggregate gate failed. The defect was ours: removed Slack/Twitch assertions and two removed ClickClack mocks needed exact inventory shrinkage. Those four inventory items are corrected without adding allowances or changing behavior. All actual tests, types, lint, architecture, package boundaries, QA and security jobs passed on that production patch. Final exact-head run [38505676106](https://github.com/openclaw/openclaw/actions/runs/38505676106) passed on `86922ccf92825d4b53b77005119590d1e7759a32`: 55 successful jobs, 25 planned skips, zero failed/cancelled jobs, 643 seconds wall time and 9,679 summed reported job seconds. The exact-head required CI/security gate passes. CodeQL also reports a neutral warning for unselected main configurations; those skipped configurations are not claimed as proof. No CI rerun, inherited-failure admin exception, or green-seeking push was used.

<details>
<summary>Round-2 largest-first coverage log</summary>

Setup/runtime composition is consolidated for Buzz, Nostr, A2A and Google Chat; setup stays dependency-light. Matrix/Feishu secret activation uses the existing factory with activation/order/owner rules unchanged. IRC shares parsing/status owners. LINE shares receipt/progress mapping without routing through legacy media behavior. Zalo Personal shares the existing account-scoped DM policy owner. Privacy regressions reach real WhatsApp/iMessage/Synology inbound and Feishu pairing diagnostic paths while asserting complete dispatch/challenge behavior.

Largest old owners retained after source/caller/history review include iMessage catchup/conversation repair; Matrix formatting/actions/crypto/shutdown; Mattermost interactive access/draft boundary/final receipts; Signal approvals/transport setup; Slack ingress FIFO/thread visibility/workspace identity/streaming; WhatsApp paid-STT/admission/quoted identity/partial delivery; Teams Graph/Bot Framework/upload consent security; Buzz signed membership/archival authority/resource budgets; Nostr circuit breakers/profile mutation auth; LINE provider caps/reply-token/media ordering; Twitch listener/auth resource ownership; SMS callback/API ordering; Synology auth/rate limits/durable acknowledgments; Reef encryption/transport error containment; FaceTime trust/rollback/permissions; and paid X request accounting.

Recent files were deferred, including remaining Teams inbound-body, Tlon admin/approval-text and WhatsApp outbound-content diagnostics; recently landed feature foundations were not treated as dead code. QA setup-base consolidation was held because completing its runtime caller would exceed the one-line recent-file exception. No Phase E standalone memory code was touched. Detailed per-mechanism provenance and checkpoint evidence is retained in the requested round-2 lane ledger.

</details>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…of diagnostics (openclaw#171606)

## What Problem This Solves

Older channel-plugin code duplicates shared SDK ownership and carries defensive machinery for unsupported internal inputs, synthetic clocks, and throwing diagnostic hooks. Several normal inbound paths also put message content or pairing codes into diagnostics.

## User Impact

Message delivery, account/security policy, conversation identity, provider features, and ordinary shutdown/restart durability remain supported. Inbound message text, malformed Teams consent payloads and pairing codes no longer appear in the repaired diagnostic paths. No configuration, CLI, protocol, SDK export, dependency, schema, retention, or permission changes are required.

## Why This Change Was Made

This is the second old-code channel-plugin pass. Only production files with no origin/main commit in the preceding seven days are included; eligibility is refreshed before every push. The overlapping Feishu Markdown fence repair was removed from this branch once main independently landed it in openclaw#171222.

The packet removes **512 net production lines** (+503/-1015; tests, fixtures, test support, generated files, and declarations excluded). It reuses existing public SDK owners for plugin setup composition, secret-contract wiring, receipts, status summaries, process-global maps, error traversal, and account-scoped DM policy. There are no private-core or cross-plugin imports.

## Best-effort tradeoffs accepted

Each removed mechanism below was checked against callers, dependency behavior, and introducing history. Synthetic tests and hypothetical PR race descriptions are not treated as human production reports. Actual incident fixes, live security authority, FIFO, resource bounds, and accepted-write settlement are retained.

- Discord identify clock-skew observation (`fa56d13411c`): the only added proof jumps the clock from a trillion milliseconds to zero; no human report is linked. A drastic backward clock jump can now prolong reconnect until clock recovery/restart; ordinary five-second parallel identify spacing remains.
- WhatsApp second synchronous close observation (openclaw#109886, `ca60d105ece`): native Baileys uses EventEmitter and cannot asynchronously close between synchronous check/listener registration. A nonstandard reentrant `newListener` hook can reach the existing bounded timeout; transport-confirmed close and cleanup remain.
- Tlon formatter fallback (openclaw#1837, `a898f3d7bb5`): validated decimal BigInt input cannot fail the pinned @ud formatter. A broken dependency now fails visibly instead of sending the incorrect raw ID that the original threading fix rejected.
- Matrix second private sync waiter (openclaw#62779, `aec73fd9ca4`): the actual monitor waits once; only a synthetic test calls twice. An unsupported second call may replace the first callbacks; real outage/fatal/abort settlement remains.
- ClickClack outer setup catches (`9079efe9026`): network/config failures are already caught by their owners; the extra path catches a broken logger/formatter then invokes the same logger again. Such internal failures now surface; ordinary setup diagnostics remain.
- ClickClack second workspace snapshot (`188ce1e28e9`): verification now resolves ID/name/slug from one provider response. A concurrent rename/removal is observed on the next verification/runtime request rather than an opportunistic second fetch.
- SMS generated-fragment revalidation (openclaw#118665, `37690fb4f4b`): raw URL validation stays; only URLSearchParams-generated fragment bytes were checked twice. A monkeypatched/broken encoder is no longer revalidated; length, auth, URL and retry bounds remain.
- Feishu timeout-warning catch (`7a2ce698b8c`): the cited stuck-task/FIFO issues concern the retained five-minute cap, not a throwing logger. A broken warning hook now rejects that queue call visibly; subsequent same-key work continues.
- Feishu private timeout customization (`7a2ce698b8c`, `491abe564ce`, openclaw#101949): only tests passed disabled/oversized/custom values. Unsupported direct imports can no longer tune/disable the private cap; all production callers retain five-minute progress/FIFO behavior.
- Reef logger-fatal deferred/race (openclaw#162669; synthetic hook in openclaw#110870): ordinary transport-error containment and shutdown from the recorded live relay incident stay. A throwing error logger is reported by the scheduler instead of intentionally killing an otherwise healthy inbox.
- Matrix nonfinite media size fallback (`96ff92e82bb`, openclaw#149128): the sole production producer passes Buffer.byteLength; NaN cases were synthetic cleanup fixtures. Unsupported private NaN calls now carry that supplied value; MIME, encryption, image fields and duration remain.
- Buzz subscription count coercion (`d656588ae32`): the sole caller supplies array.length. Unsupported negative/fractional private values are not repaired; the actual room/resource cap remains.
- Teams upload-byte coercion (openclaw#104120, `6d759fe8b17`): both callers supply Buffer.length. Unsupported malformed private counts follow transfer arithmetic; timer clamping and upload budgets stay.
- Nostr zero-count score fallback (`25838b5d7de`): private entries are synchronously created and incremented together. An unsupported new zero-outcome insertion could score NaN; actual outage/circuit-breaker/failover behavior stays.
- Buzz profile-limit coercion (`67bce4fe0d7`): the only explicit producer supplies the bounded integer budget. Unsupported direct malformed limits are not normalized; ordinary caps, zero-budget and untrusted-event checks stay.
- Feishu card-launcher clock injection/max-Date guard (`207f045b11c`): only a synthetic year-275760 test supplies the private clock. A corrupt clock may create an unusable expiry until recovery/restart; effect-side expiry, actor/chat and approval validation stay.
- QA private empty media-batch guard (openclaw#115290, `4dbddeefcc9`): all three callers prove a nonempty batch. Unsupported direct empty calls take the ordinary text path; real media caps and atomic loading remain.
- Slack private global-map slot revalidation (original sharing fix `564ccc6f56a`): normal module sharing/replacement is retained. No human private-slot corruption report is linked; third-party mutation/deletion of our private Symbol slot is no longer checked on every read, and restart repairs unsupported corruption.
- Buzz synchronous subscription-construction compensation (`2bd60a2e983`, `eb99a1b3432`, openclaw#130300): native nostr-tools construction emits no callbacks and authored filters are plain/nonempty. Unsupported throwing/cyclic private filters or replaced constructors surface without immediate count/generation/timer compensation; close/deadline/restart recovers temporary state.
- Buzz post-construction inline-EOSE/abort retry (same provenance): native callbacks are asynchronous. A non-native constructor emitting EOSE inline no longer gets a second cleanup attempt; real EOSE-before-CLOSE, late EOSE, close-once, deadlines, queued slots, abort listeners, membership authority and shutdown remain. Fixtures now schedule EOSE with queueMicrotask while retaining assertions.
- Signal clean-end recovery duplication (openclaw#10240, `1b2dfffddeb`): clean EOF and transient failures share one backoff tail. An impossible non-abort internal sleep rejection or broken status/logger callback now surfaces rather than entering compensating reconnect; real sleep rejects on abort and actual recovery stays.
- WhatsApp optional native socket-end fallback (`3294ef6f0cb`): actual callers use WASocket with required end(). An unsupported fake without end fails plainly; normal teardown and its error reporting stay.
- Nextcloud post-synchronous-route abort check (openclaw#159067, `af36cf97537`): the old awaited server-start path became synchronous route registration. A reentrant registry callback abort may briefly publish ready; installed abort cleanup, post-spool-ready check, auth and durable settlement stay.
- Buzz history-count clamps (`bbde46b881f`): the actual positive room count and queue-capacity invariant guarantee the result. Unsupported private negative/oversized counts are not repaired; actual FIFO/resource reservations remain.
- LINE frozen-error wrapper (openclaw#100996, `a2aad76fdba`): native SDK HTTPFetchError is mutable; Object.freeze was a synthetic fixture, not a cited human incident. An unsupported frozen replacement error can now fail annotation with TypeError; actual partial-send/recovery contracts stay.
- LINE duplicate missing-receipt invariant (`15be48ecd0e`, openclaw#99600, openclaw#142092, openclaw#165718): all native sends return validated IDs and required receipts. Unsupported fake results use canonical bridge normalization instead of the former private throw; physical-send progress, caption quoting, receipt order and declared capabilities stay. The bridge also preserves already-sanctioned chatId metadata.
- Feishu display-cache extreme-clock guards (`ab53c2998a1`): introduced with a synthetic max-Date test, no linked human report. Corrupt clocks follow ordinary arithmetic; account scope, positive/negative TTL and the 500-entry bound remain.
- Mattermost reaction-identity extreme-clock guards (`6199cc7df89`): only invalid/max-Date tests support the machinery, no linked human report. Corrupt clocks follow arithmetic; token/base-URL scope, ten-minute expiry, delegated conversation/post/self-DM checks and request authority remain.

Other cuts remove duplicate facts/checks under one existing owner and introduce no additional failure tradeoff: Signal subscription/abort state, Zalouser Promise settlement and DM setter, Nextcloud claimed version/lane validation, Teams media/header validation and empty-array merging, Buzz refresh-state identity, Nostr flush identity, Matrix encryption gating, Mattermost runtime-config guard, immutable plugin setup bases, and private Discord/iMessage test overrides.

Matrix's private zero-answer poll fallback is also removed: its sole caller has already passed the shared minimum-two-options validator (`306de68c026`, openclaw#163574). No reachable input loses a fallback. Teams attachment header rejection remains owned by the canonical bounded media saver; malformed/oversize headers now use the existing `attachmentView save failed` warning instead of the special malformed-header tag or silent oversized-header skip. The unavailable result and byte protection remain unchanged.

## Evidence

Focused owning-boundary/sibling tests and independent isolated reviews were run per checkpoint. Latest batches passed: Discord/LINE/Matrix/Synology 76 cases (157.00s wrapper), LINE/Feishu/Mattermost 66 cases (132.62s), Mattermost reaction 12 cases, Zalo Personal setup 17 cases (48.97s), and Teams consent/parser/lifecycle 52 cases (29.18s). The Teams malformed-content regression failed on the original handler before the one-line repair. The new Zalo test fixture initially assumed the wrong promotion target; source inspection and an explicit two-account fixture corrected it without changing production behavior or weakening retained assertions.

Production/test extension typechecks and targeted type-aware lint/format pass. Runtime and Madge checks report zero cycles. Existing SDK export checks pass. Earlier fresh cliStartup build and affected built-entry import proof passed; no performance improvement is claimed from dirty-tree profiling. No live accounts, operator state, driver installation, Gateway or remote lease was used.

Final Matrix poll/send/shared-normalization proof passes 55 cases across three shards (138.50s wrapper). Independent full-branch review and the supplemental poll review found no actionable P0–P2 findings.

Two local baseline gates are inherited from the branch base: suppression inventory expects 87 versus the untouched proxy's 88 (current main has repaired the entry); aggregate check-changed stops on stale untouched max-lines entry src/agents/btw.ts after conflict/line-cap gates pass. No allowlist/budget expansion was made. Earlier cold-start timing-sensitive failures remain observations, not claimed repaired/inherited; the complete changed cold-start file subsequently passed all eight cases with unchanged timers/assertions.

The first exact-head hosted run [38503961141](https://github.com/openclaw/openclaw/actions/runs/38503961141) completed in 643 seconds: 51 jobs passed, 25 planned jobs skipped, and the baseline ratchet plus its aggregate gate failed. The defect was ours: removed Slack/Twitch assertions and two removed ClickClack mocks needed exact inventory shrinkage. Those four inventory items are corrected without adding allowances or changing behavior. All actual tests, types, lint, architecture, package boundaries, QA and security jobs passed on that production patch. Final exact-head run [38505676106](https://github.com/openclaw/openclaw/actions/runs/38505676106) passed on `86922ccf92825d4b53b77005119590d1e7759a32`: 55 successful jobs, 25 planned skips, zero failed/cancelled jobs, 643 seconds wall time and 9,679 summed reported job seconds. The exact-head required CI/security gate passes. CodeQL also reports a neutral warning for unselected main configurations; those skipped configurations are not claimed as proof. No CI rerun, inherited-failure admin exception, or green-seeking push was used.

<details>
<summary>Round-2 largest-first coverage log</summary>

Setup/runtime composition is consolidated for Buzz, Nostr, A2A and Google Chat; setup stays dependency-light. Matrix/Feishu secret activation uses the existing factory with activation/order/owner rules unchanged. IRC shares parsing/status owners. LINE shares receipt/progress mapping without routing through legacy media behavior. Zalo Personal shares the existing account-scoped DM policy owner. Privacy regressions reach real WhatsApp/iMessage/Synology inbound and Feishu pairing diagnostic paths while asserting complete dispatch/challenge behavior.

Largest old owners retained after source/caller/history review include iMessage catchup/conversation repair; Matrix formatting/actions/crypto/shutdown; Mattermost interactive access/draft boundary/final receipts; Signal approvals/transport setup; Slack ingress FIFO/thread visibility/workspace identity/streaming; WhatsApp paid-STT/admission/quoted identity/partial delivery; Teams Graph/Bot Framework/upload consent security; Buzz signed membership/archival authority/resource budgets; Nostr circuit breakers/profile mutation auth; LINE provider caps/reply-token/media ordering; Twitch listener/auth resource ownership; SMS callback/API ordering; Synology auth/rate limits/durable acknowledgments; Reef encryption/transport error containment; FaceTime trust/rollback/permissions; and paid X request accounting.

Recent files were deferred, including remaining Teams inbound-body, Tlon admin/approval-text and WhatsApp outbound-content diagnostics; recently landed feature foundations were not treated as dead code. QA setup-base consolidation was held because completing its runtime caller would exceed the one-line recent-file exception. No Phase E standalone memory code was touched. Detailed per-mechanism provenance and checkpoint evidence is retained in the requested round-2 lane ledger.

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants