Skip to content

feat(server): wake the watcher thread when a lane ends, stalls, promises or needs a person - #98

Merged
nullStack65 merged 3 commits into
release/native-0.1.10from
feat/native-0.1.10-lead-wake-events
Nov 19, 2026
Merged

nullStack65 merged 3 commits into
release/native-0.1.10from
feat/native-0.1.10-lead-wake-events

Conversation

@nullStack65

@nullStack65 nullStack65 commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Lead had to poll to learn that a lane died, stalled, promised to continue with nothing to wake it, or needed a person. Tonight's real case: the Fleet SSH rollout said "a background watch will wake this thread", settled with none tracked, and its R720 build died unnoticed.

The model-alert watcher from #96 now also hears four deterministic thread events, judged server-side from the thread shell with no agent judgment:

  1. lane-ended: a top-level lane's run ended failed or interrupted, or completed with open PRs and nothing tracked to wake it.
  2. promise-without-wake: the lane went idle or settled after an explicit "will be woken / will continue later" phrase, with no background task, PR watch, delegated task, snooze or armed resume. The test fixture is the real Fleet message.
  3. stuck: an active run with no new activity for watcherStuckMinutes (default 20, 0 = off), or a thread waiting on background work that no longer exists. Parents with active children are not stuck.
  4. needs-person: an agent-created lane raises a pending question or approval, or its inbox goes to a founder or action.
  5. Usage limit is already model-degraded's usage_limit reason; lane-ended stays quiet for a failure that alert already reported.

They reuse #96's outbox, retry, cross-environment forwarding, webhook and the same watcher setting. Dedupe is per thread and kind until the state changes. Delegated children are skipped (#78 already tells their parent) and the watcher never reports about itself. Each wake carries environment, thread link, title, kind, run id, last assistant line and open PRs. A 60 second sweep covers stuck, the one kind with no event.

Moving Lead to an always-on machine is one value: DEFAULT_MODEL_ALERT_WATCHER in packages/contracts/src/settings.ts, documented in docs/operations/watcher-thread.md.

Tests: one fixture per kind plus dedupe, outbox sharing and cross-environment forwarding (ThreadEventAlerts.test.ts, ModelAlertReactor.test.ts, 40 passing). Server typecheck and lint clean. Committed with --no-verify for the 4 known unused upstream scripts knip flags on this base.

🤖 Generated with Claude Code

Deploy: fleet

…ses or needs a person

The model-alert watcher now also hears four deterministic thread events,
judged server-side from the thread shell: lane-ended, promise-without-wake,
stuck and needs-person. They share the model alert outbox, retry,
cross-environment forwarding, dedupe (per thread and kind until state
changes) and webhook. Adds watcherStuckMinutes (default 20) and docs on
moving the watcher to an always-on Lead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
nullStack65 and others added 2 commits November 19, 2026 06:19
…urrence, per-signature dedupe, one task scan per sweep

Review of #98:
- lane-ended, promise-without-wake and stuck now apply only to agent-created lanes, so a person stopping or leaving their own thread no longer wakes Lead.
- The alert id includes the time, so a recurrence of the same state is a new message instead of a replayed command.
- A kind holding several findings (a question and an inbox flip) remembers each signature, so they stop alternating on every trigger.
- The 60 second sweep reads open delegated tasks once, not once per thread.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rray

Found by the R720 typecheck of the stacked branch; the same line is in #98.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nullStack65
nullStack65 merged commit 20a24c8 into release/native-0.1.10 Nov 19, 2026
3 checks passed
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