Skip to content

fix(pi): support model-advertised max and minimal thinking - #842

Merged
xintaofei merged 7 commits into
xintaofei:mainfrom
dawNotPoi:fix/pi-model-thinking-max-467
Sep 28, 2026
Merged

xintaofei merged 7 commits into
xintaofei:mainfrom
dawNotPoi:fix/pi-model-thinking-max-467

Conversation

@dawNotPoi

Copy link
Copy Markdown
Contributor

Summary

  • Upgrade the pinned Pi ACP adapter to 0.0.34 and carry max and minimal through CodeG's Pi thinking selector and native config persistence.
  • Read built-in model capabilities from the same Pi runtime used by ACP via a bounded, no-session RPC query. The settings UI offers max only when the selected model advertises it, rejects a stale level after switching models, and refreshes after credential or runtime changes. Only model identity and thinking capabilities cross the settings API.
  • Keep Pi's per-agent config directory consistent across desktop and web. Reject relative runtime paths that could resolve to different locations, and give users of Pi older than 0.81.0 an actionable upgrade error before ACP startup. A database read failure now stops Pi profile writes instead of selecting a different directory.

Result

On the original code path, max was absent from the Pi settings vocabulary, filtered by the Rust writer, and rejected by the pinned adapter. In an isolated Pi 0.87.1 + pi-acp 0.0.34 protocol check, a model advertising max now accepts and reports it. A model advertising minimal but not max accepts and reports minimal; a model without reasoning exposes only off. A saved minimal default is reported again by a new ACP session. These checks used a dummy key and sent no model prompt.

Verification

  • Pi settings frontend tests: 55 passed
  • Pi-related Rust tests: 96 passed
  • TypeScript, full ESLint, Prettier, Next production build, and desktop Rust cargo check --features tauri-runtime --lib passed
  • Real Pi RPC and ACP checks as described above
  • Independent review of commit 87cb3ab: no blocking findings
  • Windows .cmd and spaces-in-path regression tests added; native Windows regression passed locally (1/1) after adding a Common Controls v6 manifest to the temporary test binary; GitHub Windows desktop CI compiles these tests without running them

Closes #467

@dawNotPoi

Copy link
Copy Markdown
Contributor Author

@xintaofei Ready for review. This fixes #467: Pi now offers max/minimal only when the selected model advertises them, persists the chosen level, and avoids launching an incompatible Pi runtime. I verified real Pi RPC/ACP capability and saved-default behavior without sending a model prompt; 55 frontend and 96 Rust tests passed, along with type, lint, format, Next build, desktop Rust check, and a native Windows .cmd regression. The seven PR CI jobs are running now. Thanks!

@dawNotPoi

Copy link
Copy Markdown
Contributor Author

CI follow-up: Ubuntu Rust server Clippy flagged the new Pi RPC success guard spelling under Rust 1.98. Commit 619bc1f uses the equivalent Boolean negation. I reproduced the warning locally, reran the exact server Clippy command with warnings denied successfully, and reran the response-projection regression test with one passing result. The new PR checks are starting now.

@dawNotPoi
dawNotPoi force-pushed the fix/pi-model-thinking-max-467 branch from 619bc1f to fbd615d Compare September 28, 2026 07:01
…each launch

- Recognise a pi too old for pi-acp 0.0.34 from its answer to
  get_available_thinking_levels on session/new and session/load, and report
  it as agent_runtime_outdated with upgrade instructions and an Open Agent
  Settings action, instead of running `pi --version` before every connect.
- Resolve the launch preflight on the launch env's PATH, and a relative
  command inside the workspace, the way pi-acp spawns it.
- Offer all seven thinking levels for built-in providers and never refuse a
  save over pi's catalog: defaultThinkingLevel is one global preference, so
  the panel names the level pi will actually run the selected model at.
- Query the catalog with --offline, report why it is unavailable, keep the
  last answer while re-asking, and re-ask after install, uninstall, recheck
  and saves. Reload the credentials form only when the agent dir changes and
  show why it could not be read.
- Resolve PI_CODING_AGENT_DIR as the pi child does (the parser's tilde rule,
  the child's HOME, no trimming, blank = removed), and anchor a relative dir
  in the workspace for the trust gate and trust decisions.
- Keep the pi minimum version in one Rust constant, mirrored by a checked
  frontend constant.
- Take the child's HOME (USERPROFILE on Windows) verbatim, a relative one
  included, and fall back to the account's home from the OS when a launch
  removes it, so settings and the trust gate never read codeg's own profile
  in place of the one pi opens.
- Match per-agent env names case-insensitively on Windows, where
  pi_coding_agent_dir is the variable pi reads.
- Anchor relative PATH entries in the child's cwd when resolving pi, and run
  the catalog query in a private empty directory, so it can never pick up a
  pi planted in the shared temp dir.
- Clear the credentials form when a newly selected agent dir cannot be read,
  so a save cannot write the previous profile's values into it.
- Route the connection-failure sentinels through one tested function.
…tries

- Treat the home variable the pi child inherits as its home even when empty,
  as Node does; only a launch that removes it falls back to the account home.
- Drop Windows drive-relative PATH entries (C:tools) when resolving pi: they
  follow a per-drive directory of the child that codeg cannot name.
@xintaofei

Copy link
Copy Markdown
Owner

codeg work task 241 is done — #842 (26 files, +1703/-588).

@xintaofei
xintaofei merged commit abc299b into xintaofei:main Sep 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model reasoning effort missing 'max' (and 'minimal') in Pi integration config

2 participants