Skip to content

feat(infinity-slack-bot): interrupt daemon generation on Slack stop - #143

Draft
akainth015 wants to merge 1 commit into
pr/slack-subagent-threadsfrom
pr/slack-stop-interrupt
Draft

akainth015 wants to merge 1 commit into
pr/slack-subagent-threadsfrom
pr/slack-stop-interrupt

Conversation

@akainth015

@akainth015 akainth015 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Wires the Slack stop path to ClientMessage::Interrupt: stop in the root thread interrupts the whole session; stop inside a subagent's dedicated thread interrupts just that subtree. No-op against older daemons.

Stacked; part 4 of 6.

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying infinity with  Cloudflare Pages  Cloudflare Pages

Latest commit: d9f870c
Status: ✅  Deploy successful!
Preview URL: https://8eddf305.infinity-dc7.pages.dev
Branch Preview URL: https://pr-slack-stop-interrupt.infinity-dc7.pages.dev

View logs

@akainth015
akainth015 added this pull request to stack #149 October 16, 2026 17:01
@akainth015
akainth015 force-pushed the pr/slack-stop-interrupt branch from 9d5b10e to 5f1fb25 Compare October 16, 2026 17:02
@akainth015
akainth015 requested a review from a team October 16, 2026 17:02
@akainth015
akainth015 force-pushed the pr/slack-stop-interrupt branch 2 times, most recently from 817e5ff to a5e3abb Compare October 19, 2026 20:31
Base automatically changed from pr/daemon-interrupt to pr/slack-subagent-threads 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-stop-interrupt branch from a5e3abb to bdc7579 Compare October 19, 2026 23:51
@akainth015
akainth015 force-pushed the pr/slack-subagent-threads branch 2 times, most recently from 19a0968 to 2a2b13c Compare October 20, 2026 00:17
@akainth015
akainth015 force-pushed the pr/slack-stop-interrupt branch from bdc7579 to 1f2fec3 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-stop-interrupt branch from 1f2fec3 to a969704 Compare October 20, 2026 17:42
…terrupt

Adds Slack's native stop button end to end, landing together with the
`ClientMessage::Interrupt` wiring so stop actually stops generation:

## Stop button (`agent_session_stopped`)
* Handles the `agent_session_stopped` event: discards buffered output and
  in-flight task cards, never re-touches the messages Slack already
  finalized client-side, latches the thread so the remainder of the current
  response is suppressed (latch lifts on the response's final stop or the
  user's next message), transitions the session out of `processing`, and
  posts a stop confirmation. `stopped_by_user` append errors set the same
  latch (defense-in-depth). Requires the `agent_session_stopped` bot event
  subscription (manifest updated in docs).

## Interrupt wiring
* A stop in the root thread interrupts the whole session; a stop inside a
  subagent's dedicated thread halts and interrupts just that subagent's
  subtree (`DaemonCommand::Interrupt` via the thread's daemon connection).
  Sending to an older daemon is a safe no-op (unparsable frames skipped).

Docs (stop section + troubleshooting) and sim/unit tests included.
@akainth015
akainth015 force-pushed the pr/slack-stop-interrupt branch from a969704 to d9f870c Compare October 22, 2026 01:18
@akainth015
akainth015 force-pushed the pr/slack-subagent-threads branch from 2001008 to 790a43c Compare October 22, 2026 01:18
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