Skip to content

feat(runtime-host): carry exact Connection identity in Session model targets #3926

Description

@me2seeks

Parent tracker

Problem

After #3864, new Sessions persist an immutable Connection ID and bound execution cannot follow a reused slug. The Runtime Host wire still represents an explicit model target as connectionSlug + model, and Session catalog projections do not expose the stored Connection ID.

That leaves surfaces unable to submit or retain an exact account choice. The foundation must temporarily reject ambiguous account changes and legacy-null configuration updates.

Desired outcome

Close exact account selection and recovery across Runtime Host, CLI/TUI, and Desktop:

  • explicit Session model targets carry required connectionId + connectionSlug + model;
  • Session catalog projections expose llmConnectionId: string | null;
  • CLI/TUI and Desktop create/configuration funnels retain the exact triplet across CAS retries;
  • a legacy-null or deleted-account Session can recover only when the user explicitly selects a current Connection;
  • non-model updates never rebind a Session;
  • deleted original accounts are distinguishable from disabled accounts and legacy-unbound records.

Architecture boundary

Runtime Host owns validation and the atomic Session metadata commit. Surfaces carry explicit user intent and present diagnostics; they must not resolve a slug to an account locally.

The protocol change is incompatible with older peers and requires one compatibility epoch advance from the then-current main epoch.

Acceptance criteria

  • SessionModelTarget.explicit requires Connection ID, slug, and model.
  • SessionCatalogProjection has a required nullable Connection ID.
  • CLI run, activation, TUI/text creation, Desktop creation, and configuration paths preserve the exact account.
  • CAS retries replay the user's original exact selection, not a refreshed same-slug entity.
  • Bound A, delete A, create same-slug B: permission/model updates do not bind B.
  • Legacy null: non-model update fails closed; explicit B selection succeeds and atomically persists B's ID/slug/model.
  • Desktop explicit recovery is evaluated before any legacy-null guard.
  • Resume reports original account deleted when the stored ID no longer exists.
  • Protocol codecs, epoch guard, real Host/Client tests, CLI tests, and Desktop tests cover the closed shape.

Non-goals

  • Multi-account onboarding
  • OAuth login/entity creation
  • ScheduledTask identity
  • Automatic legacy adoption by slug
  • Weighted routing or automatic failover

Generated-by: Codex

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions