8000 ThreadRuntimeController: runtime and model hot-swapping across harnesses · Issue #190 · simon-inkie/inkie-deck · GitHub
[go: up one dir, main page]

Skip to content

ThreadRuntimeController: runtime and model hot-swapping across harnesses #190

Open

Description

@simon-inkie

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)

  1. 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.
  2. 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).
  3. 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.
  4. 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.
  5. 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.
  6. Single Public requestSwitch API: Expose a single authorized requestSwitch command 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentsAgent lifecycle / bootenhancementNew feature or requestmajor-featureA substantial feature or new capability

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0