Skip to content

Commit 25c563d

Browse files
committed
docs(daemon): state the lease invariant without borrowing #2509's cause
Four comments told the report's story as though it were this mechanism. A cloud WebDriver connection profile asks for a ten-minute lease, so the reported one-minute hang cannot have expired anything. The invariant stands on its own; where it came from and which leases it reaches belong in ADR 0007 and the commit, not in each test.
1 parent 41c6de5 commit 25c563d

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/daemon/__tests__/lease-registry.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,9 @@ test('canceling a superseded activation cannot remove its successor or another h
565565
assert.equal(registry.listHumanControlHolds(authority)[0]?.reason, 'successor');
566566
});
567567

568-
// #2509: nothing heartbeats a lease while its request works, so an admitted
569-
// capture that legitimately outruns the lease TTL expired its own lease and lost
570-
// the device it was still holding. In-flight work defers expiry and renews on
568+
// Nothing heartbeats a lease while its request works, so an admitted capture
569+
// that legitimately outruns the lease TTL expires its own lease and loses the
570+
// device it was still holding. In-flight work defers expiry and renews on
571571
// completion, exactly as a human-control hold does.
572572
test('in-flight request work defers expiry and renews the lease when it finishes', async () => {
573573
let now = 0;

src/daemon/__tests__/request-execution-scope.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,11 @@ test('expired leases remove owned sessions before the next command and free capa
509509
expect(nextLease.tenantId).toBe('tenant-b');
510510
});
511511

512-
// #2509: the slowest command in a cloud session killed every command after it.
513-
// Nothing heartbeats a lease while its request works, so one capture that ran
514-
// past the lease TTL expired its own lease, which tore the provider session down
515-
// under the client that was still waiting for it.
512+
// A lease renewed only at admission lets one command slower than its inactivity TTL
513+
// expire the lease paying for the device it is using, and expiry then tears the
514+
// provider session down under the client still waiting for that same command. Found
515+
// while investigating #2509, whose cloud session ran on a ten-minute lease and so
516+
// lost its session some other way.
516517
test('an admitted request that outlives the lease TTL keeps its lease and session', async () => {
517518
let now = 1_000;
518519
const sessionStore = makeSessionStore('agent-device-request-scope-');

src/daemon/__tests__/request-lease-work.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function admittedRequest(
2323
};
2424
}
2525

26-
// #2509: a capture that ran past the lease TTL expired the lease that was paying
27-
// for the device, so the session died underneath the client still waiting for it.
26+
// A capture that runs past the lease TTL used to expire the lease paying for the
27+
// device, so the session died underneath the client still waiting for it.
2828
test('admitted work that outlives the lease TTL keeps the lease it is working on', async () => {
2929
let now = 0;
3030
const leaseRegistry = new LeaseRegistry({ now: () => now, defaultLeaseTtlMs: 5_000 });

src/daemon/request-lease-work.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { DaemonRequest } from './daemon-request.ts';
99
* A lease renews when a request is admitted and never again while that request
1010
* works, so the slowest command in a session used to expire the very lease that
1111
* was paying for the device and tear the session down underneath the client still
12-
* waiting for its result (#2509). The pass defers expiry only while the work is
12+
* waiting for its result. The pass defers expiry only while the work is
1313
* still wanted, which the request-cancel registry already knows: once the client
1414
* hangs up the request protects nothing, so a handler that ignores its
1515
* cancellation cannot hold a rented device open.

0 commit comments

Comments
 (0)