Skip to content

BUG: Carry the composer's live model selection onto the bug session #277

Description

@gennadiryan

Important

Problem

A bug session runs the workspace's configured default model, not the model the user was actually running when the bug appeared. Model-specific defects are therefore filed against the wrong model, may not reproduce for whoever triages them, and the mis-attribution is silent — nothing errors, the recorded model is simply wrong.

Approach

Carry the composer's live model selection (provider, model, and variant) across the app→extension command bridge and onto the report-a-bug arming turn, with precedence over the configured default. Key reason: every piece already exists except the plumbing — the bridge already has a validated extractor for this exact payload, and the session command API already accepts an optional model and variant.

Approaches Considered

  • Carry the selection over the existing command bridge (chosen) — the extractor and its validation already exist and are unit-covered; the only new surface is passing the value through two call sites.
  • Session-level configuration pin only — already shipped, but it cannot express a variant and ignores the user's live choice entirely.
  • Resolve the model server-side from the originating session — needs a reverse lookup the bug-report orchestration deliberately avoids; the extension owns the session end-to-end by design.
  • Record the model in the context envelope without running it — fixes attribution in the report but the bug session still runs the wrong model, so behavioural repros stay wrong.

Scope

  • In: validating the model payload at the bridge; accepting it on the report-a-bug command; passing provider/model and variant to the arming turn; precedence over the configured default; tests for each branch.
  • Out: the configured-default behaviour itself — unpinned installs still let the server resolve, and that is correct. Other bridge commands — only report-a-bug carries a payload today, and the allowlist must not widen. Model-selection UI — unchanged; this only reads what the composer already knows.

Assumptions / Open Qs

  • Assumes the composer can supply its live selection at click time. If it cannot, this degrades to the configured default — i.e. current behaviour — so the change is safe but inert.
  • Open: should a selected-but-unavailable model fail loudly, or fall back silently? Current validation strips malformed payloads and falls back; that is the assumed answer unless reviewers disagree.

Acceptance Criteria

  1. Invoking report-a-bug with a model selected in the composer arms the bug session with that provider and model.
  2. A selected variant travels with the selection and is applied to the same arming turn.
  3. With no live selection, the configured default is used; with neither, the model field is omitted entirely and the server resolves its own.
  4. A malformed, oversized, or absent model payload never blocks the command — it falls back to the next precedence level.
  5. The payload is shape-validated and length-bounded at the bridge, before it reaches the orchestrator.
  6. Tests cover: live selection honoured; variant honoured; precedence over the configured default; malformed payload stripped; absent payload tolerated.
  7. No additional command gains a payload channel, and the bridge command allowlist is unchanged in size.

Key Decisions

  • Precedence is live selection → configured default → server default. Each level is a strict fallback; none of them guesses.
  • Omit rather than send empty. An empty model string pins the session to a nonexistent model, which is worse than sending nothing.
  • Validation stays at the bridge, which is the trust boundary — the framed app renders model output, so its messages are untrusted input. The orchestrator receives an already-validated value.
  • The model rides the arming turn, not session creation. Session creation carries identity and the context envelope; the model is a property of the turn.

Constraints & Invariants

  • The bridge handler is deliberately paranoid: strict command allowlist, bounded payloads. Any new field must keep that posture.
  • Sanitization invariants for bug sessions are unchanged — run context stays pointer-only, no absolute paths, no log payloads.
  • The single-open bug-session invariant and the machine-managed lifecycle are untouched by this change.
Prior Art / Patterns
  • The bridge module already exports a validated extractor for exactly this payload shape (provider, model, optional variant), with bounded-string checks and undefined-on-malformed semantics. It has unit coverage and no production caller — wiring it is the bulk of this task.
  • The session command API accepts optional model and variant alongside the required command and arguments.
  • The bug-report orchestrator already resolves a session-level model pin from configuration and omits the field when unset; the live selection slots in ahead of it.
  • The bridge's existing bounded-string validation for the default-model mirror is the pattern to follow for the new field.

Source

Notes

Until this lands, bug sessions run the configured or server default and any model attribution in a filed report is unreliable. That is worth knowing during triage of every bug filed through the feature, not just model-specific ones.

There is a mild recursion here: a bug report about the model handoff, filed through the report-a-bug feature, is itself authored under the wrong model. Filing this one conventionally avoids the confusion.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions