Skip to content

test(msteams): cover occupied webhook port - #120158

Merged
vincentkoc merged 1 commit into
mainfrom
test/msteams-occupied-port
Aug 7, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
test/msteams-occupied-port

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

Related: #120145
Related: #120117

What Problem This Solves

Restores real boundary coverage for Microsoft Teams webhook startup when the configured port is already occupied. PR #120117 correctly removed a test that proved an invented Express mock contract, but the working Express 5.2.1 startup path no longer had a regression test.

Why This Change Was Made

This AI-assisted test binds a real Node HTTP server to an ephemeral port using the same unspecified-host mode as production, starts the real Microsoft Teams monitor on that assigned port, and verifies the existing startup owner rejects with EADDRINUSE, starts then stops ingress exactly once, and never enters the HTTP keep-alive phase. The blocking server is always closed in finally.

No production, config, SDK, dependency, or public-contract code changes.

User Impact

No runtime behavior changes. The test now protects the existing operator-visible startup failure path from regressing back to a silent or hanging listener failure.

Evidence

  • Real Express 5.2.1 dependency repro: occupied-port startup invoked the listen callback once with EADDRINUSE.
  • Direct dependency inspection: Express 5.2.1 lib/application.js wraps the callback once, registers it on the server's startup error event, then delegates to server.listen; the installed Express types declare the callback as (error?: Error) => void.
  • Exact occupied-port test: 20 independent runs passed.
  • Full monitor.lifecycle.test.ts suite: 16/16 passed.
  • Blacksmith Testbox changed gate passed, including extension-test typecheck, focused lint, formatting, dependency, boundary, dead-export, and policy guards: https://github.com/openclaw/openclaw/actions/runs/31150573037
  • Exact-head PR CI passed with zero pending or failing checks.
  • Max-P1 autoreview: clean, patch correct at 0.98 confidence.
  • git diff --check: passed.

Production LOC: +0/-0. Test LOC: +37/-1.

Punchcard-Session: silver-willow-harbor-px
@openclaw-barnacle openclaw-barnacle Bot added channel: msteams Channel integration: msteams size: XS maintainer Maintainer-authored PR labels Aug 7, 2026
@vincentkoc vincentkoc self-assigned this Aug 7, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 7, 2026 05:37
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 7, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 1:42 AM ET / 05:42 UTC.

ClawSweeper review

What this changes

Adds a real occupied-port regression test for Microsoft Teams webhook startup, checking rejection, ingress cleanup, and absence of HTTP keep-alive handoff.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. This maintainer-owned test-only PR restores valid boundary coverage that the merged refactor intentionally removed only because its prior Express mock contract was invalid; the new test exercises the real listener failure path without changing runtime behavior.

Priority: P3
Reviewed head: fc5ac117d8ce510244dc0195313d55fdaba98c49

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, clean boundary test matches the existing lifecycle owner and has no actionable correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored test-only PR is outside the external-contributor proof gate; its documented real-listener and Testbox evidence remains useful supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored test-only PR is outside the external-contributor proof gate; its documented real-listener and Testbox evidence remains useful supplemental validation.
Evidence reviewed 5 items Owner-boundary behavior: Current monitor startup begins ingress, catches a listener bind failure to log and stop ingress, then rethrows; keep-alive occurs only after successful listener startup.
Caller records the failure: The gateway awaits the Teams monitor and records/logs a rejected channel startup before transitioning it to stopped, so the asserted rejection is an operator-visible path.
Focused real-boundary test: The branch binds a real Node HTTP blocker, invokes the monitor with that port, asserts EADDRINUSE plus ingress cleanup, and closes the blocker in finally.
Findings None None.
Security None None.

How this fits together

The Microsoft Teams plugin starts a webhook HTTP listener while bringing a channel account online. The monitor owns listener startup and cleanup, while the gateway records a failed startup as an account error.

flowchart LR
  A[Teams configuration] --> B[Channel monitor]
  B --> C[Webhook listener]
  C --> D{Port available?}
  D -->|Yes| E[Keep server alive]
  D -->|No| F[Stop ingress and reject]
  F --> G[Gateway records account error]
Loading

Before merge

  • Resolve merge risk (P1) - Direct Express source/types could not be inspected because dependencies are absent and DNS access failed; exact-head CI remains the appropriate final contract check.
  • Complete next step (P2) - This maintainer-owned PR needs normal exact-head review and CI, not an automated repair lane.
Agent review details

Security

None.

PR surface

Tests +36. Total +36 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 37 1 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 37 1 +36

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests +37/-1 The branch adds only targeted lifecycle regression coverage and introduces no production behavior.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Merge the focused real-listener regression test once the exact head has completed the normal maintainer review and required checks.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Merge the focused real-listener regression test once the exact head has completed the normal maintainer review and required checks.

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

Not applicable as a user-reported issue; source inspection establishes the test's occupied-port path, and the PR supplies focused runtime evidence for it.

Is this the best way to solve the issue?

Yes. A real TCP blocker reaches the existing listener owner, unlike the removed mock contract; changing production status behavior would exceed this test-only repair.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a low-risk test-only improvement that protects a Microsoft Teams startup failure path without changing shipped behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored test-only PR is outside the external-contributor proof gate; its documented real-listener and Testbox evidence remains useful supplemental validation.

Label justifications:

  • P3: This is a low-risk test-only improvement that protects a Microsoft Teams startup failure path without changing shipped behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored test-only PR is outside the external-contributor proof gate; its documented real-listener and Testbox evidence remains useful supplemental validation.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger introduced the current listener lifecycle and later merged the test refactor that removed the obsolete mock assertion. (role: feature owner and recent area contributor; confidence: high; commits: bfd47df34d25, 9aa24e8f2e82; files: extensions/msteams/src/monitor.ts, extensions/msteams/src/monitor.lifecycle.test.ts)

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.

@vincentkoc
vincentkoc merged commit 5f585a5 into main Aug 7, 2026
167 checks passed
@vincentkoc
vincentkoc deleted the test/msteams-occupied-port branch August 7, 2026 05:46
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 7, 2026
…cope

* origin/main:
  fix(qa): bound Matrix scenario preparation separately (#119996)
  test(msteams): cover occupied webhook port (#120158)
  fix(agents): clear btw attribution reservations
  fix(agents): reserve execution attribution atomically
  fix(agents): reject attribution collisions before capture
  fix(agents): reject CLI attribution collisions
  fix(agents): reject private attribution recovery by run id
  fix(agents): restore runtime check cleanliness
  fix(agents): refresh rebound run admission time
  refactor(agents): propagate exact attribution across runtimes
  fix(release): provide prerelease plugin companions to package QA (#120107)
  test(macos): stabilize gateway session negotiation tests (#120141)
  refactor(test): replace logic-bearing vi.mock factories with boundary fakes, batch 2 (#120117)

# Conflicts:
#	src/agents/command/attempt-execution.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 8, 2026
Punchcard-Session: silver-willow-harbor-px
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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