Skip to content

feat(agents): End a Thread's sign-in-paused Turn on a tree stop - #2845

Merged
dcramer merged 1 commit into
mainfrom
feat/thread-input-stop
Nov 8, 2026
Merged

dcramer merged 1 commit into
mainfrom
feat/thread-input-stop

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

PR 3b of #2792 (Thread stop). Builds on #2840 and #2832. Nobody can create a Thread until PR 6, so roots and Tasks keep today's behavior.

Stop. A tree stop marks each child stopped and stops its work. A Thread's person Turn that waits for sign-in has no worker, so the stop never reached it, and a later sign-in callback could resume it. finishStoppedTree now reads the Thread's sign-in-paused Turn and ends it with cancelSignInPausedTurn, with the same cleanup as a stopped resume. abandonTurnRecord takes onlyIfAuthPaused, so a Turn that a worker already resumed keeps its worker.

Restart. No new rule. As on a root, a person's input to a stopped Thread runs and ends its stop (#2832). Then watch Events and results run again.

Tests: thread-input-stop.test.ts covers the three sign-in stop cases, the resumed-Turn race, and the restart. The shared Thread helpers move to tests/fixtures/thread-input.ts.

via @dcramer.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 6, 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 8, 2026 3:34am UTC

Request Review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/junior/src/chat/tools/index.ts Resolved

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit df75512. Configure here.

@sentry-junior
sentry-junior Bot force-pushed the feat/thread-input-stop branch from a69cab1 to e53308c Compare November 7, 2026 00:25
@sentry-junior
sentry-junior Bot force-pushed the feat/thread-input-path branch from ee54ba6 to aa545ac Compare November 7, 2026 01:16
@sentry-junior
sentry-junior Bot force-pushed the feat/thread-input-stop branch from e53308c to d0562f5 Compare November 7, 2026 01:24
@sentry-junior
sentry-junior Bot force-pushed the feat/thread-input-stop branch from d0562f5 to 995deac Compare November 7, 2026 02:00
@sentry-junior
sentry-junior Bot force-pushed the feat/thread-input-stop branch from 995deac to 016edc4 Compare November 7, 2026 02:21
@sentry-junior
sentry-junior Bot force-pushed the feat/thread-input-path branch from ef13148 to eb202a5 Compare November 7, 2026 02:30
@sentry-junior
sentry-junior Bot force-pushed the feat/thread-input-stop branch from 016edc4 to 5db90d7 Compare November 7, 2026 02:31
@sentry-junior
sentry-junior Bot force-pushed the feat/thread-input-path branch 2 times, most recently from 156a5cb to 3aff81a Compare November 8, 2026 01:32
dcramer added a commit that referenced this pull request Nov 8, 2026
PR 3a of #2792 (Thread input path). Stop and the Thread restart rule
come in #2845. Nobody can create a Thread until PR 6, so roots and Tasks
keep today's behavior.

Every check reads the stored Conversation row (`kind`, Destination).
None parse ids.

**Input.** `acceptsWebMessages` is the one check. A child accepts web
input only when `kind === "thread"`. The dashboard, ACP and review-desk
replies all use it. A Task still gets 409.

**Router.** For a Thread, a web batch goes to the mailbox worker. A
resume wake goes to a person's Turn only when it names that Turn.
Everything else goes to the invocation worker.

**A person's Turn in a Thread:**
- Destination: from the Thread's own row. Reads no longer hide the
Destination a child copied at creation (#2865). Delivery stays
root-only.
- Run consistency: `assertRunConsistency` gets `kind` from the row
`executeAgentRun` already reads. For a Thread, it skips the
source/destination id match.
- Visibility: the Thread's. Private when missing.
- `subagents` is disabled. Memory tasks are skipped.
- New input supersedes open mailbox Turns. The code is shared with roots
in `supersede-turns.ts`.

**Child work keeps no Destination.** `wakePausedTurn` and
`recordWebConversationActivity` pass none for a non-root row, so the
invocation worker's guard still holds.

Deviation: invocation input does not queue behind a person's Turn that
is paused for sign-in.

Tests store a Thread by spawning a child and setting `kind = 'thread'`
in SQL.

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A96e1fbed00be27afa889991eed5d625a -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A96e1fbed00be27afa889991eed5d625a)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A96e1fbed00be27afa889991eed5d625a/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <[email protected]>
Base automatically changed from feat/thread-input-path to main November 8, 2026 02:14
@dcramer

dcramer commented Nov 8, 2026

Copy link
Copy Markdown
Member

stop should be pretty straight forward as its basically just a stopConversation and an applyToChildren which should just trigger the same behavior across all (collect all IDs in a stack, fanout stops to all with Promise.all() ?)

A tree stop marks each child stopped and stops its work. A Thread's
person Turn that waits for sign-in has no worker, so the stop never
reached it, and a later sign-in callback could resume it. The tree stop
now cancels that Turn with the same cleanup as a stopped resume.
abandonTurnRecord takes onlyIfAuthPaused, so a Turn that a worker
already resumed keeps its worker.

A person's input already ends a stopped Thread's stop through #2832, so
no Thread restart rule is needed.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior
sentry-junior Bot force-pushed the feat/thread-input-stop branch from 5db90d7 to 8df9c18 Compare November 8, 2026 03:33
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: high PR risk score: high labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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

Review screenshots in Frameshift

Conversation Create Focused · Desktop
Conversation Create Focused · 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
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
Show 1 more changed screenshot
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed

@dcramer
dcramer merged commit 45968f8 into main Nov 8, 2026
44 checks passed
@dcramer
dcramer deleted the feat/thread-input-stop branch November 8, 2026 03:58
@sentry-junior sentry-junior Bot changed the title feat(agents): Stop and restart Threads feat(agents): End a Thread's sign-in-paused Turn on a tree stop Nov 8, 2026

This branch was successfully deployed

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

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant