Skip to content

fix(prime-agent): explain why a thread cannot switch to Prime Agent Default - #49

Merged
rynfar merged 2 commits into
pylonfrom
fix/prime-agent-switch-to-default
Aug 18, 2026
Merged

fix(prime-agent): explain why a thread cannot switch to Prime Agent Default#49
rynfar merged 2 commits into
pylonfrom
fix/prime-agent-switch-to-default

Conversation

@rynfar

@rynfar rynfar commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Problem

Choosing Prime Agent Default for a thread that had already run on a named model failed the turn with Model must use a provider/model selector. — an internal-sounding message for an ordinary action in the model picker.

Pylon uses "default" as the sentinel for "let Prime choose". At session start it is handled (model === "default" simply omits the model), but on a later turn applyTurnSelection compares it against context.session.model, sees a difference, and passes it to setModel, where splitModelSelector rejects it for having no /.

Found while adopting 0.7.3 (#48); it is not caused by that release.

How it was fixed

The turn cannot succeed either way. "default" means deferring to Prime's own configured model, and the daemon connection exposes no way to hand model choice back to Prime inside a running session: AgentConnectionModelCatalog is { models, configuredProviders } with no default to re-select, and setModel requires an explicit provider and id. Silently continuing on the previous model would leave the thread running one model behind a Prime Agent Default label, which is exactly the kind of stale label we try not to ship.

So the switch is rejected where the other unsupported turn selections already are, with a message that names the constraint and the way forward. This changes an incomprehensible failure into a comprehensible one rather than turning a working path into a failing one.

Unaffected: naming a different model in an existing thread, and threads that stay on Prime Agent Default (which make no setModel call at all — covered by a second test so the guard cannot over-reject).

A client-side improvement would be to stop offering Prime Agent Default in the picker once a thread has run on a named model. That spans web and mobile and is a separate concern, so it is not in this PR.

Verification

  • Reproduced first: the new test failed with expected [ 'default' ] to not include 'default' against the unfixed adapter, confirming setModel("default") was really being called
  • vp test run apps/server/src/provider/prime/ — 245 passed, 1 skipped (up from 243; the two new tests are the delta)
  • vp run -F t3 typecheck — 0 errors
  • vp lint on both touched source files — clean

No UI changes, so no before/after images.

Model: Claude Opus 5 in Pylon (Claude Code harness)


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

…efault

Selecting "Prime Agent Default" for a thread that already ran on a named model
sent Pylon's "default" sentinel through as if it were a model id. It reached
setModel, where the provider/model selector split rejected it, so the turn
failed with "Model must use a provider/model selector." — an internal-sounding
message for an ordinary choice in the model picker.

The turn cannot succeed either way: "default" means deferring to Prime's own
configured model, and the daemon connection exposes no method to hand model
choice back to Prime inside a running session. getModelCatalog returns only
models and configuredProviders, with no default to re-select, and setModel
requires an explicit provider and id. Continuing on the previous model would
leave the thread running one model behind a "Prime Agent Default" label.

So reject the switch where the other unsupported turn selections are rejected,
with a message that names the constraint and the way forward. Naming a
different model in an existing thread is unaffected, and a thread that stays on
Prime Agent Default still makes no setModel call at all.

Model: Claude Opus 5 in Pylon (Claude Code harness)
@github-actions github-actions Bot added size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Aug 18, 2026
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 12.6 KiB 15.1 KiB
Codex Thread snapshot wire 6.3 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.3 KiB 7.8 KiB
Codex Live turn WebSocket decoded 51.8 KiB 66.4 KiB
Codex Live turn messages 16 21
Claude Total thread wire 12.6 KiB 15.1 KiB
Claude Thread snapshot wire 6.3 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.3 KiB 7.8 KiB
Claude Live turn WebSocket decoded 52.7 KiB 66.4 KiB
Claude Live turn messages 16 21

Baseline: unavailable · PR result: 50b4f25 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 99.8 KiB
  • Claude decoded thread snapshot: 100.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

…ession

The rejection added in the previous commit is a constraint of the installed
harness, not a decision we want to keep. Name the exact upstream capability
that would replace it — a session method that restores Prime's own default, or
an authoritative default id in the catalog — next to the code that fails, and
add the gap to the parity ledger's register of daemon-connection omissions so
it is reconsidered when Prime Agent gains either one.

Model: Claude Opus 5 in Pylon (Claude Code harness)
@github-actions github-actions Bot added size:M and removed size:S labels Aug 18, 2026
@rynfar
rynfar merged commit 3188fdc into pylon Aug 18, 2026
11 checks passed
@rynfar
rynfar deleted the fix/prime-agent-switch-to-default branch August 18, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant