Skip to content

fix(mattermost): deny instead of pairing when the pending queue is full - #178581

Merged
steipete merged 8 commits into
openclaw:mainfrom
HeZ2z:pr-178507-mattermost-pairing
Oct 26, 2026
Merged

steipete merged 8 commits into
openclaw:mainfrom
HeZ2z:pr-178507-mattermost-pairing

Conversation

@HeZ2z

@HeZ2z HeZ2z commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes #178507

What Problem This Solves

When the Mattermost pairing queue is full, slash commands and the model-picker response owner display an empty pairing code and an approval command for a request that was never stored.

User Impact

Capacity-denied users receive a clear explanation and the owner's recovery path. Existing pending requests still return their valid code, including when the queue is full. Queue limits and authorization are unchanged.

Why This Change Was Made

An empty code identifies capacity rejection; created: false also identifies existing requests, so it cannot select the denial on its own. Both response owners now select the shared capacity message only for an empty code.

Thanks to @HeZ2z for the repair and original real-runtime proof. This revision simplifies the response branches and consolidates the new slash regression into the existing HTTP suite, deleting the duplicate fixture file. Relative to integrated main: production +11 lines, tests +102, documentation +1, mock baseline -1. This reduces the original +21 production / +248 test lines while retaining both response contracts.

Evidence

Independent diff review found no actionable P0–P2 issues.

  • Main baseline b33227f35cceff9294df688ef29e35c4c269585c, with the new tests but without the production fix: both empty-code cases fail because the response is the ordinary pairing template; the other 18 tests pass.
  • With the fix, the 20 tests in slash-http.test.ts and monitor-model-picker.test.ts pass, as do the four monitor-auth.test.ts cases. The combined run including the HTTP boundary suite had 30 passes and one environmental failure, taking 105.23 seconds runner wall time (80.65 seconds reported by Vitest, mostly compilation/imports).
  • The unchanged boundary test reserves authenticated capacity and bounds each pre-authentication pool at eight cannot connect its alternate source addresses on this Mac. Its first admission count stays zero; a separate native socket probe bound to 127.0.0.2 returns EADDRNOTAVAIL before any product handler runs. No test was weakened or skipped.
  • Formatting, syntax-only targeted oxlint, mock-export ratchet, and git diff --check pass. Full local type-aware lint preparation and targeted typecheck refuse the linked dependency installation (Declaration input escapes checkout); PR CI supplies that proof.
  • Contributor-recorded proof on a6f38897b150f065ad4f69e644b2949c9126d39b used the production slash HTTP handler, real runtime, and isolated real pairing store: the fourth user received a capacity denial, an existing user retained their code, and the three stored requests remained unchanged. Only Mattermost REST was simulated. The registered picker callback rejects unapproved users before reaching the picker response owner; that owner was exercised directly against the same real store.
  • Live Mattermost was not tested: no isolated server is available. The current regressions exercise the production response owners with fixed external I/O; the earlier real-store proof is retained as supporting evidence.

CI found a missing nonempty-body assertion in the new slash test; that test-only typing issue is corrected. All 12 slash tests pass again (35.82 seconds runner wall), targeted lint/format pass, and a fresh review of the repair found no actionable P0–P2 findings. The first CI run also failed in unchanged reply-agent-turn-preparation.test.ts:646 (incomplete ReplyOperation fixture), introduced by main commit bd6807a336d6; scheduled main run 40380874869 at d704d3b10632 reproduces the identical signature (job 121776725394).

The corrected head 40782da2a2ae has the same inherited failure in run 40381491504, job 121780092401. The PR-caused slash-test type error is gone.

ClawSweeper's final-head re-review request did not produce a new review: its input scanner refused the reviewed source (run 40381453109). Its last completed review covers the contributor's earlier head and has no findings; the independent local reviews above cover the final changes.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here.

Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update.

Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: mattermost Channel integration: mattermost size: S labels Oct 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 20, 2026
@HeZ2z

HeZ2z commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

The existing slash-http.test.ts carries pre-existing synthetic credential-shaped error fixtures unrelated to this fix; review input scanners refuse that file's base blob, so this PR no longer modifies it. The new pairing-queue coverage drives the same createSlashCommandHttpHandler boundary that the old placement did.
@HeZ2z

HeZ2z commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Mattermost pairing replies explain queue exhaustion instead of displaying an empty pairing code and unusable approval command.

Example: Alice, Bob, and Carol have pending Mattermost pairing requests; Dave runs /oc_status.

  • Before: Dave receives an empty pairing code and an approval command even though his request was not saved.
  • After: Dave receives a capacity denial directing the bot owner to approve or dismiss pending requests before he retries.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, useful repair with concrete production-handler and real-store evidence; live Mattermost coverage remains limited and exact-head CI is still running.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Supplied terminal output exercises the production slash HTTP handler with the real runtime and isolated pairing store, showing capacity denial, existing-code reuse, and unchanged pending rows; picker-owner output and registered callback rejection are separately documented, with only Mattermost REST served by a local stand-in.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A capacity-rejected Mattermost user receives pairing instructions that cannot succeed because no request exists.
Reason: The change corrects a demonstrated failure using existing owners and documented recovery, without adding configuration or changing authorization.

Merge readiness

✅ Ready for maintainer review

Keep this PR: it fixes a concrete Mattermost reply bug still present on current main, preserves valid pairing reminders, and introduces no identified correctness defect.

Priority: P2
Reviewed head: a6f38897b150f065ad4f69e644b2949c9126d39b

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A live Mattermost server was not exercised; supplied real-HTTP and real-store traces cover the changed response behavior, and focused regressions are reported red on base.
Agent review details

How this fits together

Mattermost HTTP callbacks authorize incoming commands, request account-scoped pairing codes, and format ephemeral responses using the shared pairing runtime.

flowchart TD
  A[Mattermost callback] --> B[Command authorization]
  B --> C[Pairing store]
  C --> D[Nonempty code]
  C --> E[Queue capacity rejection]
  D --> F[Pairing instructions]
  E --> G[Recovery denial]
Loading

Technical review

Best possible solution:

Retain the two response-owner guards and shared recovery message while preserving existing pending-request codes.

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

Current-main callers, the worker's capacity result, and existing store tests establish the failure path; supplied HTTP output corroborates it, and this read-only review ran no target code.

Is this the best way to solve the issue?

The guards are the smallest complete repair using existing response owners because created=false also represents valid pending requests whose codes must remain visible.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against efaf5e706187.

Provenance checked

  • Mattermost slash-command pairing reply keeps the original intent (refactor: keep private request phases with their owners #179646: The changed base lines were carried into the owning HTTP operation by a behavior-preserving private-phase refactor; this identifies relocation rather than the bug's original introduction.)
  • Mattermost model-picker pairing reply keeps the original intent (refactor(mattermost): split inbound monitor #113775: The monitor split preserved existing callback authorization and pairing behavior; the original picker feature restricted actions to their owner, which this repair preserves.)
  • Mock-export baseline keeps the original intent (unknown: The removed entry corresponds to the closed monitor-auth mock factory replaced by an export-preserving factory; older baseline/content history is locally unavailable.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0ff2c82 adds extensions/mattermost/src/mattermost/monitor-model-picker.ts:227 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0ff2c8203330; files: extensions/mattermost/src/mattermost/monitor-model-picker.ts)
  • Ayaan Zaidi: Raw commit 9630174 adds extensions/mattermost/src/mattermost/monitor-model-picker.ts:173 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 963017465bce; files: extensions/mattermost/src/mattermost/monitor-model-picker.ts)

PR surface

Source +21, Tests +248, Other -1. Total +268 across 6 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 37 16 +21
Tests 2 249 1 +248
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 6 286 18 +268

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #178507
Summary: This PR supplies the focused repair for the canonical Mattermost empty-code report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The fix removes misleading approval instructions for capacity-rejected Mattermost users without changing access policy or queue limits.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-20T19:14:46.330Z sha e54f752 :: needs real behavior proof before merge. :: [P2] Explain queue exhaustion and the recovery action in both replies
  • reviewed 2026-10-20T20:24:42.191Z sha 813aa20 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-20T20:49:18.305Z sha 813aa20 :: needs maintainer review before merge. :: none

Reviewed October 25, 2026, 4:24 PM ET / 20:24 UTC (Revision 4).

HeZ2z added 2 commits October 21, 2026 03:20
A full pending pairing queue returns an empty code and stores no request. Both Mattermost denied replies now explain that no request was saved and tell the requester to ask the bot owner to approve or dismiss pending requests in Settings -> Channels -> DM access requests before retrying, instead of showing a bare Unauthorized.
The monitor-auth mock now spreads the real module so tests can assert the shared queue-full denial text, so its closed-factory baseline entry is gone.
@HeZ2z

HeZ2z commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 20, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 20, 2026
# Conflicts:
#	extensions/mattermost/src/mattermost/monitor-model-picker.ts
#	extensions/mattermost/src/mattermost/slash-http.ts
@HeZ2z

HeZ2z commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 25, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S and removed size: M labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit b418e2b into openclaw:main Oct 26, 2026
127 of 132 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
…ll (openclaw#178581)

Return a clear capacity denial when the Mattermost pairing store returns an empty code. Preserve valid codes for existing pending requests and share the denial text between slash-command and model-picker response owners. Consolidate the slash regression into the existing HTTP suite.

Closes openclaw#178507

Validation: both capacity regressions fail on the baseline and pass with the fix; auth tests also pass. The new slash-test typing issue was corrected. The remaining exact-head failure in CI run 40381491504 is the unrelated ReplyOperation fixture error reproduced by scheduled main run 40380874869 and subsequently fixed by openclaw#184907. The PR records the alternate-loopback environment limitation and live-proof scope.

Co-authored-by: HeZzz <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 28, 2026
…ll (#178581)

Return a clear capacity denial when the Mattermost pairing store returns an empty code. Preserve valid codes for existing pending requests and share the denial text between slash-command and model-picker response owners. Consolidate the slash regression into the existing HTTP suite.

Closes #178507

Validation: both capacity regressions fail on the baseline and pass with the fix; auth tests also pass. The new slash-test typing issue was corrected. The remaining exact-head failure in CI run 40381491504 is the unrelated ReplyOperation fixture error reproduced by scheduled main run 40380874869 and subsequently fixed by #184907. The PR records the alternate-loopback environment limitation and live-proof scope.

Co-authored-by: HeZzz <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>

(cherry picked from commit b418e2b)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit ef604f312da5b496d394fa013983c168f903b59b)
@HeZ2z
HeZ2z deleted the pr-178507-mattermost-pairing branch November 5, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: mattermost Channel integration: mattermost clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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.

mattermost: slash commands and model-picker buttons show an empty pairing code when the pending pairing queue is full

2 participants