Skip to content

fix(orchestration): port T3 Stop cascade and PR watch fixes - #11

Merged
ajmariduena merged 8 commits into
mainfrom
feat/t3-delta-orchestration
Oct 7, 2026
Merged

ajmariduena merged 8 commits into
mainfrom
feat/t3-delta-orchestration

Conversation

@ajmariduena

Copy link
Copy Markdown
Owner

Ports the orchestration fixes T3 Code shipped after 2026-10-04 (pingdotgg/t3code#16002, #16335, #15442, #15804, #15415, #16208, #16262) onto Paseo's own stores.

Stop and cancel

  • User Stop drops every open delegation cohort and pending wake (even while the agent is idle waiting on children), ends its PR watches, and walks live descendants depth-first doing the same. One failing descendant doesn't stop the walk.
  • While held for user_stop, wakes, PR-watch news and permission notices queue instead of starting a turn. That hold is in memory only, so after a daemon restart a wake can start the agent again (same as today's restart behavior).
  • create_agent / watch_pull_request from a run Stop already reached fail with AgentRunStoppedError.
  • cancel_agent stops the child's whole subtree.
  • Stop settles a stalled run locally when the provider doesn't acknowledge the interrupt; late provider events for that turn are ignored.

Pull request watch

  • One read per PR per pass, shared by every watching agent; every 2 min when nothing is in flight, every minute while checks run.
  • Rate limits skip the pass and never count; give up after 8 failed reads in a row instead of 15 minutes.
  • Wakes when a required check appears already passed (head SHA + passed set, reset on push) and when a comment or review is edited (bot re-reviews).
  • One pull_request_watch.ended info log per watch.
  • Unlike T3, subagents can still watch the PR they opened.

No protocol changes. Docs: agent-lifecycle.md, data-model.md.

Tests: stop, agent-manager, delegation, agent-queue runner, message-dispatch, mcp-server, pull-request-watch, github-service, lifecycle-command. The 6 orchestration-instructions failures in agent-manager.test.ts and the 9 in session.test.ts also fail on main.

When the provider rejects or times out the interrupt, Stop no longer returns refused and leaves the run active forever. It emits turn_canceled, settles the run, resolves pending permissions and keeps partial output, then abandons the turn so a late provider event cannot revive or fail the stopped agent. Replace, reload and rewind still refuse.
…tches

Port of T3 #16002. Stopping an agent now drops every open delegation cohort and queued wake of the agent even while it is idle waiting on children, ends its pull request watches, and walks its live Paseo descendants depth first: each holds its queue, drops its cohorts and watches, and cancels its run, and one failure does not stop the walk. A user_stop hold now covers an empty queue, so system messages (wakes, PR-watch news, permission notices) queue instead of starting a turn until the user resumes or writes. create_agent and watch_pull_request from a run Stop reached fail with AgentRunStoppedError.
Port of T3 #16335 task_cancel. cancel_agent now reuses the Stop cascade: besides dropping the caller's results for the child, it holds the child's queue, ends its watches and cancels its run, then walks its live descendants the same way, including the running grandchildren of a child that already finished.
…eady passed

Track the head commit and the passed required check names on each watch. A push
resets the check state, so a push whose checks all finish within one pass still
wakes the agent, and a required check that shows up already passed wakes again.
Watches saved before these fields adopt the current head without a wake.

Ported from pingdotgg/t3code#15804, with the required-only re-wake from #16208.
Read lastEditedAt for timeline comments, reviews, and review-thread comments,
and count a remark's activity time as its last edit, so a bot that rewrites its
summary comment still wakes the agent. Edits count toward the comment-only wake
limit.

Ported from pingdotgg/t3code#15415.
- Read each watched pull request once per pass for every agent watching it,
  grouped by URL, instead of once per watch.
- Read a pull request with nothing in flight every two minutes; keep the
  one-minute cadence while a check runs, mergeability is unknown, or the
  remarks could not be read.
- A rate limit skips the rest of the pass and never counts toward giving up.
  Required-check and viewer reads no longer swallow a rate limit.
- Give up after 8 failed reads in a row instead of 15 minutes of failures.
- A subagent cannot watch, since its parent owns the pull request; a watch left
  on one ends on the next pass.

Ported from pingdotgg/t3code#16208.
Each ended watch writes one info line, pull_request_watch.ended, with the
reason (merged, closed, unreadable, comment-limit, unwatched, archived,
subagent, stopped), minutes alive, minutes since the last push, the longest
stretch without a push, wakes, and successful reads. Tracking is in memory, so
a watch older than the daemon is marked partial.

Ported from pingdotgg/t3code#16262.
Paseo children often open their own pull request, and Stop now cascades to
their watches, so the T3 rule that only parents may watch is not needed.
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