Skip to content

refactor(webhooks): deslop target ownership and body guards - #160846

Merged
steipete merged 1 commit into
mainfrom
hostneutral/deslop-webhooks-0928
Sep 29, 2026
Merged

steipete merged 1 commit into
mainfrom
hostneutral/deslop-webhooks-0928

Conversation

@steipete

@steipete steipete commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Webhook monitors retain redundant limiter registries and duplicate body-read guards after moving onto Gateway routes.

User Impact

Internal refactor with no deliberate behavior changes. Callback ports and paths, implicit legacy defaults, legacyWebhook: false, /healthz, signature verification, upload limits, durable acknowledgement, and shutdown behavior are preserved. No SDK, configuration, schema, protocol, or update migration changes.

Why This Change Was Made

Nextcloud's live target registrations now own the shared Gateway-path and legacy-endpoint limiters. This removes separate handler and endpoint maps plus their synchronization. Feishu uses the existing bounded body reader once instead of installing a second guard over the same stream, preserving the rejection content type and supported older host floor.

Production: +195 / -257 / net -62. Tests: +0 / -0 / net 0. Docs: +0 / -0 / net 0.

Evidence

Blacksmith Testbox tbx_01m3n1nmg2jxjz3yfzzxaspbqn, after pnpm install --frozen-lockfile: 105 tests passed across 10 suites; 74.98s wall. No tests were added or changed, so this adds no per-PR test cost.

pnpm test \
  extensions/nextcloud-talk/src/monitor.limiter-lifecycle.test.ts \
  extensions/nextcloud-talk/src/monitor.replay.test.ts \
  extensions/nextcloud-talk/src/monitor.preauth-inflight.test.ts \
  extensions/nextcloud-talk/src/monitor.durable-ack.test.ts \
  extensions/nextcloud-talk/src/monitor-runtime.abort.test.ts \
  extensions/feishu/src/monitor.webhook-security.test.ts \
  extensions/feishu/src/monitor.webhook-e2e.test.ts \
  extensions/feishu/src/monitor.webhook-activity.test.ts \
  extensions/feishu/src/monitor.webhook-host-floor.test.ts \
  extensions/feishu/src/monitor.webhook-routing.test.ts --maxWorkers=1

Independent Codex autoreview completed with no actionable P0–P2 findings. Formatting, diff sanity, removed-symbol searches, boundary guards, and the full unused-export scan passed. All heavy checks ran through node scripts/crabbox-wrapper.mjs.

The original-base node scripts/check-changed.mjs hit the inherited 477/476 environment-variable budget failure, fixed on main by 6188881. A clean-main reproduction passed at 476/476. This slice is rebased onto fresh main and is published independently of the queue slice's typecheck correction under the campaign's focused-proof publication policy. Exact-head PR CI subsequently passed its production/test types, lint, selected tests, boundary checks, and enforced CI/security gates. Merged as 17813c8; reviewed file blobs and merge ancestry verified on main.

Both changed files were checked against the open-PR inventory; oversized API file lists were resolved from Git refs. No operator Gateway or live provider was changed.

@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: nextcloud-talk Channel integration: nextcloud-talk channel: feishu Channel integration: feishu size: M labels Sep 29, 2026
@steipete
steipete enabled auto-merge (squash) September 29, 2026 00:53
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 8:57 PM ET / September 29, 2026, 00:57 UTC.

ClawSweeper review

What this changes

The branch makes Nextcloud Talk webhook registrations own shared rate limiters and removes Feishu’s second body-size guard while retaining a bounded body reader.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open. Feishu’s 408 and 413 webhook responses lose their previous text Content-Type because the shared rejection writer clears the header set by the new code. The other reviewed webhook paths have no confirmed regression.

Priority: P2
Reviewed head: 0dc1030c0e93edbd74ad9d9d9809b417d9c8d6f2

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused transport validation supports the cleanup, but a concrete Feishu response regression prevents merge readiness.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This member-authored internal refactor is exempt from the external-contributor proof gate. The reported Testbox suites exercise webhook behavior, but the existing Feishu wire check does not assert the changed rejection MIME; no stored-data contract changes.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored internal refactor is exempt from the external-contributor proof gate. The reported Testbox suites exercise webhook behavior, but the existing Feishu wire check does not assert the changed rejection MIME; no stored-data contract changes.
Evidence reviewed 7 items Introduced Feishu response change: The PR removes the guard that sent typed text rejections and sets Content-Type before calling the remaining body reader.
Rejection helper clears the header: Body-limit errors call sendHttpRequestRejection without a content-type argument; that writer clears existing representation headers, including Content-Type, before sending.
Previous Feishu behavior: Current main still installs the body-limit guard with responseFormat text; its implementation passes text/plain; charset=utf-8 for 408 and 413 responses.
Findings 1 actionable finding [P2] Preserve the Feishu body-rejection Content-Type
Security None None.

