Skip to content

@simlock/e2e and the agent-device address tag every lease with the CI run id #1668

Closed

Description

@V3RON

Part of #1633.

Scope

A @simlock/e2e run on GitHub Actions tags every device it leases with the GitHub run id (or SIMLOCK_RUN, or its new runId option), so the cleanup step simlock release --run <id> frees them after a cancelled job. The provider sends the run id as agent-device's own runId, and the agent-device address copies that runId onto the simlock lease, on a worker and on a gateway. Outside CI the provider sends the runner's run id as today. agent-device itself does not change.

A user would notice: a cancelled e2e job whose devices the cleanup step does not free, a provider that throws on a run id that was fine, or an allocate refused because of its runId.

Technical spec

Commit c9d82e3.

Rows

Behaviours: B9, B10
Interfaces: I6, I7
Existing code: X20, X21, X22, X23 (the provider's runId option and its default)

Facts

# Fact Source
F1 Every option the provider takes is listed in KNOWN, and an unknown one throws at config load packages/e2e/src/options.ts:31-44
F2 The provider's errors start with simlockDevices: packages/e2e/src/options.ts:55-57
F3 Allocate, heartbeat and release all send the provider's scope, whose runId is request.runId today packages/e2e/src/provider.ts:46-56, :86-93, :114, :182
F4 The agent-device front builds the lease.request input in leaseInput; the gateway front uses the same code src/agent-device/front/allocate.ts:194-204, src/agent-device/AGENTS.md (Flow: through a gateway, step 1)

Modules touched

src/agent-device/front/allocate.ts (and the Plan it builds, :48-61), packages/e2e/src/ (options.ts, provider.ts, index.test.ts, provider.test.ts), and the website pages using-devices/ci.mdx (the runId option row and the default) and using-devices/agent-device.mdx (an allocate's runId becomes the lease's run id). Searches: runId in src/agent-device/front and packages/e2e/src, leaseInput, KNOWN, ProviderOptions.

Rules in play

  • src/agent-device/AGENTS.md: checkRequest runs first and is unchanged; the front never refuses on a runId.
  • ADR 0077: @simlock/e2e is its own workspace package; it imports no simlock code, so it keeps its own copy of the run id rule.
  • Documentation rule 9: the two website pages.

Tests

Seam: the agent-device front with the fake agent-device (models: src/agent-device/edge-allocate.test.ts, src/agent-device/gateway-front-lease.test.ts) and createProvider / simlockDevices with a fake agent-device client (models: packages/e2e/src/provider.test.ts, packages/e2e/src/index.test.ts).

  • B9: an allocate's runId onto the lease: 123-1; simlock-local; one outside the rule (lease has none); a run release then ends it on a worker and on a gateway
  • B10: the provider's run id: each row of the first Examples table with runId for --run, except the rows the @simlock/e2e table replaces; each row of that table; allocate, heartbeat and release send the same runId

Done when

  • pnpm test:changed passes, with every Tests line above as a test, and the existing provider and agent-device front tests pass unchanged.
  • pnpm check passes.
  • The website build passes: pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs.

Out of scope

  • Any change to agent-device.

Depends on

Written by an agent.

Metadata

Metadata

Assignees

Labels

task:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions