github / github/app

Rate-limit auto-switch silently stops the agent in autopilot

Đang mở
#772 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Bugs
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
2.1k
Fork
153
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Summary

When the CLI hits a rate limit and auto-switches to a fallback model, the agent halts at the end of the turn and the user has to type "continue" to resume. This happens even in **autopilot**, which defeats the point of autopilot.

The UI also gives almost no indication this has happened — just a muted gray inline line ("Limit reached. Model changed to Auto.") that's easy to miss in a long scroll.

## Reproduction

1. Run a session in autopilot until you hit a rate limit on the current model.
2. Observe:
- Inline notice: "Limit reached. Model changed to Auto." then "Model changed to Opus 4.7 (1M context) (Medium)."
- Session goes idle.
- Agent does not continue. User must type "continue."

![screenshot](https://github.com/user-attachments/assets/placeholder)

## Root cause

The CLI runtime continues a turn through an auto-switch **only** when the session was started with `continueOnAutoMode` enabled. This app never sets that option, so the runtime takes the "stop and wait" branch every time a switch happens.

In autopilot we already auto-accept the `auto_mode_switch.requested` event ([`src-tauri/src/session/handler.rs:1402-1421`](https://github.com/github/github-app/blob/main/src-tauri/src/session/handler.rs)) and return `AutoModeSwitchResponse::Yes`. But **accepting the switch is not the same as continuing the turn** — the runtime applies the new model and then goes idle anyway.

The relevant SDK contract is documented in the vendored types:

- `SessionUpdateOptionsParams.continue_on_auto_mode` ([`crates/copilot-sdk/src/generated/api_types.rs:7888-7890`](https://github.com/github/github-app/blob/main/crates/copilot-sdk/src/generated/api_types.rs)): "Whether to allow auto-mode continuation across turns."
- `SessionErrorData.eligible_for_auto_switch` ([`crates/copilot-sdk/src/generated/session_events.rs:523`](https://github.com/github/github-app/blob/main/crates/copilot-sdk/src/generated/session_events.rs)): "the runtime will follow this error with an `auto_mode_switch.requested` event (**or silently switch if `continueOnAutoMode` is enabled**)".

## Proposed fix

Push `continue_on_auto_mode` to the runtime as part of mode management:

- `true` when `cached_mode == "autopilot"`
- `false` otherwise

via `session.rpc().options().update(SessionUpdateOptionsParams { continue_on_auto_mode: Some(...), .. })`, called from `Session::set_mode()` ([`src-tauri/src/session/core.rs:1528`](https://github.com/github/github-app/blob/main/src-tauri/src/session/core.rs)) and at session create. The generated SDK type already carries the field, so **no SDK or cross-repo change is needed**.

## Tradeoff

Enabling `continueOnAutoMode` makes the runtime **silently** switch — it suppresses the `auto_mode_switch.requested` event and therefore the interactive `AllowancePrompt` ([`src/components/conversation/AllowancePrompt.tsx`](https://github.com/github/github-app/blob/main/src/components/conversation/AllowancePrompt.tsx)).

- In **autopilot** that's correct: the user opted into "run autonomously, don't pause." They still get the `session.model_change` notice with `cause: "rate_limit_auto_switch"` ("Limit reached. Model changed to …").
- In **interactive / plan** we should keep the existing prompt-and-wait behavior, so the user can choose.

Recommended scope: autopilot-only.

## Out of scope (follow-up)

The inline "Limit reached. Model changed to …" notice is rendered in muted gray and is easy to miss — see `ModelChangeNotice` in [`src/components/conversation/ConversationMessageRow.tsx:198-234`](https://github.com/github/github-app/blob/main/src/components/conversation/ConversationMessageRow.tsx). Worth a separate pass on visibility (banner, accent color, or workspace badge) once the auto-continue behavior is in.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

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.