Advisor mode falls back when explicitly configured to the primary model

Open Beginner friendly
#1 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
ai, tooling

Research direction

Start in extensions/advisor.ts and trace ensureRuntime() through resolveModelAndThinking(), focusing on how explicit advisor configuration is distinguished from an absent mode. Reproduce the case with an advisor provider and model matching the primary session, then verify that /advisor uses the configured model while an absent configuration still falls back to the built-in default.

Written by the indexing model from the issue text.

Description

Summary

/advisor cannot be configured to use the same model as the primary Pi session. If modes.json explicitly sets advisor to the current primary model, the extension treats that as if no advisor model was configured and falls back to the built-in default.

Reproduction

  1. Start Pi with primary model openai-codex/gpt-5.5.
  2. Configure ~/.pi/agent/modes.json or project .pi/modes.json:
{
  "modes": {
    "advisor": {
      "provider": "openai-codex",
      "modelId": "gpt-5.5",
      "thinkingLevel": "xhigh"
    }
  }
}
  1. Run /advisor on or /advisor status.

Actual behavior

The advisor does not use openai-codex/gpt-5.5. It falls back to the built-in default advisor model.

Expected behavior

If modes.json explicitly configures an advisor model, /advisor should use that model even when it is the same model as the primary session.

Suspected cause

In extensions/advisor.ts, ensureRuntime() calls resolveModelAndThinking(), then uses object identity against the current primary model as a sentinel for “mode absent”:

const sameAsPrimary = resolved.model === ctx.model;
model = sameAsPrimary ? undefined : resolved.model;

But resolveModelAndThinking() also returns ctx.model when the configured advisor mode intentionally resolves to the same provider/model as the primary session. That makes an explicit config indistinguishable from a missing config.

Minimal fix idea

Check whether the advisor mode exists separately from whether the resolved model equals ctx.model, or make resolveModelAndThinking() return whether a mode spec was found/applied.

Dominant language
JavaScript
Stars
111
Forks
10
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.