Repository navigation
Description
Original-derived Linear description
the maintainer proposal (2026-09-16). Make runtime and model selection a first-class hot-swap capability across all agent harnesses (Claude Code, Gemini/agy, Codex Plus, Codex Azure, and upcoming Mastra, OpenCode, Cline), decoupled from quota failover.
Architecture
Harness-neutral ThreadRuntimeController as sole transaction owner. Persists desired and actual runtime envelopes separately: { harness, provider, model, credentialReference, launchConfig }. Adapters remain strictly idempotent lifecycle primitives (inspect-turn-state, create-checkpoint, prepare, activate, deactivate, terminate).
Phase A Acceptance Criteria (Primary / Control Plane & Manual Hot-Swap)
- Durable Fencing Protocol: Controller owns a per-agent durable lock and monotonically increasing lease/fencing token. Strictly one active runtime/process tree per agent at all times. Stale tokens rejected on all command/event writers.
- Transaction Journal and Crash Recovery: Controller owns a durable state machine journal recording operation ID, source/target envelopes, checkpoint cursor, step outcomes, fencing token, and terminal state. Compare-and-set transitions; restart reconciliation; failed state is explicit and recoverable (never guessed active).
- Controller-Owned Orchestration and Rollback: Controller is the sole owner of sequencing, deadlines, and rollback compensation plans. Adapters expose only idempotent primitives with typed capabilities and errors.
- Quiescence Barrier and Continuity: Quiescent barrier defined as no accepted turn, tools complete or explicitly cancelled, output drained, and a durable checkpoint cursor committed. Replacement acknowledges identical cursor before activation.
- Secret Isolation and Launch Hygiene: Strict allow-listed launch schema; credentials resolved only inside launch boundary; never in argv, logs, checkpoints, or envelopes; per-agent homes, sockets, and restrictive permissions.
- Single Public requestSwitch API: Expose a single authorized
requestSwitchcommand API used by UI, orchestrator, and automation alike (zero adapter bypass).
UI Scope: Manual selector in Mission Control UI with capability registry and explicit pending/switching/failed states.
Initial adapters: Claude Code, Gemini (agy), Codex (Plus and Azure). Contract tests for future adapters (Mastra, OpenCode, Cline).
Non-goals for Phase A: automatic rollover, quota policies, cross-model transcript rewriting, silent fallback.
Phase B (Secondary / Automated Rollover)
Automated policy controller invokes the single authorized requestSwitch API (zero bypass) with hysteresis, cooldown, retry budget, and manual override precedence.
Hard invariants: exactly one active runtime/thread per agent, identity continuity, secrets referenced from credentials store, idempotency, fail-closed recovery.
Origin
Migrated from Linear: INK-916. Original detail is retained apart from the disclosed privacy and rendering edits.
Current scope and qualifications
The account above is historical, not a fresh claim that every described defect still exists. Current Linear state: Backlog. Prior source review: partial; remaining checks or work:
- Design/prove complete neutral controller and capability adapters; keep existing Codex switch a component only.
Publication transfers tracking only. Original implementation/approval/freeze and acceptance gates remain; no live deployment, configuration, external messaging or provider spending is authorised.
Transfer edits
- Historical people/fleet prose is aliased; permitted source links and code/path references remain.
- Linear rich embeds and public punctuation are normalised where present.
Activity