close: stop a simulator or emulator that the session's open booted

Đang mở
#4,162 1 bình luận 0 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, ios, typescript
Lĩnh vực
backend, cli, mobile-dev

Hướng nghiên cứu

Start with markSelectionBootOccurred in packages/device-selection/src/device-selection-resolver.ts to see where the boot fact is set, then trace how the session stores it and where the close path is handled in the daemon. The close help in packages/command-surface/src/management/app.ts and the shutdown policy (ADR 0029) show what else changes. Done means the daemon tests for boot-owned, pre-booted and policy-denied closes pass, and a live open-then-close leaves the device in the expected state. Resolve the open decisions with a maintainer before you start.

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

Mô tả

enhancement needs-triage

Purpose

Agents leave local simulators and emulators running after they finish. open boots a stopped device on its own (ensureBootedSimulator and the Android boot path), but close only stops the device with an explicit --shutdown. An overnight agent run on one host left many booted simulators behind. In that run, 42 close requests and zero close --shutdown requests were logged.

The daemon already knows when open booted the device: markSelectionBootOccurred in packages/device-selection/src/device-selection-resolver.ts sets selection.bootOccurred: true. No close or teardown path uses that fact.

The rule is "leave the device as you found it". If a session's open booted a local simulator or emulator, close stops it. If the device was already running, close leaves it running.

Required behavior

  • The session records whether its open booted the local virtual device. Provider and physical targets never record a boot (this matches markSelectionBootOccurred).
  • If the session booted the device, plain close stops it through the same shutdown capability as close --shutdown. This applies to every local simulator and emulator: iOS, tvOS, visionOS, watchOS, and Android.
  • If the device was already booted before open, plain close leaves it running. This is the current behavior.
  • close --shutdown keeps its current meaning: it always stops a local simulator or emulator.
  • Daemon policy that denies device-shutdown (ADR 0029) also blocks the implicit stop. In that case close succeeds and reports that the device was kept running.
  • The close response reports the implicit stop in data.shutdown, the same as an explicit --shutdown.
  • A boot-owned device does not keep a warm iOS runner after close, because the device stops.

Open decisions

  • Should there be an opt-out for an agent that booted a device and wants it to stay up (for example close --keep-device)? A new flag follows docs/agents/cli-flags.md.
  • Should graceful daemon shutdown, or session idle expiry, also stop devices that its sessions booted? That would cover agents that never call close.

Completion conditions

  • Daemon tests: a session that booted a simulator or emulator stops it on plain close. A session on a device that was already booted does not stop it. Policy denial keeps the device running and close still succeeds.
  • Live check on a stopped iOS simulator and a stopped Android emulator: open then close, and the device ends shut down. With a pre-booted device, it ends booted.
  • Update the help and docs to describe the new default: close help in packages/command-surface/src/management/app.ts, the lifecycle facts and workflow/manual-qa/validate topics in src/commands/schema/cli-help*.ts, website/docs/docs/sessions.md, and the skills. The interim instructions that tell agents to add --shutdown can then become plain close.
  • Changelog/release note entry for 0.22, because the default changes.
Ngôn ngữ chính
TypeScript
Star
5.2k
Fork
359
Merge trung bình
13 giờ 23 phút
Pull request đã merge (30 ngày)
655

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

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 callstack/agent-device

Tất cả issue của callstack/agent-device

Issue tương tự

Thêm issue về TypeScript

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.