Skip to content

fix(conversations): End a request that waits for sign-in on every stop - #2960

Merged
dcramer merged 2 commits into
mainfrom
fix/stop-ends-sign-in-wait
Nov 9, 2026
Merged

dcramer merged 2 commits into
mainfrom
fix/stop-ends-sign-in-wait

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Refs #2890 (Conversation stop item, first slice).

Bug

A person stops a Slack thread while a request waits for sign-in. With the native stop button, a dashboard Stop, or an ACP cancel, the request keeps waiting, and a later sign-in resumes it and answers. Only the stop keyword worked: on sign-in, wasPendingAuthStopped scanned the thread for a skipped Message whose skippedReason starts with thread_opt_out:. That made stop a third copy of the state, read from Message text.

Change

  • stopConversation ends the stopped Conversation's own sign-in wait with cancelSignInWait, as the tree stop already did for child agents. It finds a web Turn from its auth-paused Turn record and a Slack request from the thread's pending sign-in. Then it runs the existing cancelSignInPausedTurn. That function claims the Turn (onlyIfAuthPaused), so a worker that already resumed it keeps its end.
  • finishStoppedTree uses the same function, so a child Thread with a Slack sign-in wait also ends.
  • Deleted wasPendingAuthStopped. The Turn record is now abandoned, and the resume's beforeStart rejects it. The terminal state blocks the late write.
  • Deleted stopConversationTurn (only caller: stopConversation). Its auth-paused branch asked for work only to stop it again, and the stop wake could reach queued input first.
  • MCP callback (handlers/mcp-oauth-callback.ts): only a newer attempt expires a link. A sign-in that completes after its request stopped saves the credential, does not resume the request, and shows "connected … ask again when you need it".

UX: every stop surface acts the same. A sign-in after a stop still connects the account for later requests. Before, the link said "will continue the paused request". DX/AX: no stop state comes from Message text.

Compatibility

No storage, schema, HTTP, or plugin API change. A web Turn that waits for sign-in now returns no_work from a dashboard or MCP stop instead of requested. No worker runs that Turn, so no_work is accurate. A keyword stop sent before the deploy, with a sign-in after it, now resumes the request. This window is short.

Tests

tests/integration/slack/mcp-authorization.test.ts uses the real Slack ingress, queue, worker, and MCP OAuth callback. A request waits for sign-in. The person stops it with the keyword, the native button, or stopConversation, then approves the link. No answer is posted, and a later request answers with the saved credential and no new link. Before this change, the button and dashboard cases failed. The wasPendingAuthStopped unit tests are deleted. thread-input.test.ts fails with "Conversation parent changed" now and then, and it does the same on main with a reused local DB.

Left for #2890

  • Wall-clock scope: the stop compares stopped_at with createdAtMs, receivedAtMs, and the invocation createdAtMs. The known gap in session-stop.ts is input sent before the stop but received after it: it runs, and the Conversation stays stopped. The fix is an ordered cutoff (stopped{at, cutoffSeq}). Inbound messages have no seq yet. This needs the mailbox owner and overlaps feat(conversations): Derive one Conversation status #2951's planned 7b.
  • One transition owner (setConversationStop) over markConversationsStopped and resumeStoppedConversationTree. Best done after 7b, which sends every stop through the tree stop.
  • isChildAgentSessionStopped (child status, sm-child-agents). Dashboard status is in feat(conversations): Derive one Conversation status #2951.
  • The Redis stop key is a one-shot request to abort a run, not a copy of the stopped state. No change.

via @dcramer.

--

View Session [Sentry]

Every stop path now ends the stopped Conversation's own Turn that waits
for sign-in, for Slack and web, as the tree stop already did for child
agents. Before, only the Slack `stop` keyword did this for a Slack
request, by scanning the thread for a skipped Message whose reason
starts with `thread_opt_out:` when the sign-in completed. The native
stop button, a dashboard stop, and an ACP cancel left the request
waiting, and a later sign-in resumed it.

Delete `wasPendingAuthStopped` and the auth-paused re-stop in
`stopConversationTurn`. A stop no longer is read from Message text.

Refs #2890

Co-Authored-By: David Cramer <[email protected]>
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

12 screenshot changes — 12 changed · 0 added · 0 removed

Review screenshots in Frameshift

Automation Run Details · Desktop
Automation Run Details · Desktop
Changed
Automation Run Details Light · Desktop
Automation Run Details Light · Desktop
Changed
Conversation Attachment Zoom · Desktop
Conversation Attachment Zoom · Desktop
Changed
Conversation Captured Memories Popover · Desktop
Conversation Captured Memories Popover · Desktop
Changed
Conversation Details Watched Linked Work · Desktop
Conversation Details Watched Linked Work · Desktop
Changed
Conversation Details Watched Linked Work · Mobile
Conversation Details Watched Linked Work · Mobile
Changed
Show 6 more changed screenshots
Conversation Event Log Virtual · Mobile
Conversation Event Log Virtual · Mobile
Changed
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Conversation Memory List Jump · Desktop
Conversation Memory List Jump · Desktop
Changed
Conversation Share Details · Desktop
Conversation Share Details · Desktop
Changed
Conversations Sections Collapsed · Desktop
Conversations Sections Collapsed · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed

@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 9, 2026 3:37am UTC

Request Review

@dcramer

dcramer commented Nov 9, 2026

Copy link
Copy Markdown
Member

what happens when a user completes the sign-in during this? ideally itd still store the token and just not use it rn

A stop clears the pending sign-in, so the MCP callback treated the link as
expired and dropped the credential. Now only a newer attempt expires a link.
A sign-in for a request that no longer waits saves the credential, does not
resume the request, and says so on the callback page.
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 9, 2026
@dcramer
dcramer merged commit ae3c9e5 into main Nov 9, 2026
45 checks passed
@dcramer
dcramer deleted the fix/stop-ends-sign-in-wait branch November 9, 2026 04:16

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 0d8760df Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant