Repository navigation
Description
Problem
Today's MCP retry/restart surface operates at phase granularity:
restart_phase(task_id, phase)— restarts an entire phase (refine / plan / implement / pr).restart_agent(task_id, agent_role)— restarts a single agent within whatever phase is active.
When #2137 lands, the implement phase will fan out into a DAG of independent slices, each running its own BRC consensus on its own branch. The phase-granularity tools no longer fit the runtime shape:
restart_phase('implement')would tear down all slices and respawn from scratch — wasteful when only one slice failed.restart_agent(role)is ambiguous when the same role exists in multiple concurrently-running slices ("which slice's coder do you mean?").
Operators will routinely need to restart a single failing slice without disturbing siblings, and to inspect or restart a specific agent within a specific slice.
Proposed verbs
restart_slice(task_id, slice_id)— tear down the slice's containers, reset its BRC tracker, respawn its agent team. Siblings continue unaffected.restart_agent(task_id, agent_role, slice_id=None)— extend the existing verb with an optionalslice_id. When omitted on a sliced phase, return a structured error listing the candidate slices instead of guessing.get_slice_status(task_id, slice_id)— per-slice status snapshot (consensus state, agents, recent messages, blocking_agents). Equivalent toget_statusbut scoped.list_slices(task_id)— list all slices in the active implement phase with their states and DAG positions. Useful for operators to find the rightslice_id.
Why this is a follow-up to #2137
#2137's implementation is already constrained to a single PR (per the refine-phase user input). Bundling per-slice MCP controls into that PR pushes it past the manageable size. The slice scheduler in #2137 should expose the internal hooks (the orchestrator must already know how to teardown / respawn / query a slice in isolation — it's how the run loop works), but the MCP verb surface can be a clean separate PR landing immediately after.
The hooks #2137 needs to expose internally:
- A way to address a single slice by ID at the orchestrator level (the slice scheduler already needs this).
- A teardown-and-respawn primitive for a slice (the slice scheduler already needs this for retries).
- A status snapshot for a single slice (the orchestrator already needs this for HITL escalations).
Once those exist, this issue is a thin MCP-routes layer on top.
Files involved (forward-looking)
orchestrator/routes/mcp.py— add the four verbs as MCP tool registrations.orchestrator/routes/pipelines.py— expose REST endpoints for the MCP verbs to call.orchestrator/slice_scheduler.py(added by Independent implement phases #2137) — internal hooks for teardown/respawn/snapshot per slice.docs/reference/mcp-tools.md— document the four new verbs.
Acceptance criteria
restart_sliceworks on a sliced implement phase: kills the target slice's containers, resets its BRC tracker, respawns its team. Unrelated siblings are unaffected (verified by integration test).restart_agentwithslice_idrestarts a single agent within a single slice. Withoutslice_idon a sliced phase, returns a structured error listing candidates.get_slice_statusreturns the same shape asget_statusbut scoped to one slice.list_slicesreturns slice IDs, states (pending,running,complete,failed,blocked), DAG parents/children, and blocking-agent info.- Existing
restart_phase,restart_agent(withoutslice_id), andget_statuscontinue to work for non-sliced phases (refine, plan, pr) and during the migration window.
Out of scope
- The slice scheduler itself — lands in Independent implement phases #2137.
cancel_slice(operator-driven slice cancellation) — separate concern; can be a third issue if needed.- Per-slice retry policy — belongs to the orchestrator's retry logic, not the MCP surface.
Related
- Independent implement phases #2137 — must merge first; this issue depends on the slice scheduler internals.
Activity
plan(2137): address reviewer_plan NACK v1
implement(2137): slice DAG building blocks (Phases 1–5 production code)
docs(2137): document slice-DAG implement phase, schema rename, env knobs
implement(2137): v2 — address reviewer_contract NACK on commit 3164df1
implement(2137): v5 — address reviewer_code + reviewer_contract NACKs…
docs(2137): v3 — close reviewer_code v2 NACK on doc↔code drift
plan(2137): address reviewer_plan NACK v1
implement(2137): slice DAG building blocks (Phases 1–5 production code)
docs(2137): document slice-DAG implement phase, schema rename, env knobs
implement(2137): v2 — address reviewer_contract NACK on commit 3164df1
implement(2137): v5 — address reviewer_code + reviewer_contract NACKs…
docs(2137): v3 — close reviewer_code v2 NACK on doc↔code drift
Slice the implement phase into a DAG of independent units (#2220)
docs: resolve slice-DAG/shared-branch contradictions raised in PR #2231
docs: update docs for slice-DAG implement phase [doc-updater] (#2231)
Fix misleading comment: slice-tracker reconstruction is #2409, not #2199
Fix #2399: push pipeline tip to <branch>/work so slice refs coexist (#…
jwbron commentedon May 27, 2026
Speculative hooks for this issue are being preserved in #2777's cleanup
Cross-referencing from #2777 (sliced implementation phase cleanup, in active
SDLC pipeline as of 2026-05-27). One of #2777's open questions (cq-3) was
whether to delete or preserve the speculative #2199 hooks in
orchestrator/slice_scheduler.py. The operator decided to preserve themwith dead-code markers + a doc-pointer to this issue rather than delete,
on the read that #2199 is on the near-term roadmap and re-adding from
scratch would lose the design intent.
Hooks preserved for #2199
These are already public on
SliceScheduler(orchestrator/slice_scheduler.py)and unit-tested in
orchestrator/tests/test_slice_scheduler.py, but notcalled by the production run loop. They were wired anticipating this
issue. After #2777's cleanup lands, each will carry a
# noqa: ARG002/dead-code marker and a comment pointing here:
teardown_slice(slice_id)(slice_scheduler.py:417) — direct fit forAdd per-slice MCP controls (restart_slice, etc.) for #2137 slice scheduling #2199's
restart_sliceMCP verb's teardown step.respawn_slice(slice_id)(slice_scheduler.py:434) — direct fit forthe respawn step.
cancel_cascade(slice_id)(slice_scheduler.py:375) — internalcascade cancellation primitive. (Note: Add per-slice MCP controls (restart_slice, etc.) for #2137 slice scheduling #2199 explicitly says
cancel_sliceis out of scope as a separate MCP verb, but the internalprimitive may still be useful for
restart_slice's teardown semantics.)record_cycle(slice_id)(slice_scheduler.py:299) — per-slice cycletracking with the documented two-tier cap
(
DEFAULT_SLICE_LOCAL_MAX_CYCLES=3,DEFAULT_SLICE_GLOBAL_MAX_CYCLES=10; env_config.py:271-272).Currently inert because nothing calls it. Add per-slice MCP controls (restart_slice, etc.) for #2137 slice scheduling #2199's per-slice retry policy
(or whatever calls back into the run loop after
restart_slice) canwire this to enforce the cap.
hitl_escalator: Callable | Noneconstructor param(slice_scheduler.py:153, instantiated at pipelines.py:15090 with no
hitl_escalator passed) — routing slot for per-slice HITL escalations.
When
record_cyclereturns "cap tripped" it would invoke this callback.Add per-slice MCP controls (restart_slice, etc.) for #2137 slice scheduling #2199 can pass an escalator that routes per-slice HITL to the operator
via the MCP surface.
poll_cascades(slice_scheduler.py:380) is the only one in this groupthat's already live (called at pipelines.py:15322 and 15860) and is not
in this list — it stays unchanged.
What #2199 will need to do
To activate these, #2199 will need to:
record_cycleinto the run loop — call it from the slice loopon each retry cycle. The cap config in
env_config.pyis already inplace; the run loop just needs to call
record_cycle(slice_id)at theright point and respect the bool return for "cap tripped" → escalate
via
hitl_escalator.hitl_escalatorto theSliceSchedulerconstructor — atpipelines.py:15090changeSliceScheduler(contract)toSliceScheduler(contract, hitl_escalator=...)with a callback thatsurfaces the escalation through the orchestrator's HITL machinery.
teardown_slice/respawn_slicethrough the newrestart_sliceMCP verb (per this issue's acceptance criteria).loop calls these, drop the
# noqa: ARG002and the doc-pointercomments.
Coordination
If #2199 starts before #2777 lands, coordinate on the dead-code-marker
shape so the eventual marker removal is a small diff. Otherwise, no
ordering constraint — both can proceed in parallel.
For context on the #2777 cleanup itself, see #2793 (refiner+reviewer_refine
prompt scope) and #2794 (operator override channel) — both surfaced
during the #2777 pipeline runs.
[architect] plan #2777: two-slice cleanup architecture (A+D+PR-deleti…
[task_planner] plan for #2777 — context-PR collapse + restart hardening
[architect] plan #2777-replan v4: sub-slice A+D into 1a/1b/1c per ope…
plan(2777-replan): v5 — re-shape to 4 slices matching architect's rev…
slice-3 (#2777): #2199 markers, archaeology pruning, ImportError coll…
slice-3 v2 (#2777): fix ruff I001 (reviewer_code v1 blocker) + drop d…
tester(slice-3 #2777): umbrella deletion + _lookup_open_pr + #2570 xf…