[Bug]: Dev database seed keeps active pull request watches, so the dev server can wake the developer's agents#32736
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- In the live install, ask an agent to watch a pull request (
watch_pull_request), and let the thread go idle without settling it. - In a new worktree, run
vp run dev(the first start seeds the dev database), or runvp run migrate-dev-db. - The seed keeps the thread because its latest run is stopped. Its payload still has
pullRequests[].watch. - The dev server's
PullRequestWatchReactorsweeps every watch on an unsettled thread every 2 minutes and reads the PR from the host with this machine's credentials. - When checks, comments, or merge state change, the reactor dispatches
thread.pull-request-watch.syncwith a wake. The wake queues a message and starts the thread's provider in the thread's real worktree on disk, while the live install's agent is doing the same work.
Fixture repro: in apps/server/scripts/migrate-dev-db.test.ts, give the stopped-thread fixture the payload {"pullRequests":[{"number":7,"url":"https://github.com/o/r/pull/7","watch":{"startedAt":"2026-08-01T00:00:00.000Z"}}]}. After runMigrateDevDb, json_extract(payload_json, '$.pullRequests[0].watch') on that thread still returns the watch.
Expected behavior
AGENTS.md says the seed "drops scheduled tasks, pending work, auth sessions, and links to other environments, so your dev server never runs the developer's agents." The copy should keep the pull request links, which are history the UI shows, but drop the active watches.
Actual behavior
Active watches survive the copy. Nothing else stops the wake: the reactor ends a watch without a host read only when the PR snapshot says merged, the thread is settled, or the thread is a subagent. The orchestrator rejects a wake only for archived, settled, or provider-native subagent threads. No environment or provider check applies.
Impact
Major degradation or frequent failure
Version or commit
main @ a9e709f15f
Environment
Linux, Node 24.22.0, dev server from a git worktree
Workaround
Run dev with --no-seed, or settle or unwatch threads before seeding.
Related
Remaining part of #15513, which Theo closed as fixed by #22744 and asked for a new issue for what remains. Julius's triage there named this gap: "an active PR watch on a stopped, unsettled thread survives it and can still wake" (https://github.com/pingdotgg/t3code/issues/15513#issuecomment-5977388116). #22744 did not touch watches.