Skip to content

feat(infinity-slack-bot): "Switch model" message shortcut for per-thread model switching - #163

Draft
akainth015 wants to merge 1 commit into
pr/slack-input-finalizefrom
pr/slack-switch-model
Draft

akainth015 wants to merge 1 commit into
pr/slack-input-finalizefrom
pr/slack-switch-model

Conversation

@akainth015

Copy link
Copy Markdown
Member

Slack rejects slash commands inside threads, so per-thread model switching ships as a message shortcut (switch_model): ⋮ menu on any message → thread-scoped picker modal → ClientMessage::SwitchModel targeting that thread's session (root, or the subagent's own agent thread when invoked inside a dedicated subagent thread). ModelSwitched broadcasts post a '🧠 Model switched…' note in the right thread. The channel-level /model (default for new sessions) is unchanged; the picker builder is shared, not duplicated. Works against the current daemon (SwitchModel is an old protocol variant). Requires adding the shortcut in Slack app settings (docs manifest updated). 80 tests green.

Tail of the Slack stack (on #160).

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Deploying infinity with  Cloudflare Pages  Cloudflare Pages

Latest commit: a97503d
Status: ✅  Deploy successful!
Preview URL: https://640fa6a8.infinity-dc7.pages.dev
Branch Preview URL: https://pr-slack-switch-model.infinity-dc7.pages.dev

View logs

@akainth015
akainth015 added this pull request to stack #149 October 19, 2026 19:24
@akainth015
akainth015 force-pushed the pr/slack-switch-model branch from 14f67b7 to ac74d0a Compare October 19, 2026 19:25
@akainth015
akainth015 requested a review from a team October 19, 2026 19:25
@akainth015
akainth015 force-pushed the pr/slack-input-finalize branch 2 times, most recently from 360cb20 to 88f7f96 Compare October 19, 2026 20:31
@akainth015
akainth015 force-pushed the pr/slack-switch-model branch from ac74d0a to b7c31df Compare October 19, 2026 20:31
@akainth015
akainth015 removed this pull request from stack #149 October 19, 2026 22:08
@akainth015
akainth015 force-pushed the pr/slack-input-finalize branch from 88f7f96 to b775713 Compare October 19, 2026 23:51
@akainth015
akainth015 force-pushed the pr/slack-switch-model branch from b7c31df to 3957e95 Compare October 19, 2026 23:51
@akainth015
akainth015 force-pushed the pr/slack-input-finalize branch from b775713 to 9935fad Compare October 20, 2026 00:17
@akainth015
akainth015 force-pushed the pr/slack-switch-model branch from 3957e95 to e9273af Compare October 20, 2026 00:17
@akainth015
akainth015 marked this pull request as draft October 20, 2026 02:52
@akainth015
akainth015 force-pushed the pr/slack-switch-model branch from e9273af to e207160 Compare October 20, 2026 17:42
@akainth015
akainth015 force-pushed the pr/slack-input-finalize branch from 9935fad to 66e5fea Compare October 20, 2026 17:42
…ead model switching

Slack never delivers slash commands from inside message threads, so
per-thread model switching rides the context ⋮ menu instead of `/model`:

* New `switch_model` message shortcut → a thread-scoped model-picker modal
  (shared option-building with the `/model` picker; distinct
  `thread_model_submit` callback so both flows coexist). The thread picker
  does not preselect anything: the bot doesn't track each thread's current
  model, and preselecting the session default would mislead after a prior
  switch.
* Submission → new `DaemonCommand::SwitchModel` →
  `ClientMessage::SwitchModel` (per-thread; already supported by daemons on
  main, so this works against the currently running daemon). Invoked in the
  root conversation thread it switches the session root; invoked inside a
  subagent's dedicated thread it switches that subagent's agent thread (via
  `subagent_routes`). The channel-level `/model` default-switch behavior is
  unchanged.
* The daemon's `ModelSwitched` broadcast now posts a "🧠 Model switched"
  note in the right Slack thread (incl. switches made from other clients),
  routed into subagent threads when applicable.
* Friendly ephemeral errors: no session, no models known yet, no trigger id.
* Manifest + docs updated (user action: add the `switch_model` shortcut in
  app settings; manifests replace, don't merge).

Validation: fmt, clippy -D warnings, 80 tests green (2 new parse unit tests,
2 new flow unit tests, 2 new sim tests).
@akainth015
akainth015 force-pushed the pr/slack-switch-model branch from e207160 to a97503d Compare October 22, 2026 01:18
@akainth015
akainth015 force-pushed the pr/slack-input-finalize branch from 66e5fea to 51fe4cf Compare October 22, 2026 01:18
akainth015 added a commit to hydro-project/infinity-slack that referenced this pull request Oct 29, 2026
…ead model switching

Slack never delivers slash commands from inside message threads, so
per-thread model switching rides the context ⋮ menu instead of `/model`:

* New `switch_model` message shortcut → a thread-scoped model-picker modal
  (shared option-building with the `/model` picker; distinct
  `thread_model_submit` callback so both flows coexist). The thread picker
  does not preselect anything: the bot doesn't track each thread's current
  model, and preselecting the session default would mislead after a prior
  switch.
* Submission → new `DaemonCommand::SwitchModel` →
  `ClientMessage::SwitchModel` (per-thread; already supported by the
  pinned protocol and current daemons). Invoked in the root conversation
  thread it switches the session root; invoked inside a subagent's
  dedicated thread it switches that subagent's agent thread (via
  `subagent_routes`). The channel-level `/model` default-switch behavior
  is unchanged.
* The daemon's `ModelSwitched` broadcast now posts a "🧠 Model switched"
  note in the right Slack thread (incl. switches made from other clients),
  routed into subagent threads when applicable.
* Friendly ephemeral errors: no session, no models known yet, no trigger id.
* Manifest + docs updated (user action: add the `switch_model` shortcut in
  app settings; manifests replace, don't merge).

Tests: 2 new parse unit tests, 2 new flow unit tests, 2 new sim tests.

Ported from hydro-project/infinity#163.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant