Skip to content

fix(slack): prefer configured slash command - #104736

Merged
sjf-oa merged 4 commits into
mainfrom
fix/slack-slash-secret-refs
Jul 12, 2026
Merged

sjf-oa merged 4 commits into
mainfrom
fix/slack-slash-secret-refs

Conversation

@sjf-oa

@sjf-oa sjf-oa commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Slack slash commands timing out when an explicit tenant command is configured while native Slack commands are enabled.

Root Cause

The Slack monitor treated native commands and the configured tenant command as mutually exclusive, but checked native commands first:

if (nativeCommands.length > 0) {
  // register native commands
} else if (slashCommand.enabled) {
  // register configured command
}

Because native commands are enabled by default, an explicit command such as /claw was never registered. Slack routed the command to the app, but no Bolt handler acknowledged it, so users saw the generic "app did not respond" failure.

Fix

Keep the command modes mutually exclusive, but let explicit tenant configuration win:

if (slashCommand.enabled) {
  // register configured command
} else if (nativeCommands.length > 0) {
  // register native commands
}

The regression test verifies that an enabled configured slash command registers its matcher and does not also register native /usage.

Why the Runtime-Config Change Was Removed

An earlier revision added startup source-config matching around getRuntimeConfigSnapshot(). That was unnecessary and made the fix harder to reason about:

  • The live failure occurred before the slash handler ran, so it did not demonstrate a SecretRef/runtime-snapshot failure.
  • The runtime snapshot is already the current resolved runtime config.
  • Capturing a startup source config as a frozen identity anchor added special-case state without fixing the actual registration bug.

The final patch restores the straightforward runtime lookup:

const cfg = getRuntimeConfigSnapshot() ?? ctx.cfg;

Evidence

  • Before the registration fix, /claw status returned Slack's generic "app did not respond" failure while Socket Mode and the app credentials were healthy.
  • After the registration fix, /claw status returned an ephemeral operational status response.
  • After the registration fix, /claw help returned the ephemeral help menu.
  • The successful live proof was on commit 92924d0; the later runtime-config experiment was removed, so final head d8f8522 retains the already-proven registration behavior.

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: S maintainer Maintainer-authored PR labels Jul 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 8:02 PM ET / July 12, 2026, 00:02 UTC.

Summary
The PR makes explicitly configured Slack single-command mode take precedence over native-command mode and adds regression coverage that only the configured matcher is registered.

PR surface: Source 0, Tests +17. Total +17 across 2 files.

Reproducibility: yes. Current main deterministically chooses native registration first, leaving the explicitly configured Slack command without a Bolt listener when both modes resolve enabled; this matches the reported timeout.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

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

Rank-up moves:

  • none.

Next step before merge

  • No automated repair is needed; the clean patch should remain open for normal Slack owner review and merge gates, especially because it carries the protected maintainer label.

Security
Cleared: The two-file Slack runtime/test patch changes no dependency, secret, permission, workflow, package-resolution, installation, publishing, or executable-artifact surface.

Review details

Best possible solution:

Merge the focused branch-order fix after normal Slack owner review, preserving the documented mutually exclusive command modes and the regression test that locks configured-command precedence.

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

Yes. Current main deterministically chooses native registration first, leaving the explicitly configured Slack command without a Bolt listener when both modes resolve enabled; this matches the reported timeout.

Is this the best way to solve the issue?

Yes. Reordering the two existing mutually exclusive branches is the narrowest maintainable fix and matches the documented single-command-versus-native-command contract without adding configuration or compatibility state.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR records a real Slack before/after result for the configured handler, and final head retains that proven registration path while removing the later unrelated runtime-config experiment.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR records a real Slack before/after result for the configured handler, and final head retains that proven registration path while removing the later unrelated runtime-config experiment.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The bug blocks an explicitly configured Slack command but is limited to one channel mode and has a focused, low-blast-radius fix.
  • 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. Sufficient (live_output): The PR records a real Slack before/after result for the configured handler, and final head retains that proven registration path while removing the later unrelated runtime-config experiment.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR records a real Slack before/after result for the configured handler, and final head retains that proven registration path while removing the later unrelated runtime-config experiment.
Evidence reviewed

PR surface:

Source 0, Tests +17. Total +17 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 14 14 0
Tests 1 20 3 +17
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 34 17 +17

What I checked:

  • Current-main reproduction: Current main resolves both modes, then enters the native-command branch first; when native commands are non-empty, the explicitly enabled configured matcher is never installed. (extensions/slack/src/monitor/slash.ts:857, 02dc25a1b51f)
  • Documented command contract: The Slack guide describes slash behavior as either a single configured command or multiple native commands, and troubleshooting presents those as alternative intended modes. Public docs: docs/channels/slack.md. (docs/channels/slack.md:1480, 02dc25a1b51f)
  • Focused branch fix: Final head reverses only the existing mutually exclusive registration branches and adds a regression assertion that the configured matcher exists while native /usage is absent. (extensions/slack/src/monitor/slash.ts:854, d8f8522dc6d5)
  • Feature provenance: The registration structure on the PR base dates to the Slack extension move, with later contributors expanding native command and documentation behavior around it. (extensions/slack/src/monitor/slash.ts:832, 8746362f5ebf)
  • Exact-head checks: The exact PR head reports 67 successful, 32 skipped, 1 neutral, and no failed check runs, including successful channel-runtime and security-sensitive gates. (d8f8522dc6d5)
  • Real behavior evidence: The PR discussion records the configured command failing before the registration change and returning operational status and help responses afterward; the final commit removes the unrelated runtime-selector experiment while retaining the repaired configured-command path. (extensions/slack/src/monitor/slash.ts:854, d8f8522dc6d5)

Likely related people:

  • scoootscooob: Commit 8746362 moved and established the current Slack slash registration structure, including the native-first conditional now being corrected. (role: introduced behavior; confidence: high; commits: 8746362f5ebf; files: extensions/slack/src/monitor/slash.ts)
  • zimeg: Slack documentation history defines the single configured command and multiple native commands as alternative modes that determine the intended precedence. (role: documentation and feature contributor; confidence: high; commits: 3704069c3f8, bfa2feaa92b, e636ba6ab0a; files: docs/channels/slack.md)
  • steipete: Recent history on the same Slack command surface includes native argument-menu and plugin-command maintenance, making this a useful adjacent routing candidate. (role: recent adjacent contributor; confidence: medium; commits: 77d9ac30bb8, 5be5233250f, f7d7148cf04; files: extensions/slack/src/monitor/slash.ts, docs/channels/slack.md)
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 (5 earlier review cycles)
  • reviewed 2026-07-11T22:24:40.523Z sha f02cffc :: needs real behavior proof before merge. :: [P1] Preserve slash runtime config refreshes
  • reviewed 2026-07-11T23:09:06.158Z sha 92924d0 :: needs real behavior proof before merge. :: [P1] Preserve slash runtime config refreshes | [P1] Keep configured and native slash modes mutually exclusive | [P2] Make the new command-registration test type-check
  • reviewed 2026-07-11T23:17:32.336Z sha 92924d0 :: needs real behavior proof before merge. :: [P1] Preserve slash runtime config refreshes | [P1] Keep configured and native slash modes mutually exclusive | [P2] Make the new command-registration test type-check
  • reviewed 2026-07-11T23:31:30.905Z sha 01e9e9a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-11T23:39:13.807Z sha 01e9e9a :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added 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 rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 11, 2026
@sjf-oa

sjf-oa commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

/review

@clawsweeper

clawsweeper Bot commented Jul 11, 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: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@sjf-oa

sjf-oa commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 11, 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: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 11, 2026
@sjf-oa sjf-oa changed the title fix(slack): slash replies fail with SecretRef tokens fix(slack): prefer configured slash command Jul 11, 2026
@sjf-oa

sjf-oa commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I removed the startup source-config/runtime-selector change. The live failure happened before the slash handler ran: native commands were enabled first, so the explicit tenant command was never registered or acknowledged. getRuntimeConfigSnapshot() ?? ctx.cfg is restored. The final patch only keeps configured/native modes mutually exclusive while making explicit slashCommand.enabled take precedence. The PR body now documents the diagnosis, why the earlier runtime-config experiment was removed, and the live proof boundary.

@clawsweeper

clawsweeper Bot commented Jul 11, 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: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 12, 2026
@sjf-oa
sjf-oa merged commit fd37c03 into main Jul 12, 2026
119 of 121 checks passed
@sjf-oa
sjf-oa deleted the fix/slack-slash-secret-refs branch July 12, 2026 00:14
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 12, 2026
* fix(slack): preserve resolved secrets for slash replies

* fix(slack): register configured slash command with native commands

* fix(slack): preserve slash config refresh semantics

* refactor(slack): keep slash fix focused

---------

Co-authored-by: Sarah Fortune <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack maintainer Maintainer-authored PR 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.

2 participants