Long-running agent sessions exhaust event storage and appear cancelled while CLI remains active
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
Description
Long-running Copilot CLI project sessions that spawn many subagents can exhaust the remote session event store. Once this happens, session status and handoffs become unreliable: sessions appear inactive or cancelled even though their CLI processes remain alive and may still be executing subagents.
Environment
- Copilot CLI:
1.0.79-5 - OS: Windows
- Workload: multiple long-running project/worktree sessions using custom agents with planner, debugger, impact-analysis, coverage, and review subagents
Reproduction
-
Start a project session that performs a multi-hour workflow with frequent tool calls, planner checkpoints, and nested subagents.
-
Allow the session to accumulate a large event history.
-
Observe repeated exporter failures such as:
Failed to submit events to Mission Control session …: 409 {"code":"session_event_storage_exhausted","message":"session event storage exhausted"} remote session batch flush failed … "event_count":500 remote session exporter circuit opened after batch flush failure -
Query the session through the app/runtime status APIs.
Actual behavior
- The project session may lose its
active_session_idor appear inactive. - Background-agent status may report
Cancelledor no agents, without a cancellation reason. - Final handoffs may not arrive.
- Restarting based on this status can create a second writer for the same dirty worktree.
- The underlying CLI process can still be alive, consuming CPU, updating its log, and executing internal subagents after the UI/runtime reports no active work.
- Logs can also report cleanup of many orphaned tool calls, but do not identify a timeout, quota, or other cancellation cause.
Expected behavior
- Event storage should rotate, compact, or start a continuation stream before exhaustion.
- Exporter failure should not make an otherwise-running session unsteerable or misreport its liveness.
- Status should distinguish at least: CLI alive, agent running, agent idle, export disconnected, and task cancelled.
- Cancellation should always expose a reason such as user request, timeout, execution budget, parent teardown, or storage failure.
- The runtime should prevent or clearly warn about concurrent writers when recovery is attempted for a worktree whose original process is still active.
Impact
This makes long-running autonomous work unsafe to recover. Users cannot tell whether work has stopped, and a reasonable restart attempt can cause concurrent edits in the same worktree. Dirty changes were preserved in this case, but reliable coordination required inspecting local process IDs and logs rather than the product status APIs.
Suggested mitigation
Automatically rotate or compact session event history near the storage limit, preserve a local liveness/control channel when remote export fails, and surface a prominent event storage exhausted health state with recovery guidance.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện phiên dự án kéo dài nhiều giờ và kiểm tra các lỗi của exporter, các API trạng thái runtime cũng như log cục bộ của tiến trình và phiên được mô tả trong báo cáo. So sánh trạng thái được báo cáo với CLI và các subagent vẫn đang chạy. Được xem là hoàn tất khi tình trạng cạn kiệt bộ nhớ lưu trữ được xử lý hoặc hiển thị rõ ràng, các trạng thái liveness và lý do hủy có thể được phân biệt, và quá trình khôi phục không thể tạo ra các writer đồng thời.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- shell
- Lĩnh vực
- backend-api-design, cli, observability
- Loại issue
- Lỗi
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100