You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ADR 0071 says the agent-device heartbeat carries leaseBackend; its RPC params do not #1480
docs/internal/adr/0071-a-restart-re-allocates-a-live-agent-device-lease.md:27 lists leaseBackend among the scope the CLI sends with a heartbeat. At agent-device v0.21.35 the CLI passes it to client.leases.heartbeat, but leaseScopeToLeaseRpcParams (packages/contracts/src/lease-scope.ts) puts backend only on lease_allocate. A heartbeat RPC carries tenantId, runId, leaseProvider, clientId, deviceKey, leaseId and ttlMs, and no backend.
The Context line is the fact the re-allocate was built on, so the next reader of the ADR will trust a field that is not there.
Confirmed. This is a defect in ADR text only, so no test can fail and no bug/1480-repro branch was pushed (precedent: #1375, #1095, #666). The evidence is agent-device at the pinned tag, plus the installed 0.21.35 dist:
gh api 'repos/callstack/agent-device/contents/packages/contracts/src/lease-scope.ts?ref=v0.21.35'
197 case 'lease_allocate': ... backend: scope.leaseBackend, (line 204)
207 case 'lease_heartbeat': ... leaseId, ttlMs (no backend)
installed dist back-mode.js:
case`lease_heartbeat`:return{...r,...m({leaseId:e.leaseId,ttlMs:e.leaseTtlMs})}
simlock repeats the claim nowhere else (git grep leaseBackend: only allocate calls in e2e).
Root cause
Defect, in an ADR's Context: docs/internal/adr/0071-a-restart-re-allocates-a-live-agent-device-lease.md:26-29 lists leaseBackend in the scope a heartbeat sends. The CLI does pass it to the heartbeat (connection-runtime.ts:892-941), but leaseScopeToLeaseRpcParams drops it from lease_heartbeat. allocateAgain (src/agent-device/front/heartbeat.ts:120-126) copies the heartbeat's params, so a re-allocate names no backend. The decision is unaffected.
Simplest fix
Correct the sentence. The code stays as it is:
The agent-device CLI heartbeats before each command and sends its lease
scope with it: `runId`, `clientId`, `leaseProvider` and `deviceKey`
(agent-device v0.21.35, `src/cli/commands/connection-runtime.ts:892-941`).
The CLI hands its `leaseBackend` to the heartbeat too, but the RPC drops
it: `leaseScopeToLeaseRpcParams` puts `backend` on `lease_allocate` only
(`packages/contracts/src/lease-scope.ts:178-223`). agent-device accepts an
Applied, then discarded:
pnpm exec vitest run --project unit src/adr-index.test.ts src/stale-refs.test.ts src/adr-flip-check.test.ts
Test Files 3 passed (3) Tests 14 passed (14)
Alternatives rejected
A superseding ADR: the decision does not change, only a fact in its Context.
Deleting the field list: readers need to know which scope fields the re-allocate can copy.
Risk
Because a re-allocate names no backend, agent-device records its default ios-simulator (installed lease-registry-scope.js), Android leases included. This is harmless today because simlock sets no AGENT_DEVICE_MAX_SIMULATOR_LEASES (src/agent-device/shared/daemon-environment.ts). The reviewer should decide whether the ADR says so.
Fast track
Defect: yes
Fix tried: no — doc-only, no failing reproduction to make pass
Nothing public added or broken: yes
No ADR or rule changed: no — the fix edits ADR 0071's Context
Maintainer accepted the triage report. Land the ADR correction in the same change as #1472's fix, and have the reworded sentence say that the re-allocate now sends the platform's backend itself. The report's Risk note that the missing backend has no effect today is wrong: it is the cause of #1472 (Lease does not match tenant/run scope).
Fixed by #1484 (merged as d7195cf), which also corrected the ADR 0071 sentence about the heartbeat carrying the lease's backend. Closed by hand: coding rule 3 lets a PR from bug/1472 close only #1472.
Activity
V3RON commentedon Nov 9, 2026
Reproduction
Confirmed. This is a defect in ADR text only, so no test can fail and no
bug/1480-reprobranch was pushed (precedent: #1375, #1095, #666). The evidence is agent-device at the pinned tag, plus the installed 0.21.35 dist:simlock repeats the claim nowhere else (
git grep leaseBackend: only allocate calls in e2e).Root cause
Defect, in an ADR's Context:
docs/internal/adr/0071-a-restart-re-allocates-a-live-agent-device-lease.md:26-29listsleaseBackendin the scope a heartbeat sends. The CLI does pass it to the heartbeat (connection-runtime.ts:892-941), butleaseScopeToLeaseRpcParamsdrops it fromlease_heartbeat.allocateAgain(src/agent-device/front/heartbeat.ts:120-126) copies the heartbeat's params, so a re-allocate names no backend. The decision is unaffected.Simplest fix
Correct the sentence. The code stays as it is:
Applied, then discarded:
Alternatives rejected
Risk
ios-simulator(installedlease-registry-scope.js), Android leases included. This is harmless today because simlock sets noAGENT_DEVICE_MAX_SIMULATOR_LEASES(src/agent-device/shared/daemon-environment.ts). The reviewer should decide whether the ADR says so.Fast track
Written by an agent.
V3RON commentedon Nov 9, 2026
Maintainer accepted the triage report. Land the ADR correction in the same change as #1472's fix, and have the reworded sentence say that the re-allocate now sends the platform's backend itself. The report's Risk note that the missing backend has no effect today is wrong: it is the cause of #1472 (
Lease does not match tenant/run scope).Written by an agent.
fix(agent-device): a re-allocate after a restart names the lease's ba…
V3RON commentedon Nov 10, 2026
Fixed by #1484 (merged as d7195cf), which also corrected the ADR 0071 sentence about the heartbeat carrying the lease's backend. Closed by hand: coding rule 3 lets a PR from
bug/1472close only #1472.Written by an agent.