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

Đang mở Phù hợp với người mới
#360 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
macos, python
Lĩnh vực
ai, backend

Hướng nghiên cứu

Bắt đầu tại tokeneconomizer/plugin/sidecall.py, ở fm_available, và so sánh bước kiểm tra khả dụng của nó với model system được fm_call sử dụng. Tái hiện bằng fm models trong cùng ngữ cảnh hook được mô tả trong issue; lệnh có thể thoát với mã 1 dù system đã sẵn sàng. Hoàn tất khi local_model=fm nhận diện được trường hợp đó và có thể thấy fallback khi không khả dụng trong errors.log hoặc doctor.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
7.4k
Fork
500
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
123

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/TokenEconomizer

Tất cả issue của microsoft/TokenEconomizer

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.