github / github/copilot-cli

1.0.81: session restore auto-continues work the user aborted, trapping loop-prone models

オープン
#4,673 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

area:sessions
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
6

説明

Summary

The interrupted-session restore added in 1.0.81 tracks a per-session working flag in ~/.copilot/open-sessions-state.json. The flag is set on assistant.turn_start and cleared only on session.idle (natural completion) or explicit session close. User abort does not clear it.

On a plain startup in the same directory, any session still flagged working is restored without confirmation and the CLI auto-enqueues this prompt:

"This session was interrupted while you were working. Review what you had done, then carry on and finish the task you were on." (displayed as "Continue the work that was interrupted.")

Sessions not flagged working go to an interactive picker instead, which is what the changelog's "offers to restore" describes.

For loop-prone models (small local BYOK models, thinking models), the result is unescapable: the model loops, the user aborts, the user restarts the CLI, the continue prompt is auto-sent, the model resumes the same stuck turn. Every restart repeats the cycle.

1.0.81 code (app.js)

Auto-enqueue, fje, called for sessions in the wasWorking set; the rest go to the picker:

var WJr="This session was interrupted while you were working. Review what you had done, then carry on and finish the task you were on.",
    jJr="Continue the work that was interrupted.";
function fje(e){e.send({prompt:WJr,displayPrompt:jJr,mode:"enqueue"})...}
...
if(J.has(x.session.sessionId)&&fje(x.session),!E)throw new Error("Interrupted-session recovery is unavailable");
await E(x.sessionIds,x.offeredSessionIds)

Tracker — set on turn start, cleared on idle or close, no abort handler:

noteTurnStarted(t){this.setWorking(t,!0)}
noteSessionIdle(t){this.setWorking(t,!1)}
noteSessionClosed(t){this.open.delete(t)&&this.enqueue(()=>OX(this.filePath,t,void 0))...}

Kill switch: COPILOT_TEST_DISABLE_INTERRUPTED_SESSION_RESTORE=true

Changelog 1.0.81: "Startup now offers to restore sessions that were still open when their CLI went away, so a crash or a machine restart no longer means reopening each terminal by hand."

Evidence

Session 256b3414-9156-47e3-95b1-516d66847a42, BYOK qwen-27b via llama.cpp.

The 8.2 h loop (1,509 calls, 117M input tokens, no gap over 5 min, every call finish_reason: tool_calls) ran on 1.0.80. The looping is a property of the small model; 1.0.81's contribution is making it unescapable:

UTC, Aug 29 Event
02:24:56 1.0.80 process exits mid-turn
02:47:45 1.0.81 startup restores the session (session.resume)
02:48:00 User types "continue"; loop resumes
06:20:34 User aborts (abort, reason: "user_abort")
06:24:18 Shutdown
06:26:21 Restart
06:26:28 Continue prompt auto-injected
06:26:32 User exits (25 s)
06:27:43 Restart
06:28:02 Continue prompt auto-injected again
06:44:36, 06:51:21 Two more user aborts
06:53:21 Shutdown

Session total: 2,949 model calls, 217M input tokens over 20 turns.

TUI during the loop — the model's degenerate repetitive output fills the screen:

TUI during the loop, filled with the model's degenerate repetitive output

Suggested fixes

  1. Clear working on user abort. Aborting is an explicit signal that the current work should not be resumed.
  2. Require confirmation before enqueuing the continue prompt, or queue it as an editable draft instead of a sent message.
  3. Stop auto-continuing the same session after N restarts.

Workaround

Set COPILOT_TEST_DISABLE_INTERRUPTED_SESSION_RESTORE=true.

Secondary bug (1.0.81, BYOK): utility model calls 404

Auto-mode utility calls send the internal model id to the local endpoint instead of the BYOK model name:

model.turn_failed 2026-08-29T04:47:33
  model: gpt-5.4-nano  (modelInfo: {id: "gpt-5.4-nano", name: "qwen-27b"})
  error: 404 The model `gpt-5.4-nano` does not exist.

The failing call is the side-channel prompt "Task: Detect whether the CURRENT MESSAGE expresses frustration with an AI coding assistant...". 4 occurrences on Aug 29; the turn recovers after each failure. Related: #4445 (auto mode picks unavailable models).

Related issues

  • #4668 — interrupted create_session resumes ~1.6 h later, duplicating work (same theme, different mechanism)
  • #4639 — event storage exhaustion drives compaction loop/OOM (I saw its 409 session_event_storage_exhausted warnings in the same session)

Versions

1.0.80 fine. 1.0.81 regresses. 1.0.82 unchanged (same restore code, no changelog entry).

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

app.js の中断されたセッションの復元パス、wasWorking チェック、tracker メソッドの noteTurnStarted、noteSessionIdle、noteSessionClosed から始めます。~/.copilot/open-sessions-state.json のセッション状態を使って動作を再現し、ユーザーによって中断されたセッションが次回の起動時に自動的に継続されないことを確認します。テスト中は COPILOT_TEST_DISABLE_INTERRUPTED_SESSION_RESTORE キルスイッチを確認してください。

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

評価

技術スタック
javascript
領域
cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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