Skip to content

refactor: consolidate Teams and error helpers - #117907

Merged
steipete merged 1 commit into
mainfrom
cleanup/msteams-error-smalls
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
cleanup/msteams-error-smalls

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Several small request and error-formatting paths still duplicated canonical behavior. Teams carried three Graph mutation wrappers plus a second unused mutation-capable read API, two attachment redirect predicates, and test-only response defensiveness. OpenAI HTTP, Matrix delivery reconciliation, and Code Mode each retained local generic error helpers. Qwen video generation also kept URL-prefix fallbacks that its validated request-config producer cannot reach.

Why This Change Was Made

This change consolidates Teams POST/PATCH requests into one mutation function while retaining DELETE as the distinct response-release owner. It moves both attachment paths onto one redirect predicate, uses the canonical core/plugin error formatter at each valid boundary, keeps Code Mode's raw interruption sentinel check ahead of formatting, and preserves Matrix's explicit unknown-error fallback. Qwen now relies on its validated absolute URL producer while retaining custom-host trailing-slash normalization.

The workboard error helper was audited and intentionally left unchanged because its shipped record and fallback semantics are not equivalent to the canonical formatter and current callers do not prove those inputs impossible.

User Impact

No intended behavior change. Graph request methods, beta routing, error labels, bounded response parsing, DELETE body release, redirect handling, OpenAI validation text trimming, Matrix fallback text, Code Mode timeout classification, and Qwen custom URL normalization are preserved. Production code shrinks by 58 lines.

Evidence

  • node scripts/run-vitest.mjs extensions/msteams/src/graph.test.ts extensions/msteams/src/graph-group-management.test.ts extensions/msteams/src/graph-messages.actions.test.ts extensions/msteams/src/graph-messages.read.test.ts extensions/msteams/src/graph-messages.search.test.ts — 75 passed
  • node scripts/run-vitest.mjs extensions/msteams/src/attachments.test.ts extensions/msteams/src/attachments/shared.test.ts extensions/msteams/src/attachments.graph.test.ts — 82 passed
  • node scripts/run-vitest.mjs src/gateway/openai-http.test.ts — 33 passed
  • node scripts/run-vitest.mjs extensions/matrix/src/matrix/delivery-plan.test.ts extensions/qwen/video-generation-provider.test.ts — 14 passed
  • node scripts/run-vitest.mjs src/agents/code-mode.limits.test.ts src/agents/code-mode-worker-lifecycle.test.ts — 24 passed
  • Canonical oxfmt completed on all 17 changed files.
  • git diff --check passed.
  • Two post-rebase autoreview passes were clean; the final pass rated the patch correct at 0.98.
  • node scripts/check-changed.mjs attempted hosted proof, but no configured Crabbox/Testbox provider was ready; heavy proof is left to this PR's CI as required for this worktree.

@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams gateway Gateway runtime agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Aug 2, 2026
@steipete
steipete marked this pull request as ready for review August 2, 2026 08:20
@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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 4:25 AM ET / 08:25 UTC.

ClawSweeper review

What this changes

This PR replaces duplicate Microsoft Teams Graph POST/PATCH helpers and local error-message formatters with shared canonical helpers, while preserving Matrix, Qwen, Code Mode, and OpenAI HTTP behavior.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This is a coherent behavior-preserving cleanup with focused regression coverage and terminal test evidence in the PR body; no concrete patch defect or security concern was found. The maintainer label requires explicit human handling, so it should remain open for normal maintainer review while the remaining CI completes.

Priority: P3
Reviewed head: 103fa7f4c907347bb616f63d32993f7b0d04c625

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-reducing refactor with credible targeted validation and no confirmed correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body provides after-change terminal evidence for focused Teams, Matrix, Qwen, Gateway, and Code Mode test runs with explicit passing counts; no visual, browser, or live-channel behavior is changed.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides after-change terminal evidence for focused Teams, Matrix, Qwen, Gateway, and Code Mode test runs with explicit passing counts; no visual, browser, or live-channel behavior is changed.
Evidence reviewed 5 items Teams mutation owner boundary: The PR introduces one POST/PATCH-only mutation helper, retains the separate DELETE response-release path, and removes method/body parameters from the read helper; all current-main internal callers found for the old POST/PATCH helpers are Teams action paths covered by the PR tests.
Error formatting contract: Core's canonical formatter delegates to normalization-core with sensitive-text redaction; the shared dependency formatter handles Error causes, structured values, and non-error values. The Code Mode change preserves the raw interrupted sentinel before formatting it for output.
Qwen endpoint safety: The Qwen request-base resolver validates a configured URL and falls back to the default before the simplified AIGC endpoint resolver calls new URL, so removing the unreachable raw-prefix fallback does not expose invalid configured text to that call.
Findings None None.
Security None None.

How this fits together

Microsoft Teams channel actions issue Graph API mutations and parse responses, while the gateway, agent runtime, Matrix channel, and Qwen provider each turn internal failures or provider configuration into operator-visible results. This PR centralizes repeated helper logic at those boundaries without changing the surrounding request or delivery flows.

flowchart LR
  A[Teams actions] --> B[Graph mutation helper]
  B --> C[Microsoft Graph API]
  C --> D[Response parsing and release]
  E[Gateway, agents, Matrix] --> F[Canonical error formatter]
  G[Qwen provider config] --> H[Validated video endpoint]
  F --> I[Operator-visible errors]
  D --> I
  H --> I
Loading

Before merge

  • Resolve merge risk (P1) - The patch spans four runtime surfaces, so it should wait for the in-progress CI matrix before merge; no specific compatibility, delivery, security, or availability regression was established by this review.
  • Complete next step (P2) - The protected maintainer label requires explicit maintainer handling; no mechanical repair is needed from ClawSweeper.
Agent review details

Security

None.

PR surface

Source -58, Tests +46. Total -12 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 12 83 141 -58
Tests 5 104 58 +46
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 187 199 -12

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the consolidated helpers only after the remaining CI confirms the focused behavior-preservation claims, retaining the distinct Teams DELETE release owner and Code Mode interruption classification.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the consolidated helpers only after the remaining CI confirms the focused behavior-preservation claims, retaining the distinct Teams DELETE release owner and Code Mode interruption classification.

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

Not applicable: this PR is an internal refactor, and the supplied focused test runs cover the preserved request, parsing, timeout, and fallback behavior rather than a new user-reported failure.

Is this the best way to solve the issue?

Yes. Consolidating the duplicate helpers at their existing owner boundaries is the most maintainable path; the review found no unsupported duplicate API or broad fallback removal.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a behavior-preserving internal cleanup with broad focused coverage and no reported user-facing regression.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-change terminal evidence for focused Teams, Matrix, Qwen, Gateway, and Code Mode test runs with explicit passing counts; no visual, browser, or live-channel behavior is changed.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides after-change terminal evidence for focused Teams, Matrix, Qwen, Gateway, and Code Mode test runs with explicit passing counts; no visual, browser, or live-channel behavior is changed.

Label justifications:

  • P3: This is a behavior-preserving internal cleanup with broad focused coverage and no reported user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides after-change terminal evidence for focused Teams, Matrix, Qwen, Gateway, and Code Mode test runs with explicit passing counts; no visual, browser, or live-channel behavior is changed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-change terminal evidence for focused Teams, Matrix, Qwen, Gateway, and Code Mode test runs with explicit passing counts; no visual, browser, or live-channel behavior is changed.

Evidence

What I checked:

  • Teams mutation owner boundary: The PR introduces one POST/PATCH-only mutation helper, retains the separate DELETE response-release path, and removes method/body parameters from the read helper; all current-main internal callers found for the old POST/PATCH helpers are Teams action paths covered by the PR tests. (extensions/msteams/src/graph.ts:99, 103fa7f4c907)
  • Error formatting contract: Core's canonical formatter delegates to normalization-core with sensitive-text redaction; the shared dependency formatter handles Error causes, structured values, and non-error values. The Code Mode change preserves the raw interrupted sentinel before formatting it for output. (src/infra/errors.ts:70, 103fa7f4c907)
  • Qwen endpoint safety: The Qwen request-base resolver validates a configured URL and falls back to the default before the simplified AIGC endpoint resolver calls new URL, so removing the unreachable raw-prefix fallback does not expose invalid configured text to that call. (extensions/qwen/video-generation-provider.ts:5, 103fa7f4c907)
  • Area provenance: The Teams Graph helper has recent lifecycle work in ac28f4d558e5f2b1fc45fab4849dac8b157279f1, while the current Qwen video-provider integration dates to fb087bf94721f181a16a4f56aedbcd09e0b60650; history also shows sustained contributions from Peter Steinberger and Vincent Koc in the Teams Graph area. (extensions/msteams/src/graph.ts:92, ac28f4d558e5)
  • Validation and repository state: The PR body reports focused suites across all changed runtime surfaces, including 228 Teams tests and 71 other focused tests; its current head is cleanly mergeable. Local review confirmed a byte-clean checkout, but deeper partial-clone history retrieval failed because github.com DNS resolution was unavailable. (extensions/msteams/src/graph.test.ts:316, 103fa7f4c907)

Likely related people:

  • steipete: Recent current-main Teams Graph lifecycle work and sustained history in this area connect Peter Steinberger to the primary refactor surface. (role: recent area contributor; confidence: high; commits: ac28f4d558e5, 103fa7f4c907; files: extensions/msteams/src/graph.ts, extensions/msteams/src/graph-messages.ts, extensions/msteams/src/graph-group-management.ts)
  • Vincent Koc: Vincent Koc introduced the current Qwen video-provider integration and has substantial historical contribution volume in the Teams Graph helper path. (role: feature owner; confidence: medium; commits: fb087bf94721, 35be382e56fc; files: extensions/qwen/video-generation-provider.ts, extensions/msteams/src/graph.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the currently in-progress CI matrix before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit a154b4f into main Aug 2, 2026
189 of 197 checks passed
@steipete
steipete deleted the cleanup/msteams-error-smalls branch August 2, 2026 09:02
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

abdulrahman305 pushed a commit to qenex-ai/openclaw that referenced this pull request Aug 2, 2026
* origin/main:
  fix: stop lost cancellations, false success, and stuck Codex compaction (openclaw#117902)
  fix(cli): reject incomplete hosted video downloads (openclaw#117893)
  refactor(board): remove duplicate in-memory store (openclaw#117353)
  refactor: consolidate Teams and error helpers (openclaw#117907)
  fix(msteams): cancel unread Graph error response bodies (openclaw#117664)
  fix(imessage): rewind the recovery cursor when chat.db is replaced at the same path (openclaw#117788)
  feat(browser): relay CDP compat for Puppeteer clients (chrome-devtools-mcp) (openclaw#117915)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* origin/main:
  fix: stop lost cancellations, false success, and stuck Codex compaction (openclaw#117902)
  fix(cli): reject incomplete hosted video downloads (openclaw#117893)
  refactor(board): remove duplicate in-memory store (openclaw#117353)
  refactor: consolidate Teams and error helpers (openclaw#117907)
  fix(msteams): cancel unread Graph error response bodies (openclaw#117664)
  fix(imessage): rewind the recovery cursor when chat.db is replaced at the same path (openclaw#117788)
  feat(browser): relay CDP compat for Puppeteer clients (chrome-devtools-mcp) (openclaw#117915)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

1 participant