Repository navigation
Description
Piece: New charter
Area: agent-orchestration
Proposed tier: prefer ours
Summary: Agents directing agents. Keep LastCode's waiting, ownership and cross-machine delegation behaviour until intent tests show upstream covers it.
Proposal
The exact text for docs/lastcode/charters/agent-orchestration.md:
---
area: agent-orchestration
title: Agents directing agents
tier: prefer-ours
paths:
- apps/server/src/mcp/
- apps/server/src/peer/RemoteDelegation.ts
- apps/server/src/orchestration-v2/ProviderTurnStartService.ts
- apps/server/src/orchestration-v2/ThreadManagementService.ts
- apps/server/src/orchestration-v2/pullRequestWatch.ts
- apps/server/src/orchestration-v2/PullRequestWatchReactor.ts
- apps/server/src/pullRequest/
- apps/server/src/scheduledTasks/
- apps/server/src/provider/CodexThreadTool.ts
- apps/server/src/cli/thread.ts
---
# Agents directing agents
## Purpose
An agent can hand work to other agents, wait on long-running work, and pick up the result without anyone watching. The owner should be able to start a piece of work, walk away, and come back to it finished or clearly stuck, never silently dropped and never burning turns on polling.
## Intents
### Delegated tasks and child threads
- A delegated child's result reaches the task that owns it exactly once, even across restarts, ordinary turns and cancelled rounds.
- A child stays owned by its parent while it waits on long-running work or a PR watch; a wait is not a handoff, and the parent is not woken to poll it.
- Cancelling a task cancels its owned work, including work it is waiting on, and nothing beyond it.
- Delegation to a linked machine keeps moving: the child runs there, its approvals and results route back to the parent, and access granted to the parent is kept across automated turns.
### Thread tools for agents
- Agents can find, read and message threads on this machine and on linked machines by id, without the user tracking which machine owns a thread.
- Codex sessions get `lastcode-thread` (current, list, read, send, wait) on their `PATH`; `send` confirms only what was persisted, and `--wait` returns the exact resulting turn.
### Waiting without polling
- An agent can wait on long-running work, such as CI, a build or a checkpoint, without spending turns polling, and continues with the result when the work finishes.
### Scheduled tasks
- A scheduled task can choose its model.
### PR and issue follow-through
- An agent can watch a PR and is woken on checks, reviews, comments and conflicts, instead of polling.
- A child can own a PR watch when its environment supports it; the watch carries no merge authority.Evidence
Why this area now. It is one of the three areas costing the most checkpoint time over the last five published nights (Nov 15–19 PT). Counting each failed-CI night once per area, the totals are about 91 minutes here (43 conflict, 48 failed CI), 90 for running LastCode, and 89 for seeing the work. Seeing the work's largest item was already reconciled in #740. The most expensive cards here are test drift in OrchestratorMcpService.test.ts (41 min), RemoteDelegation.test.ts (42 min) and ProviderTurnStartService.test.ts (36 min).
What the carries are. Most of this area's carried commits are in the incubator group. The ones that recur across the costly files are:
- child tasks across Action waits, and parent-mediated Actions: feat(agents): make Action waits inspectable and guide parent handoffs #509, feat(agents): keep child tasks alive across Action waits #555, fix(agents): let paused child Action waits reach quiet and scope task cancellation #568. These go away with resumable Actions, which are being retired in favour of a background wait.
- child-owned PR watches: feat(agents): let delegated child tasks own pull request watches #611
- result ownership and delivery: fix(agents): deliver awaited background results to their owning tasks #590
- cross-machine delegation and reads: fix(mcp): resolve thread IDs across connected environments #347, fix(remote): link machines through reachable verified addresses #556, fix(agents): stop linked-environment tasks stalling on approvals #571, fix(threads): keep authorized access across automated turns #744
- scheduled task model choice: feat(mcp): select a model for scheduled tasks #773
The Codex thread tools have no upstream counterpart at all.
Why prefer ours, not defend or yield. Upstream already ships the base tools: delegate_task, thread launch and send, scheduled tasks, PR watches, and remote delegation. LastCode's additions sit on top of them and mostly change what happens while an agent waits, and who owns the result. Those intents are what the owner relies on to leave work unattended. Upstream does not cover them today, but it may. "Prefer ours" keeps them until intent tests show upstream does, and avoids reconciling by guesswork.
Possible split, for the owner to decide. Scheduled-task model choice is a small change and could be marked yield. The coarse charter keeps one tier until a split is asked for.
Overlap. ThreadManagementService.ts and thread ownership and placement (#553, #270) also serve Keeping many threads manageable. Under the strictest-tier rule, a carry touching both areas takes this area's tier until that area has a charter.
Revision (Nov 22 PT, owner's comment): resumable Actions are being retired. Removed their paths and their sub-feature, and kept the intent they served, waiting without polling, independent of the mechanism.
Activity
docs(lastcode): define the agent orchestration charter
docs(lastcode): align charter list formatting with the proposal