sidecall: fm_available reports the on-device model unavailable whenever Private Cloud Compute is, so local_model=fm never runs

オープン 初心者向け
#360 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
macos, python
領域
ai, backend

調査の方向性

tokeneconomizer/plugin/sidecall.py の fm_available から始め、その可用性チェックを fm_call が使用する system モデルのチェックと比較してください。issue に記載されたものと同じ hook コンテキストで fm models を実行して再現してください。system の準備ができていても、終了コード 1 で終了することがあります。local_model=fm がこのケースを認識し、利用不可時のフォールバックが errors.log または doctor で確認できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

tokeneconomizer/plugin/sidecall.py decides whether the on-device model can take a side call with fm_available, which runs fm available and requires exit status 0 (sidecall.py#L819-L833). But fm available lists every Apple Foundation Models provider and exits 1 as soon as one of them is unavailable, even when the on-device system model, the one fm_call uses, is ready. Private Cloud Compute is unavailable outside the Terminal app, and the agents run their hooks outside it, so on such a Mac fm_available() is always False. With local_model=fm, every judge call then falls back to the agent's CLI, silently: nothing is written to errors.log, and status does not say the on-device judge is unused.

fm available on macOS 27.2.1, run from a Claude Code Bash tool (not Terminal.app):

warning: 'fm available' has been renamed to 'fm models'; 'available' still works but is deprecated.
  Apple Foundation Models
  ✓ system (AFM 3 Core Advanced)
  ✗ pcc                           (Private Cloud Compute is not available in this context. Please use the Terminal app.)

Exit status: 1 (fm models prints the same and also exits 1).

Reproduction:

from tokeneconomizer.plugin import sidecall as s

print(s.fm_available())
print(s.fm_call("An agent ran the same failing test 9 times with identical errors and no edits. Is it stuck?",
                schema=s.JUDGE_SCHEMA))

Expected: True, since the call below it works.

Actual:

False
('{"confidence": 0.95, "reason": "Consistent failure across multiple runs indicates a systemic issue.", "stuck": true}', 0)

A possible fix: judge availability from the system line (✓ system), not from the exit status, and move to fm models, since available is deprecated. When local_model=fm is set but the model is judged unavailable, a line in errors.log or in doctor would make the fallback visible.

Upstream main: 747b8016538c13da7ba9d455b89e5e6595bf5294

Python 3.15.2, macOS 27.2.1 (Apple silicon), Claude Code 2.1.332

主要言語
Python
スター
7.4k
フォーク
500
平均マージ
1日 19時間
マージ済み PR(30日)
123

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/TokenEconomizer のほかの issue

microsoft/TokenEconomizer の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。