Skip to content

[bug] The idle reap releases a process on the user's own machine and notifies nobody #698

Description

@serge-ivo

A run finishes, the owner walks away, six hours later the engine process on their machine is released. The only record is a row written into the session's own timeline, which is visible only to someone who has already come back and opened that repo.

The absence

grep -c 'notifyUser\|createNotification' workers/api/src/lib/coding-session-sweeper.ts0.

The sweeper writes the reap into coding_timeline as the run's outcome (via IDLE_REAP_PREFIX, :109) and updates the session row. It sends no notification, so nothing reaches /v1/notifications, the console bell, or push.

Why that is the wrong shape

The reap is the platform releasing a resource on the user's own machineIDLE_SESSION_MS is 6h (:63) and the header is explicit that the number is chosen so an abandoned session does not hold a child process on somebody's laptop overnight. That is a decision about their computer, taken while they are not looking, and it is exactly the kind of thing a notification exists for.

Compare the second branch of the reap message (:123): "the engine could not be stopped on your machine — it may still be running. Check it there if you need the process gone." That branch is asking the user to go do something on their own hardware, and there is no channel that carries the ask. It is written into a timeline the user has no reason to open.

Observed, 2026-08-17

Instance bd43f4de (Chess coder 2). Session csess_21b8d1b9 ran 2026-08-16 09:41→17:07 UTC; real work ended 11:11 UTC and the reap fired at 17:07 UTC, 03:07 Melbourne time. The owner found out the next morning by opening the repo and reading a dead pane, then asked what had happened. Nothing had told them.

Fix

Notify on reap, and make the notification carry the thing that is actually useful — not that a session ended, but until when the work is still resumable:

"Chess coder 2 went to sleep on apps/chess-academy. Your conversation is kept until 20 Aug."

The date is computable today: RESUME_WINDOW_MS (lib/coding-session-continuity.ts:47, 4 days) applied to the session's last_activity_at — the same column the reaper already measures idleness against (coding-store.ts:410 notes the two clocks and their relationship).

Deliberately NOT session vocabulary — see #695. The user does not need to know a process was released; they need to know their work is safe and for how long.

Route it through notifyUser rather than createNotification directly, so the owner's notification preferences apply. Worth checking against #656, which found the subscribe path bypassing notifyUser and producing an unmutable ping — do not add a second one.

One judgement call for whoever takes this: a user with many coding instances could get several of these a night. Either suppress when the repo had no activity that day beyond the run that already reported its own outcome, or batch per instance. A nightly "3 agents went to sleep" is fine; three separate 3am pings are not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend / Worker / API workbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions