Idle leases: a worker ends a lease whose device goes unused
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- api, backend, documentation, testing
Hướng nghiên cứu
Start with ADR 0094 and the existing leasing flow in src/leasing, especially createLeasing and LeaseReleaseCoordinator; then trace the dispatcher, input, tunnel, CLI passthrough, and daemon connection paths listed in the issue. Use the named seam tests to cover idle timing, activity signals, and connection close, then update the contract, stream end reasons, docs, and OpenAPI artifacts. Done means the specified tests, typecheck, website build, OpenAPI check, config default, and stale reference check all pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Part of #1899.
Scope
A worker ends a lease whose device has not been used for lease.idleAfterMs (30 min by default, 0 = off) with reason idle, even while its holder renews. Commands, rotation, input, adb-tunnel bytes and local simlock simctl/adb count as use, and every lease record the worker answers shows lastUsedAt, idleDeadline and inUse. The docs say so.
If it goes wrong, a lease in active use is ended as idle, or a forgotten one is never ended.
Technical spec
Commit 056e29880.
Rows
Behaviours: B1, B2, B3, B4, B5, B8, B9
Stored state: S1
Interfaces: I1, I2, I3, I4, I8, I10
Existing code: X1, X2, X3, X4, X5, X6, X7, X8, X12, X13, X14, X18 (the pages of T1: leases, keep-a-device, build-and-run, screen-and-input-api, configuration, events, EVENTS.md)
Facts
| # | Fact | Source |
|---|---|---|
| F1 | The endWaitMs validator already refuses a delay above the timer ceiling 2147483647 |
src/core/config-validators.ts:360-368 |
| F2 | lease.endWaitMs is added to the config schema, types, defaults and validators in four places, the model for idleAfterMs |
src/contract/config-schemas.ts:118, src/core/config-types.ts:125, src/core/config-defaults.ts:116, src/core/config-validators.ts:220 |
| F3 | The CLI resolves its requester id with the process id as fallback, and knows when it fell back | src/cli/environment.ts:369, :449 |
| F4 | The daemon closes a socket connection in one place | src/daemon/server.ts:550 (#closeConnection, :694) |
| F5 | A by-shape module type needs a type test against its original | src/modules/AGENTS.md (Rules), src/daemon/module-shapes.test.ts |
Modules touched
contract (config, lease, operations-leases schemas; protocol bump), core (config), leasing (use port, idle timer, end reason), daemon (dispatcher exec, devices, leases, status, views; server connection signal; module wiring; module-shapes test), modules (ModuleLeaseUse, ModuleEndedLease), input, tunnel, cli (passthrough command), history (usage projection), stream (src/stream/definition.ts:82, the published end reasons), bus, simlock-client (types comment), website docs, openapi.json. Searches: rg "LeaseEndReason|LeaseReleaseReason|EndedLease|END_REASONS|endReason", rg "leaseRecordSchema|leasesFor|snapshot.leases", rg "inputs:" in src/daemon.
flowchart LR
D[daemon dispatcher] --> L[leasing LeaseUse]
I[input] --> M[modules ctx.leaseUse]
T[tunnel] --> M
M --> L
C[cli passthrough] --> D
L --> R[release coordinator: idle]
R --> H[history usage]
Rules in play
- ADR 0094 §1–§5: the idle clock beside the TTL, what counts as use, operator-only and on by default, one release path, memory only.
- ADR 0004 §1, as narrowed by 0094.
src/contract/AGENTS.mdProtocol version: one bump for the config, record anddriver.passthroughshape changes in this PR.src/leasing/AGENTS.mdEnding a lease: the idle end goes throughLeaseReleaseCoordinator; events after the commit.src/modules/AGENTS.md:ModuleLeaseUseand the widenedModuleEndedLeasehave type tests.docs/internal/agent-rules/documentation.mdrule 9: the website pages in X18 change in this PR.docs/internal/agent-rules/events.md:lease.released's reason list in EVENTS.md and events.mdx.
Retired words
Only renewing keeps a lease alive: renewing keeps a lease alive only while its device is used (website leases and keep-a-device pages).Nothing else releases a lease: the idle limit ends an unused lease too.
Tests
Seam: createLeasing with a fake clock for B2, the daemon dispatcher for B3, B4 and B8, the CLI passthrough command over a fake daemon and the daemon server's socket connection (I10's close signal) for B4's CLI and close cases, the input and tunnel worker links for B5; model on src/leasing/create-leasing-grant-and-queue.test.ts, src/daemon/dispatcher-exec.test.ts, src/cli/passthrough.test.ts, src/daemon/server-roles.test.ts, src/input/worker.test.ts and src/tunnel/worker-emulator-tunnel.test.ts.
- B1: an operator sets
lease.idleAfterMs: absent → 1800000;0;60000;2147483647;59999,2147483648,-1,1.5,"30m"refused. - B2: a renewed but unused lease ends
idle: at 30 min; limit0never; TTL first →expired; released first; physical lease; restored at start → 30 min after the start. - B3:
device.execanddevice.rotaterestart the clock: exec at 20 min; exec running 10–45 min; exec refusedPASSTHROUGH_REFUSED; rotate; unknown lease. - B4: a local passthrough holds the requester's leases until the connection closes: one lease; two platforms; 10–45 min run; CLI killed; another requester's lease; no
requesterId; CLI with no agent session; refused tool; invalidrequesterId. - B5: input messages and emulator-port tunnel bytes restart the clock: tap; socket open only; dropped bad frame; emulator-port
DATA; reverseDATA; reverseDATAbeside an idle adb connection; renew. - B8: every answered lease record carries I4:
lease.get,lease.list,list.get kind=leases,status.get, renew, grant; never used; used; use running; limit0; through a gateway's view. - B9: the usage ledger keeps
idle:lease.releasedreasonidle→endReason: "idle"; unknown reason →null.
Done when
pnpm test:changedandpnpm typecheckpass.pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjspasses with the regeneratedwebsite/public/openapi.json.- The stream route's published description (
src/stream/definition.ts:82) listsidleamong the end reasons. simlock config geton a fresh worker showslease.idleAfterMs: 1800000.- The pages in X18 for this task describe the idle limit, what counts as use and reason
idle, andstale-refs.shfinds neither retired line.
Out of scope
- agent-device commands and the agent-device idle message (#1908).
- CLI, MCP and console display of the new fields and messages (#1909).
Depends on
- #1905 (it also changes
DispatchSession,leasesForand the protocol range; it is ready first) - #1134 (it also changes the protocol range)
Written by an agent.
- Ngôn ngữ chính
- TypeScript
- Star
- 730
- Fork
- 44
- Merge trung bình
- 16 giờ 13 phút
- Pull request đã merge (30 ngày)
- 387
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
- Đọ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.
Issue khác của callstackincubator/simlock
-
The SIGKILL escalation test passes without escalation when its child starts later than 100 msĐang mởbug:new
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
callstackincubator/simlock#1986 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug:new
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
callstackincubator/simlock#1979 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
process-runner.test.ts fails four tests when a child starts 1 to 3 s lateCó thể đã có người làm @V3RON đã nhận hôm nay. Đang mởbug:new
callstackincubator/simlock#1985 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug:new
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
callstackincubator/simlock#1984 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
iOS runCommand passes timeoutMs to spawn, which ignores it, and its comment relies on that backstopĐang mởbug:new
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
callstackincubator/simlock#1980 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của callstackincubator/simlock
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
audacity/audacity.github.io#118 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
crxjs/chrome-extension-tools#1261 ·
-
Resources: Update work of fuzhouCó thể đã có người làm @rmt-svc đã nhận hôm nay. Đang mởresources
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
railmapgen/rmp-gallery#4245 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
mike-north/AgentMonitors#717 ·
Maintainer thường phản hồi trong vòng 1 ngày