Skip to content

fix(mattermost): preserve websocket posts across restarts - #110386

Merged
steipete merged 11 commits into
mainfrom
claude/ingress-mattermost
Jul 18, 2026
Merged

steipete merged 11 commits into
mainfrom
claude/ingress-mattermost

Conversation

@steipete

@steipete steipete commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Related: #109657

What Problem This Solves

Mattermost WebSocket posted events were detached from the socket and protected only by a five-minute in-memory replay guard. If OpenClaw restarted after receiving a frame but before adopting its turn, the post was lost because Mattermost reconnects do not replay already-received posts.

Why This Change Was Made

The Mattermost plugin now durably admits every raw posted envelope before scheduling its handler, using post.id as the event identity. Channel lanes honor channel IDs from post.channel_id, envelope data.channel_id, and broadcast metadata so inspection and claiming preserve ordering for every supported event shape.

The shared ingress drain owns restart recovery, per-lane ordering, bounded retry/dead-letter behavior, deferred debounce claims, and merged-turn adoption fan-out. The five-minute replay guard is deleted after parity through 30-day, 20,000-entry completion tombstones. Admissions are serialized so append retries cannot invert same-channel order; shutdown waits for admitted work and closes the prune/pump race.

Cold-gap limitation: Mattermost does not replay posts missed while OpenClaw is disconnected. This change protects frames OpenClaw received and durably admitted; it does not fill that platform-level gap. Persistent admission failures terminate the WebSocket loudly instead of silently losing later posts.

User Impact

Mattermost posts accepted by OpenClaw now survive process restarts and dispatch once after recovery. Operators also get durable duplicate rejection within the bounded retention window and loud failure when the ingress store cannot accept new posts.

Evidence

  • Mattermost suite: 620 tests green.
  • Focused ingress matrix: 16 tests green, including raw-envelope persistence, restart recovery, completion dedupe, all three channel-id shapes, same-lane admission order, retry/escalation, shutdown/prune behavior, and deferred merged adoption.
  • Dead-code export and unused-file gates: zero findings.
  • Final branch head: 8d98b23e99addeb84d4144fba60cb3ffd6698f2b.

AI-assisted; maintainer-reviewed and understood.

@openclaw-barnacle openclaw-barnacle Bot added channel: mattermost Channel integration: mattermost size: XL maintainer Maintainer-authored PR labels Jul 18, 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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 1:34 AM ET / 05:34 UTC.

Summary
The branch replaces Mattermost’s five-minute in-memory WebSocket replay guard with durable raw-envelope ingress admission, recovery, lane ordering, retry/dead-letter handling, and shutdown coordination.

PR surface: Source +368, Tests +494. Total +862 across 7 files.

Reproducibility: yes. at source level: receive a Mattermost posted frame, restart after the old in-memory guard accepted it but before turn adoption, and the platform will not replay that frame. A real current-branch Mattermost run demonstrating the repaired recovery path is still missing from the visible PR evidence.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: serialized state: extensions/mattermost/src/mattermost/monitor-ingress.test.ts, serialized state: extensions/mattermost/src/mattermost/monitor-websocket.test.ts, serialized state: extensions/mattermost/src/mattermost/monitor.inbound-system-event.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

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

Rank-up moves:

  • [P1] Add redacted real Mattermost restart/recovery evidence showing one admitted post dispatches exactly once after process recovery.
  • Have a Mattermost-area reviewer confirm the fail-loud WebSocket termination and reconnect behavior under persistent ingress-storage failure.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The visible evidence consists of test counts and CI-style assertions, not an inspectable after-fix Mattermost receive/restart/recovery result. Add a redacted terminal trace, runtime log, recording, or live output; redact tokens, private endpoints, IP addresses, and user data. Updating the PR body should trigger a fresh review, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging changes the inbound delivery contract from short-lived in-memory dedupe to durable admission and completion tombstones; a lifecycle or claim-state error can still create dropped, duplicated, or permanently stuck Mattermost posts.
  • [P1] Persistent ingress-storage failures intentionally terminate the Mattermost WebSocket. That is preferable to silent loss, but maintainers should confirm the operator-visible reconnect and recovery behavior with a real Mattermost restart scenario before landing.

Maintainer options:

  1. Prove restart recovery before merge (recommended)
    Add a redacted live Mattermost receive → restart → recovery trace showing the admitted post dispatches exactly once, then review the resulting lifecycle evidence.
  2. Pause for narrower reliability review
    Keep the PR open until a Mattermost-area reviewer confirms the durable admission, retry, and fail-loud disconnect semantics are appropriate for deployed operators.

Next step before merge

  • [P1] The remaining gate is contributor-provided real behavior evidence plus maintainer review of message-delivery and WebSocket-availability semantics; this is not a safe automated repair task.

Security
Cleared: The described seven-file Mattermost implementation changes do not add dependencies, workflows, secret handling, or external code-execution paths; no concrete security or supply-chain regression is evident.

Review details

Best possible solution:

Retain the shared ingress-drain design, add redacted real Mattermost evidence showing receipt, process restart, recovery, and single dispatch, then have the Mattermost owner review the intentional fail-loud storage-failure behavior before merge.

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

Yes at source level: receive a Mattermost posted frame, restart after the old in-memory guard accepted it but before turn adoption, and the platform will not replay that frame. A real current-branch Mattermost run demonstrating the repaired recovery path is still missing from the visible PR evidence.

Is this the best way to solve the issue?

Unclear: the shared durable-ingress adapter is the right architectural direction, but direct Mattermost restart/recovery proof and owner review are needed before concluding this large lifecycle replacement is the best safe implementation.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P1: The PR addresses a concrete inbound Mattermost crash window where accepted posts can be silently lost.
  • merge-risk: 🚨 message-delivery: Durable admission, recovery claims, deduplication tombstones, and lane ordering directly determine whether Mattermost posts are dropped or dispatched more than once.
  • merge-risk: 🚨 availability: The new persistent-admission failure path intentionally terminates the WebSocket, making reconnect and recovery behavior operationally significant.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The visible evidence consists of test counts and CI-style assertions, not an inspectable after-fix Mattermost receive/restart/recovery result. Add a redacted terminal trace, runtime log, recording, or live output; redact tokens, private endpoints, IP addresses, and user data. Updating the PR body should trigger a fresh review, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +368, Tests +494. Total +862 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 1303 935 +368
Tests 3 502 8 +494
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 1805 943 +862

What I checked:

  • Problem and proposed boundary: The PR describes the pre-change failure window: a received Mattermost posted WebSocket frame could be lost if OpenClaw restarted before turn adoption because reconnect does not replay that already-received frame; the branch journals the raw envelope before scheduling handling. (extensions/mattermost/src/mattermost/monitor-ingress.ts:1, 177ae096e784)
  • Shared durable-ingress rollout: The related open rollout report establishes the shared ingress drain as the intended reliability seam and calls for isolated per-channel adapters with transport-specific crash-window/restart proof. Mattermost is adjacent to that rollout but not fully tracked by its listed remaining-channel scope. (extensions/mattermost/src/mattermost/monitor.ts:979, 177ae096e784)
  • Latest branch correction: The latest commit explicitly expands Mattermost lane inspection and claim-side validation to accept channel identifiers from the post, event data, or broadcast envelope, addressing a concrete permanent-rejection/socket-teardown path in the new ingress design. (extensions/mattermost/src/mattermost/monitor-ingress.ts:1, 177ae096e784)
  • Proof gate remains unmet in visible PR evidence: The PR body reports 620 Mattermost tests and a focused 16-test ingress matrix, but it does not provide an inspectable redacted Mattermost receive → restart → recovery trace, recording, runtime log, or live output. The PR remains labeled status: 📣 needs proof.
  • Maintainer handling required: The item carries the protected maintainer label and has an active assignment, so it must remain open for explicit maintainer review rather than automated cleanup.

Likely related people:

  • steipete: Authored the eleven commits comprising the current Mattermost durable-ingress branch, including the latest correction for envelope-level channel identifiers. (role: current implementation author; confidence: medium; commits: 9a5affeae9d8, f130d6018ae8, 177ae096e784; files: extensions/mattermost/src/mattermost/monitor-ingress.ts, extensions/mattermost/src/mattermost/monitor.ts, extensions/mattermost/src/mattermost/monitor-websocket.ts)
  • obviyus: Opened the related durable-ingress rollout report that names the shared drain, per-channel adapters, and restart-replay proof requirements this Mattermost work follows. (role: adjacent reliability-rollout author; confidence: medium; files: src/channels/message/ingress-drain.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 (1 earlier review cycle)
  • reviewed 2026-07-18T03:48:29.540Z sha 80c4f9c :: needs real behavior proof before merge. :: none

@steipete
steipete requested a review from a team as a code owner July 18, 2026 05:10
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: imessage Channel integration: imessage channel: msteams Channel integration: msteams app: ios App: ios app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations extensions: elevenlabs labels Jul 18, 2026
@steipete steipete self-assigned this Jul 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d98b23e99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +94 to +97
const chatId = message?.chat_id;
if (typeof chatId !== "number" || !Number.isSafeInteger(chatId)) {
throw new IMessageIngressPayloadError("iMessage ingress row is missing its chat id.");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not reject chat_id-less iMessages

When imsg emits a sender-only or otherwise anchorless payload without a numeric chat_id, this new durable admission gate throws before the existing parser and repairIMessageConversationAnchor path can run. That shape is explicitly supported by the current iMessage code (for example sender-only messages and GUID-based anchor repair), so these inbound messages now fail ingress.receive, are logged as durable admission failures, and are never queued or delivered. Derive the lane from chat_id only when present, falling back to the existing conversation identifiers or GUID/sender so repair can still recover the message.

Useful? React with 👍 / 👎.

steipete added 8 commits July 18, 2026 06:31
Posted events processed detached from the websocket receive with only a
5-minute in-memory guard; a crash lost the post and reconnect never replays
it. Raw posted envelopes now journal durably (event_id = post.id per the
upstream Post model, lane per channel_id, one row per post) before handler
scheduling; dispatch runs through the core drain with deferred claims through
debounce, merged-flush fan-out adoption, gated-turn settlement, and 30d/20k
tombstones covering the old 5min/2k guard, which is deleted after its parity
test. post_edited stays excluded and cannot be swallowed by posted
tombstones. Cold-gap limitation stated: Mattermost cannot replay posts missed
while disconnected.

Autoreview blocked by codex sandbox network in the build stage; full manual
review performed (updated one websocket test asserting the pre-adoption
parsed-post contract to the raw-envelope contract). Part of #109657 wave 2.
Landing autoreview caught a real loss path: a durable enqueue failure at the
websocket chokepoint was logged and swallowed — the raw envelope discarded,
the connection kept running against a broken store, and reconnect never
replays, so a transient SQLite failure silently lost the post. The append now
retries with short backoff for transient blips; a persistent failure
propagates and the websocket terminates loudly so the outage is
operator-visible instead of silently dropping every subsequent post.
Regression test covers both the absorbed-transient and escalation paths.
…rune

stop() disposing before the startup pump finished pruning let the pump
lazily create a fresh undisposed drain and dispatch after shutdown. The pump
now re-checks running after the prune, and stop() disposes again after
awaiting the pump so a drain created mid-race is torn down. Regression test
blocks the prune across stop and asserts no dispatch.
Concurrent websocket callbacks let a post in append-retry backoff be
overtaken by its successor, inverting same-channel arrival order in the
queue. Admissions now chain (order over latency, mirroring the iMessage
admission tail); regression proves a retried post still lands ahead of a
concurrently received one.
steipete added 2 commits July 18, 2026 06:31
…ector

Posts can carry their channel id on the post, the event data, or the
broadcast envelope — the monitor dispatch honors all three, but the ingress
inspector and claim-side validator required the nested field, rejecting valid
posts as permanent and (via the storage-failure escalation) tearing down the
socket for a failure that never happened, losing posts reconnect cannot
replay. Both sites accept the three shapes; regression proves an
envelope-level post dispatches.
@steipete
steipete force-pushed the claude/ingress-mattermost branch from 8d98b23 to 177ae09 Compare July 18, 2026 05:32
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation channel: imessage Channel integration: imessage channel: msteams Channel integration: msteams app: ios App: ios app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations extensions: elevenlabs labels Jul 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 177ae096e7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2048 to +2049
await debouncer.enqueue({ post, payload, turnAdoptionLifecycle });
return { kind: "deferred" };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not block Mattermost debounce behind the first claim

When Mattermost inbound debouncing is enabled (messages.inbound.debounceMs or a per-channel override), this returns deferred after only the first same-channel post reaches the debouncer. The durable drain keeps that channel lane active until the claim is adopted, so later posts in the same debounce window stay pending and cannot join onFlush; rapid text messages that previously merged into one agent turn now dispatch as separate turns, each after its own debounce delay. Let the durable layer coalesce pending same-lane posts before holding the lane, or otherwise arrange for the debouncer to see all same-key posts in the window.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit d4d23fe into main Jul 18, 2026
110 of 113 checks passed
@steipete
steipete deleted the claude/ingress-mattermost branch July 18, 2026 05:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

* fix(mattermost): adopt durable ingress drain at the websocket chokepoint

Posted events processed detached from the websocket receive with only a
5-minute in-memory guard; a crash lost the post and reconnect never replays
it. Raw posted envelopes now journal durably (event_id = post.id per the
upstream Post model, lane per channel_id, one row per post) before handler
scheduling; dispatch runs through the core drain with deferred claims through
debounce, merged-flush fan-out adoption, gated-turn settlement, and 30d/20k
tombstones covering the old 5min/2k guard, which is deleted after its parity
test. post_edited stays excluded and cannot be swallowed by posted
tombstones. Cold-gap limitation stated: Mattermost cannot replay posts missed
while disconnected.

Autoreview blocked by codex sandbox network in the build stage; full manual
review performed (updated one websocket test asserting the pre-adoption
parsed-post contract to the raw-envelope contract). Part of openclaw#109657 wave 2.

* style(mattermost): keep ingress monitor type internal

* fix(mattermost): retry then loudly escalate a failed durable append

Landing autoreview caught a real loss path: a durable enqueue failure at the
websocket chokepoint was logged and swallowed — the raw envelope discarded,
the connection kept running against a broken store, and reconnect never
replays, so a transient SQLite failure silently lost the post. The append now
retries with short backoff for transient blips; a persistent failure
propagates and the websocket terminates loudly so the outage is
operator-visible instead of silently dropping every subsequent post.
Regression test covers both the absorbed-transient and escalation paths.

* style(mattermost): format rebased ingress handler

* docs(mattermost): document bounded auth-failure retries under deferred claims

* fix(mattermost): guard the drain pump against stop racing the async prune

stop() disposing before the startup pump finished pruning let the pump
lazily create a fresh undisposed drain and dispatch after shutdown. The pump
now re-checks running after the prune, and stop() disposes again after
awaiting the pump so a drain created mid-race is torn down. Regression test
blocks the prune across stop and asserts no dispatch.

* fix(mattermost): serialize durable admissions to preserve lane order

Concurrent websocket callbacks let a post in append-retry backoff be
overtaken by its successor, inverting same-channel arrival order in the
queue. Admissions now chain (order over latency, mirroring the iMessage
admission tail); regression proves a retried post still lands ahead of a
concurrently received one.

* test(mattermost): assert lane order via dispatch sequence

* fix(mattermost): stop() awaits in-flight admissions before disposal

* fix(mattermost): satisfy ingress lint checks

* fix(mattermost): honor envelope-level channel ids in the durable inspector

Posts can carry their channel id on the post, the event data, or the
broadcast envelope — the monitor dispatch honors all three, but the ingress
inspector and claim-side validator required the nested field, rejecting valid
posts as permanent and (via the storage-failure escalation) tearing down the
socket for a failure that never happened, losing posts reconnect cannot
replay. Both sites accept the three shapes; regression proves an
envelope-level post dispatches.
wangmiao0668000666 added a commit to wangmiao0668000666/openclaw that referenced this pull request Aug 6, 2026
Matrix advances the /sync token before inbound events finish dispatching
(matrix-js-sdk doSync sets the token first, then the plugin's SQLite sync
store persists it), while room messages were dispatched into a memory-only
detached queue for the full agent-turn duration. A gateway crash or restart
in that window permanently lost the user message: the next /sync told the
homeserver the batch was consumed.

Journal every dispatchable inbound event into the shared channel ingress
queue (channel_ingress_events, no schema change) synchronously inside the
sync event listener — before the debounced token persist can land — and
dispatch through the core durable ingress drain with per-room lanes,
complete-at-adoption via the canonical turnAdoptionLifecycle reply-options
seam, bounded retry/dead-letter, and restart replay. The existing
persistent inbound deduper keeps redelivered events exactly-once. Events
without an event id keep the previous live-dispatch path.

Mirrors the durable-ingress fleet adoption (openclaw#109657): telegram openclaw#108924,
discord openclaw#110274, whatsapp openclaw#110418, mattermost openclaw#110386, msteams openclaw#110357.

Co-Authored-By: Claude <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…10386)

* fix(mattermost): adopt durable ingress drain at the websocket chokepoint

Posted events processed detached from the websocket receive with only a
5-minute in-memory guard; a crash lost the post and reconnect never replays
it. Raw posted envelopes now journal durably (event_id = post.id per the
upstream Post model, lane per channel_id, one row per post) before handler
scheduling; dispatch runs through the core drain with deferred claims through
debounce, merged-flush fan-out adoption, gated-turn settlement, and 30d/20k
tombstones covering the old 5min/2k guard, which is deleted after its parity
test. post_edited stays excluded and cannot be swallowed by posted
tombstones. Cold-gap limitation stated: Mattermost cannot replay posts missed
while disconnected.

Autoreview blocked by codex sandbox network in the build stage; full manual
review performed (updated one websocket test asserting the pre-adoption
parsed-post contract to the raw-envelope contract). Part of openclaw#109657 wave 2.

* style(mattermost): keep ingress monitor type internal

* fix(mattermost): retry then loudly escalate a failed durable append

Landing autoreview caught a real loss path: a durable enqueue failure at the
websocket chokepoint was logged and swallowed — the raw envelope discarded,
the connection kept running against a broken store, and reconnect never
replays, so a transient SQLite failure silently lost the post. The append now
retries with short backoff for transient blips; a persistent failure
propagates and the websocket terminates loudly so the outage is
operator-visible instead of silently dropping every subsequent post.
Regression test covers both the absorbed-transient and escalation paths.

* style(mattermost): format rebased ingress handler

* docs(mattermost): document bounded auth-failure retries under deferred claims

* fix(mattermost): guard the drain pump against stop racing the async prune

stop() disposing before the startup pump finished pruning let the pump
lazily create a fresh undisposed drain and dispatch after shutdown. The pump
now re-checks running after the prune, and stop() disposes again after
awaiting the pump so a drain created mid-race is torn down. Regression test
blocks the prune across stop and asserts no dispatch.

* fix(mattermost): serialize durable admissions to preserve lane order

Concurrent websocket callbacks let a post in append-retry backoff be
overtaken by its successor, inverting same-channel arrival order in the
queue. Admissions now chain (order over latency, mirroring the iMessage
admission tail); regression proves a retried post still lands ahead of a
concurrently received one.

* test(mattermost): assert lane order via dispatch sequence

* fix(mattermost): stop() awaits in-flight admissions before disposal

* fix(mattermost): satisfy ingress lint checks

* fix(mattermost): honor envelope-level channel ids in the durable inspector

Posts can carry their channel id on the post, the event data, or the
broadcast envelope — the monitor dispatch honors all three, but the ingress
inspector and claim-side validator required the nested field, rejecting valid
posts as permanent and (via the storage-failure escalation) tearing down the
socket for a failure that never happened, losing posts reconnect cannot
replay. Both sites accept the three shapes; regression proves an
envelope-level post dispatches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: mattermost Channel integration: mattermost maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant