Repository navigation
Take Running off a routine's list row when its run ends - #3979
Merged
Merged
Conversation
A run's end writes no store line: only its launch's run line moves, which the window hears as event: deliveries. The routines store read again on that frame only while the Routines page was open, so a list row kept Running for hours, until opening the thread rewrote its root (a run divider) and the store read again. Read again on deliveries while a run is under way, on every reconnect, and when the window is shown again while a run is under way.
…system folder on Linux)
backnotprop
marked this pull request as ready for review
November 24, 2026 07:55
backnotprop
added a commit
that referenced
this pull request
Nov 24, 2026
…es CI checks Merged main's routine re-reads (#3979: a run under way, a reconnect, the window shown again) into the store with this branch's linked-computer reads. Resolved by hand: packages/inbox/scheduled/store.ts, packages/core/inbox-types.ts, packages/server/inbox-machines.ts, packages/server/inbox.ts, tests/e2e/slice-rules.ts, tests/e2e/shard-times.json and apps/mobile/contract/parity/surface.json; the ledger and Wire.swift taken from main, then the mobile contract regenerated. - The routines-machines e2e gives each computer the fake claude on its launch PATH and the plugin in its agent home, as a sandboxed Inbox needs (as inbox-routine-row-run-ends.spec.ts): without them a Run there never started. The fake's turn holds, so the run stays Running. - The door table test fills a routine's id (sch_1), so the scheduled/:id routes are checked against their own entries. - The linked test expects the far switches read's own words (held, away, read_at). - rowRunEnds' stand-in answers the window's read with ?machines=1, as a server does. - A forward test: Run once now with that computer online goes there at the press, keyed, with the window's mark.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A routine's row in the Inbox list kept its animated Running mark for hours after the run ended. Opening the thread fixed it at once.
Cause
state === 'running'from the routines store (packages/inbox/scheduled/rowLook.tsx:35). The server derives that state from the run's launch line (packages/server/inbox-scheduled.ts:114,123,launch.runOfMessage→runOfRoot), which is the same line the open thread shows.launch.signature()(packages/server/inbox-launch.ts:2672), so the window getsevent: deliveries(packages/server/inbox.ts:5076).event === null ? pages > 0(packages/inbox/scheduled/store.ts:68on main). The agent's reply does not carryscheduled_run, so it never triggered a re-read either. The row stayed on the value read when the run's divider arrived.POST /threads/:id/seen→store.markSeen(packages/shared/inbox/store.ts:3965) rewrites the thread's root. That root is the first run's divider and carriesscheduled_run, so itsmessagerecord made the store read again.This affected every run that ended (replied, stopped, or failed) while the window was on the list. Separately, a
deliveriesframe that went out while the stream was down (laptop asleep, Inbox restart) is never replayed, and nothing re-read the routines on reconnect or when the window was shown again.Fix
packages/inbox/scheduled/store.ts:deliveriesframe arrives, the store reads again while the Routines page is open or a routine is running. While nothing runs, nothing extra is read: a run's start already arrives as its divider record.scheduledFrame('connect')from thehelloframe inpackages/inbox/eventFrames.ts, which reaches every tab, shared-stream followers included.visibilitychange, attached only while something uses the store).Nothing new on screen. Reads happen at most once per
deliveriesframe (at most one per second, and only when a launch line moves), and only while a run is under way. That is the same pace as the list's own re-read.Tests
packages/inbox/scheduled/rowRunEnds.test.tsx(DOM): the realInboxListand the realdispatchInboxFrame. Adeliveriesframe takes Running off. A stopped or failed run turns to the warn mark.helloreads again. Visibility reads again. Nothing running means no read. Against main, 4 of these 5 fail; the "no read" guard passes there too.tests/e2e/inbox-routine-row-run-ends.spec.ts: the compiled binary with fake Claude Code (hold). It makes a routine and runs it, and checks Running on a wide window and a phone-sized one. It then lets the turn answer, and checks that both windows drop Running with no thread or Routines page opened.Docs:
docs/agent-guides/inbox-routines.md.e2e: inbox-routine-row-run-ends.spec.ts inbox-routine-editor.spec.ts