Worker: an admission command that ranks or refuses local lease requests (ADR 0074 on the worker)

Ouverte
#1,744 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript
Domaine
api, backend

Piste de recherche

Start with ADR 0074 and src/leasing/acquisition-admission.ts, then trace how gateway admission commands receive requests and how local worker lease requests are stored. The proposal also points to worker configuration and status reporting as entry points. Done means local requests support operator admission and fail closed if the controller stops, while existing leases and in-flight operations follow the stated use case.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

request:new

Problem

ADR 0074 lets a gateway run an operator admission command that ranks or refuses each new lease.request. On a host that runs a worker, though, local agents lease from the worker directly. So an operator who must hold the host's simulators for a scheduled workload (a CI train, a measurement run, maintenance) has no supported way to refuse new local provisioning.

Verified against v0.8.0:

  • docs reference/cli.mdx "Which daemon a command reaches": with neither --gateway nor --local, a command goes to the gateway only when no worker has started on the machine. So on a worker host the default CLI and MCP reach the worker.
  • gateway/joining-workers.mdx: "Agents on the worker machine still lease devices from it directly."
  • gateway/access-control.mdx: on the daemon's own machine the CLI needs no token.
  • source src/leasing/acquisition-admission.ts holds only internal checks (requester limit, lease ids). There is no operator hook on the worker.
  • worker drain exists only for gateways. On a standalone worker, capacity limits apply only at daemon start.

Context: the same shared-Mac setup as #1587 / #1737 (one Mac mini, one worker, ~10 concurrent coding agents, plus scheduled CI trains on the same host).

Use case

Before a train starts, the operator needs to:

  1. refuse new simulator/emulator provisioning (new leases, boots, installs);
  2. let boots already in flight finish and keep existing leases (no forced release);
  3. admit only the train's own requests while it runs (by request metadata);
  4. stop refusing when the train ends.

Hard requirement: fail closed if the controller dies. If the process that holds the reservation is killed or interrupted, new provisioning must stay refused until an operator or the controller clears it. It must never fall back to admitting.

Proposal

Mirror ADR 0074 on the worker:

  • admission.command (an argv list) and admission.timeoutMs in the worker config. The command runs once per new local lease.request, after the cheap refusals and before the request is stored. The stdin/stdout contract is the same as the gateway's ({} / {"priority": n} / {"deny": "reason"}), it receives the caller's metadata, and it fails closed with ADMISSION_FAILED.
  • Requests relayed by a gateway that already ran its own command can skip the worker's command (configurable).
  • Optional simpler switch: worker drain on a standalone worker (refuse new local leases, keep existing ones).
  • Status exposes in-flight lifecycle operations (booting/creating/installing), so a controller can wait for them to settle before it takes ownership.

Alternatives considered

  • A same-host gateway with an admission command: local agents bypass it (see above).
  • Running the worker from a separate SIMLOCK_HOME so the default CLI resolves to the gateway: possible, but it relocates device state and puts a gateway hop on every local simctl/adb/install.
  • Restarting the daemon with lower capacity limits: needs 0 leases and a restart each time.

Environment: Simlock 0.5.0 (planning 0.8.0), macOS 27.2, Xcode 27.2, single-host worker.

Langage dominant
TypeScript
Étoiles
705
Forks
40
Merge moyen
12 h 9 min
PR mergées (30 j)
376

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de callstackincubator/simlock

Toutes les issues de callstackincubator/simlock

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.