# Continuity Lane B — Scheduler / MCP Application Progress

Branch: `impl/continuity-b-scheduler`
Baseline: `9b1c43b3ce64f9e7486325bf8ee027d9df2a2e54` (`origin/main` at lane start)
Worktree: `/home/user/Projects/chatgpt-orchestrator-worktrees/continuity-b-scheduler`
Lane A implementation consumed: `7de6454808538d6041a895a3c09150f5aea9e35a` (cherry-picked as `1196aa3`)

## Status

- [x] Created a fresh isolated worktree from the authoritative baseline; shared checkout changes were never modified.
- [x] Read the authoritative execution-continuity spec, implementation plan, and output-only durable continuation skill.
- [x] Integrated Lane A durable execution/continuity contracts rather than creating a second scheduler state model.
- [x] Implemented worker bootstrap v2, child initial dispatch through durable `ExecutionAttempt` identity, and root continuity without launching a duplicate root conversation.
- [x] Implemented a separate versioned resume-prompt generator; delivery-timeout recovery uses the required fresh exact `continue` user turn.
- [x] Implemented recoverable application scheduler with idle evaluation, periodic reconciliation, restart recovery, durable command construction, and exactly-once execution-command identity.
- [x] Implemented MCP operations for run/worker continuation policy, attempt history, human/dependency waits, Pause, Resume, and Continue Now.
- [x] Implemented authenticated executor-WS operator actions/results plus authoritative `worker.continuity` pushes for extension UI consumption.
- [x] Implemented strict bounded continuation-state parsing in the canonical protocol layer; duplicate/malformed/trailing/oversized output fails safe.
- [x] Implemented bounded assistant-output-tail transport (`16 KiB`, truncation marker) without transcript persistence and backend blocked-state reconciliation.
- [x] Implemented delivery-timeout classification/recovery, host-UI/ambiguous/product error pause behavior, and executor-command expiration reconciliation.
- [x] Covered pre-dispatch and post-enqueue cancellation/pause races, atomic command-send recheck, dedupe, restart recovery, executor-unavailable behavior, and stall warning/pause/recovery.
- [x] Final Lane B/non-extension workspace typecheck, tests, and build pass.
- [x] Full workspace `pnpm gate` attempted; blocked only in Lane C-owned extension by the new shared server-frame union (see below).
- [x] Lane B implementation committed as `5638a18` (`feat: add continuation scheduler and controls`).
- [x] Branch published to `origin/impl/continuity-b-scheduler`; terminal orchestrator handoff follows this durable record.

## Cross-lane convergence notes

Lane A completed its branch before several Lane B integration blockers were corrected. `/root` was notified before any out-of-normal-scope edits. Lane B therefore cherry-picked the authoritative Lane A implementation and applied only the minimum convergence deltas required to make the scheduler safe and consumable:

1. Pause invalidates an unsubmitted scheduled attempt and pending executor command; an in-flight send becomes pause-after-current-turn;
2. atomic `markExecutorCommandSent` rejects a stale linked attempt after pause/terminal/block races;
3. scheduled child/resume attempts are enumerable for process-restart command reconstruction;
4. expired pre-submission commands are terminalized without side effects instead of leaving phantom active attempts;
5. canonical continuation parser has final-block/size validation;
6. executor protocol carries bounded assistant output tails and authenticated operator action/result + continuity-view frames;
7. execution-boundary browser/product errors can durably pause continuation.

Root lifecycle correction: after re-reading Phase 12/C12.1 and baseline semantics, Lane B corrected an earlier mistaken assumption. `/root` represents the already-running coordinating conversation, so `run.create` records its initial attempt as generating and does **not** emit a second `conversation.create`. Root auto-resume applies only after that existing conversation is explicitly managed/bound and later becomes idle.

Lane C confirmed the assistant-output-tail and operator-action/result shapes used here. Lane C must consume the protocol fields from this convergence branch (or equivalent merged shared contract) rather than inventing extension-local authoritative policy.

## Verification

- `pnpm --filter @platform-modules/chatgpt-orchestrator-protocol test` — **9/9 passed**.
- `pnpm --filter @platform-modules/chatgpt-orchestrator-core test` — **27/27 passed**.
- `pnpm --filter @platform-modules/chatgpt-orchestrator-mcp test` — **29/29 passed**.
- `pnpm -r --filter '!@platform-modules/chatgpt-orchestrator-extension' --if-present typecheck` — **passed** across protocol, persistence, core, adapter, and MCP.
- `pnpm -r --filter '!@platform-modules/chatgpt-orchestrator-extension' --if-present test` — **passed** across all non-extension workspaces.
- `pnpm -r --filter '!@platform-modules/chatgpt-orchestrator-extension' --if-present build` — **passed** across all non-extension workspaces.
- Full `pnpm gate` — **cross-lane blocked only in `apps/extension/src/background.ts`** because Lane C baseline code accesses `frame.command` without narrowing after the shared `ExecutorServerFrame` union gained `operator.result` and `worker.continuity`. Exact reported compile sites: approximately lines 187, 192, 193, and 195. Lane C and `/root` were notified; Lane B did not edit forbidden `apps/extension/**`.
- `git diff --check` — **passed** on final worktree changes.
- No standalone `format:check` script exists in this repository; attempting `pnpm format:check` correctly reports the script is absent.

Notable covered invariants include existing-root vs child-launch semantics, duplicate reconciliation, idle auto-resume, terminal/human/dependency/paused suppression, Continue Now during idle/generation, startup reconstruction, pause-before-dispatch, pause-after-enqueue, terminal-before-send, expired command behavior, stall protection, authenticated operator controls, blocked-output reconciliation, delivery-timeout fresh `continue`, and MCP server runtime construction.
