Skip to content

A gateway refuses a baseline lease with UNKNOWN_BASELINE for ~30 s after the worker joins #1300

Closed as not planned

Description

@V3RON

What happened

Right after a worker joins a gateway, the gateway does not know the worker's baselines for about 30 s. simlock --gateway baseline list showed the worker's baseline only about 35 s after the worker restarted, and worker list showed "capacity unknown" until then. A --gateway lease --baseline <name> in that window would be refused at once with UNKNOWN_BASELINE ("no worker holds a baseline named …"), although the worker holds it.

What you expected

The gateway reads the worker's baselines as soon as the worker finishes starting. A baseline lease in the meantime waits for the worker instead of being refused.

How to reproduce

  1. simlock --gateway daemon start, a worker with a saved baseline, joined to the gateway with a worker token, then restart the worker.
  2. At once: simlock --gateway baseline list (baseline missing) and simlock --gateway lease --platform ios --baseline <name> --detach.
  3. About 35 s later the list shows the baseline.

Environment

Simlock 0.5.0 package at main 14a3f826b, macOS 27.0.1 arm64, Xcode 27.1, Android emulator 37.2.13. Found in the 0.6 release E2E run on 2026-11-05. Gateway mode. A fresh gateway is affected most: one that has seen the worker before restores the last known baselines.

Logs and evidence

From a read of the code (the lease refusal was not run in the window, only the list delay was seen):

  • A worker that joins while still starting answers status.get with health and load only; the link stores that and reads no baselines (src/gateway/worker-link.ts:398-402). Baselines are read only for a running worker (#refreshRunning, worker-link.ts:418).
  • The join's full read parks on events.subscribe while the worker starts and times out after 10 s (WORKER_CALL_TIMEOUT_MS, worker-link.ts:46). After that only the 30 s tick (WORKER_VIEW_REFRESH_INTERVAL_MS, src/contract/worker-view.ts:24) reads the worker in full.
  • The router's assess (src/gateway/routing/serviceability.ts:55-75) finds holders only among views that list the baseline and does not count a starting worker as a possible holder, so the request is rejected, not queued (fleet-coordinator.ts:886-893).
  • No test covers a baseline lease right after a join.

Written by an agent.

Activity

  1. added
    bug:new
    on Nov 5, 2026
  2. V3RON commented on Nov 5, 2026

    @V3RON
    ContributorAuthor

    Written by an agent.

  3. self-assigned this
    on Nov 5, 2026
  4. V3RON commented on Nov 5, 2026

    @V3RON
    ContributorAuthor

    Could not reproduce this in-process. Moving to bug:needs-info.

    What I tried (fast e2e lane, fake driver, at 5069c243f). Each run: a gateway and a worker, the worker saves baseline checkout, both daemons stop, the gateway starts fresh, then the worker starts and joins while it is still starting. Right after that, --gateway lease --baseline checkout --detach is granted and --gateway baseline list shows checkout. That held in all three setups:

    1. Worker startup held 3 s. events.subscribe waits for startup, then the full read gets the baselines.
    2. Worker startup held 14 s, so longer than the 10 s call bound. The gateway logged Worker did not answer an event subscription in time. When the late answer came, it read the worker in full (worker-link.ts:283-293, Flaky e2e: gateway-fleet reads a worker's capacity before the worker has left starting #414).
    3. The worker's first catalog.get after startup took 12 s. The gateway logged Worker view refresh failed: Timed out waiting for the worker's view refresh at +10 s. A worker event then started a new full read at +12 s, and that read got the baselines.

    So the issue's line "after that only the 30 s tick reads the worker in full" is not right: a late subscribe answer starts a full read.

    What the E2E host logs show (read-only, ~/.simlock-e2e on the E2E host):

    • The worker joined at 10:10:23.5 while it was still starting. Its startup ended 0.9 s later. The gateway logged no subscribe timeout, so the full read began at about 10:10:24.
    • The worker's log has no failed call from the gw: session. A failed read is logged at info, so none of them errored.
    • The two UNKNOWN_BASELINE refusals in the gateway log (10:11:15 and 10:11:20) were for the name nope. Those refusals are correct. No refusal of a baseline the worker held was logged.
    • Both logs were at info. At that level a timed-out view read (Worker view refresh failed, debug) and the read calls' durations are not written. So the logs cannot show why the first full read did not land.

    The likeliest cause is that the first full read after startup took longer than 10 s, with no worker event before the next tick to start another read. That is not confirmed.

    What would let me reproduce it:

    1. Run it again with log.level: "debug" in both the gateway's and the worker's config.json. Then send:
      • the gateway's Worker view refresh failed lines and their message;
      • the worker's operation lines for the gw: principal in the 30 s after Daemon started, with durationMs for catalog.get, config.get, baseline.list and list.get.
    2. The exact restart command. If it was daemon stop && daemon start, did daemon status say running afterwards? daemon start right after daemon stop leaves the worker stopped #1295 often leaves the worker stopped until a later command starts it.
    3. The clock time of each --gateway baseline list and --gateway worker list run, so they can be placed against the worker's Daemon started line and the gateway's 30 s tick.

    Written by an agent.

  5. added
    bug:needs-info
    and removed
    bug:new
    on Nov 5, 2026
  6. removed their assignment
    on Nov 5, 2026
  7. github-actions commented on Nov 20, 2026

    @github-actions
    Contributor

    Closing: no reply in two weeks. Comment with the missing information and it reopens for triage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:needs-info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions