fix(mattermost): anchor slash state on globalThis (#68113)#90389
fix(mattermost): anchor slash state on globalThis (#68113)#90389ly85206559 wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 4, 2026, 12:23 PM ET / 16:23 UTC. Summary PR surface: Source +21, Tests +43. Total +64 across 2 files. Reproducibility: yes. The linked issue provides concrete Mattermost setup steps and current source shows the callback route returns 503 when its module-local state is empty while activation happens through a separate monitor path; I did not run a live Mattermost server in this read-only review. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused Mattermost plugin state-sharing fix after normal maintainer and CI review; a live Mattermost slash POST smoke would be useful acceptance proof but does not appear to require a different code shape. Do we have a high-confidence way to reproduce the issue? Yes. The linked issue provides concrete Mattermost setup steps and current source shows the callback route returns 503 when its module-local state is empty while activation happens through a separate monitor path; I did not run a live Mattermost server in this read-only review. Is this the best way to solve the issue? Yes. Anchoring the one intended per-process Mattermost slash state on a Symbol.for globalThis key is a narrow fix that matches existing OpenClaw process-local singleton patterns and avoids a larger plugin-loader refactor. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 473f651e0933. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +21, Tests +43. Total +64 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
96bf3d3 to
d1d2aec
Compare
|
@clawsweeper automerge |
|
🦞🔧
Draft PRs stay fix-only until GitHub marks them ready for review. Pause with Automerge progress:
|
|
ClawSweeper 🐠 reef update Thanks for the useful work here. ClawSweeper could not update this branch directly, so the replacement PR is the writable swim lane for the same fix path. Why replacement: ClawSweeper could not update the source PR branch directly; GitHub did not grant sufficient push rights to the bot for that branch.
fish notes: model gpt-5.5, reasoning high; reviewed against 3cf28a1. |
Summary
"Slash commands are not yet initialized"even after logs showslash commands activated(regression reported in [Bug]: Mattermost slash commands return 503 "not yet initialized" in v2026.4.15 #68113 on v2026.4.15+).accountStatesMap, so the route handler never saw tokens/handlers populated byactivateSlashCommands().accountStateson a process-wideglobalThissingleton viaSymbol.for("openclaw.mattermost.slash-account-states"), matching the approach from closed PR fix(mattermost): anchor slash command state to globalThis to fix dual-instance 503s #69038.vi.resetModules()), modeling the dual-loader failure mode.Intentionally out of scope: Mattermost API registration changes, multi-account routing policy, nginx/proxy config, or unrelated channel work.
Reviewer focus: Confirm shutdown/deactivate still clears global state; multi-account ambiguous-token behavior unchanged; no new cross-plugin globals beyond the documented symbol.
Linked context
Closes #68113
Related #69038
Real behavior proof
/oc_*commands ([Bug]: Mattermost slash commands return 503 "not yet initialized" in v2026.4.15 #68113).fix/mattermost-slash-68113), local gateway on loopback with Mattermost channel configured for native slash commands (same callback path as issue reporter).git checkout fix/mattermost-slash-68113and build/install the local tree.channels.mattermost.commands.native(and callback URL/path) are enabled in config, matching the issue setup.pnpm openclaw gateway run --bind loopback --port 18789 --forcemattermost: slash commands activatedfor the account.curl -sk -o NUL -w "HTTP %{http_code}\n" http://127.0.0.1:18789/api/channels/mattermost/command/oc_statusin Mattermost against the configured callback URL to confirm end-user slash delivery when a server is available.HTTP 503with JSON"Slash commands are not yet initialized..."(see [Bug]: Mattermost slash commands return 503 "not yet initialized" in v2026.4.15 #68113 logs).accountStatesmap.curlprobe plus gateway runtime logs. Maintainer with Mattermost can confirm POST slash execution on the same build.Tests and validation
pnpm test extensions/mattermost/src/mattermost/slash-state.test.ts— 6 passed (includes globalThis singleton + module-reload regression)Risk checklist
Did user-visible behavior change? Yes — Mattermost slash callbacks stop returning permanent 503 after activation.
Could this break multi-account slash routing? Low — only shares state that was always intended to be shared; ambiguous token/conflict paths unchanged.
Could global state leak across restarts? Mitigated —
deactivateSlashCommands()still clears entries; symbol is process-scoped.What reviewers should focus on
globalThisis the smallest fix vs forcing a single module instance (prefer smallest per fix(mattermost): anchor slash command state to globalThis to fix dual-instance 503s #69038).