How this fits together

The Feishu and Nextcloud Talk plugins receive signed HTTP callbacks through Gateway routes and compatibility listeners. Their monitors select an account, limit unauthenticated requests, admit events, and return HTTP acknowledgements or errors.

flowchart LR
A[Signed webhook callback] --> B[Gateway or legacy listener]
B --> C[Live target registration]
C --> D[Rate and body limits]
D --> E[Signature and account selection]
E --> F[Event admission and HTTP response]
Loading

Before merge

  • Preserve the Feishu body-rejection Content-Type (P2) - For an oversized or timed-out callback, readWebhookBodyOrReject calls the rejection writer without a MIME argument. That writer clears the Content-Type set here, so the former text/plain; charset=utf-8 413/408 response loses its type. Supply the type at the rejection boundary and assert it in the raw HTTP test.
  • Resolve merge risk (P1) - Existing Feishu webhook clients may receive untyped 408 or 413 error responses where the prior transport sent text/plain; charset=utf-8.
  • Complete next step (P2) - Preserve Feishu’s text/plain Content-Type on 408/413 body-limit responses and add a wire-level assertion before merge.

Findings

  • [P2] Preserve the Feishu body-rejection Content-Type — extensions/feishu/src/monitor.transport.ts:495-502
Agent review details

Security

None.

PR surface

Source -62. Total -62 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 2 179 241 -62
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 179 241 -62

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Restore typed Feishu rejections (recommended)
    Make the single body-read path emit the previous text MIME on 408 and 413, then assert it through the HTTP listener.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve Feishu's text/plain; charset=utf-8 header on actual 408 and 413 body-limit responses without restoring a second body guard or changing shared SDK defaults; add focused raw-HTTP header assertions.

Technical review

Best possible solution:

Keep one bounded body reader and live-target-owned limiter sharing, with Feishu’s HTTP status, body, and MIME preserved on Gateway and legacy listeners.

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

Yes. An oversized or timed-out Feishu callback reaches a rejection helper that clears the pre-set Content-Type; this source-proven path was not executed in the read-only review.

Is this the best way to solve the issue?

No, not yet. Target-owned limiter sharing is a fitting simplification, but the Feishu rejection path must explicitly retain its previous MIME instead of relying on a header the shared writer clears.

Full review comments:

  • [P2] Preserve the Feishu body-rejection Content-Type — extensions/feishu/src/monitor.transport.ts:495-502
    For an oversized or timed-out callback, readWebhookBodyOrReject calls the rejection writer without a MIME argument. That writer clears the Content-Type set here, so the former text/plain; charset=utf-8 413/408 response loses its type. Supply the type at the rejection boundary and assert it in the raw HTTP test.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: A limited webhook response-contract regression needs repair before this otherwise focused cleanup merges.
  • add merge-risk: 🚨 compatibility: The introduced Feishu path changes the MIME type of established body-limit error responses.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This member-authored internal refactor is exempt from the external-contributor proof gate. The reported Testbox suites exercise webhook behavior, but the existing Feishu wire check does not assert the changed rejection MIME; no stored-data contract changes.

Label justifications:

  • P2: A limited webhook response-contract regression needs repair before this otherwise focused cleanup merges.
  • merge-risk: 🚨 compatibility: The introduced Feishu path changes the MIME type of established body-limit error responses.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This member-authored internal refactor is exempt from the external-contributor proof gate. The reported Testbox suites exercise webhook behavior, but the existing Feishu wire check does not assert the changed rejection MIME; no stored-data contract changes.

Evidence

Acceptance criteria:

  • [P1] pnpm test extensions/feishu/src/monitor.webhook-security.test.ts --maxWorkers=1.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • eleqtrizit: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Alix-007: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Assert and preserve the Feishu 408/413 Content-Type through the raw HTTP listener.

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 17813c8 into main Sep 29, 2026
107 of 108 checks passed
@steipete
steipete deleted the hostneutral/deslop-webhooks-0928 branch September 29, 2026 01:04
MarMarLabs added a commit to MarMarLabs/openclaw that referenced this pull request Sep 29, 2026
342 upstream commits, including the Slack huddles plugin (openclaw#159879),
scoped Slack plugin reviewers (openclaw#159525) and two Feishu webhook changes
(openclaw#160455, openclaw#160846) in files this branch does not touch. No file outside
the generated set changed on both sides.

Two conflicts, both generated: docs/.generated/config-baseline.counts.json
and docs/.generated/config-baseline.sha256. openclaw#159879 takes plugin from 4374
to 4431 and openclaw#159525 takes core from 2464 to 2475. This branch keeps channel
at 3788. Both files came from upstream and were regenerated.

build:docker ran in a separate detached checkout of this commit outside the
nested node_modules install. Regenerating there changed those two files and
nothing else, giving the predicted counts, the upstream core and plugin
hashes, this branch's channel hash and a new combined hash. The three
generated-file checks pass there.

Upstream deleted 102 test files in this range. None of them were added or
changed by this branch.

Feishu: 107 files and 1859 tests in the extension project, 17 files and
312 tests in the database-workers project. The forwarder test and the
routing guards pass, 430 tests after upstream pruned test-projects.test.ts
in this range. tsgo:core, tsgo:extensions, tsgo:extensions:test,
tsgo:test:root, the line-cap, max-lines and assertion-safety ratchets
against upstream/main, oxlint and oxfmt on the 43 changed code files all
pass.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…#160846)

## What Problem This Solves

Webhook monitors retain redundant limiter registries and duplicate body-read guards after moving onto Gateway routes.

## User Impact

Internal refactor with no deliberate behavior changes. Callback ports and paths, implicit legacy defaults, `legacyWebhook: false`, `/healthz`, signature verification, upload limits, durable acknowledgement, and shutdown behavior are preserved. No SDK, configuration, schema, protocol, or update migration changes.

## Why This Change Was Made

Nextcloud's live target registrations now own the shared Gateway-path and legacy-endpoint limiters. This removes separate handler and endpoint maps plus their synchronization. Feishu uses the existing bounded body reader once instead of installing a second guard over the same stream, preserving the rejection content type and supported older host floor.

Production: **+195 / -257 / net -62**. Tests: **+0 / -0 / net 0**. Docs: **+0 / -0 / net 0**.

## Evidence

Blacksmith Testbox `tbx_01m3n1nmg2jxjz3yfzzxaspbqn`, after `pnpm install --frozen-lockfile`: **105 tests passed across 10 suites; 74.98s wall**. No tests were added or changed, so this adds no per-PR test cost.

```sh
pnpm test \
  extensions/nextcloud-talk/src/monitor.limiter-lifecycle.test.ts \
  extensions/nextcloud-talk/src/monitor.replay.test.ts \
  extensions/nextcloud-talk/src/monitor.preauth-inflight.test.ts \
  extensions/nextcloud-talk/src/monitor.durable-ack.test.ts \
  extensions/nextcloud-talk/src/monitor-runtime.abort.test.ts \
  extensions/feishu/src/monitor.webhook-security.test.ts \
  extensions/feishu/src/monitor.webhook-e2e.test.ts \
  extensions/feishu/src/monitor.webhook-activity.test.ts \
  extensions/feishu/src/monitor.webhook-host-floor.test.ts \
  extensions/feishu/src/monitor.webhook-routing.test.ts --maxWorkers=1
```

Independent Codex autoreview completed with no actionable P0–P2 findings. Formatting, diff sanity, removed-symbol searches, boundary guards, and the full unused-export scan passed. All heavy checks ran through `node scripts/crabbox-wrapper.mjs`.

The original-base `node scripts/check-changed.mjs` hit the inherited 477/476 environment-variable budget failure, fixed on main by eb5a39d. A clean-main reproduction passed at 476/476. This slice is rebased onto fresh main and is published independently of the queue slice's typecheck correction under the campaign's focused-proof publication policy. Enforced PR CI remains the landing gate.

Both changed files were checked against the open-PR inventory; oversized API file lists were resolved from Git refs. No operator Gateway or live provider was changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu channel: nextcloud-talk Channel integration: nextcloud-talk merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant