Skip to content

slow-agent-device: two same-named sessions test times out on first snapshot in a full lane run #1581

Closed

Description

@V3RON

e2e/slow-agent-device.test.ts > agent-device through simlock (iOS) > with the device limit raised to 2 > "keeps two same-named sessions apart: a runner's lease boots, survives closes, serves a new session and ends on release" timed out in 2 of 3 full lane runs on 2026-11-15. The error is agent-device COMMAND_FAILED "Daemon request timed out" (daemon_transport_timeout, 90000 ms), on the first snapshot after boot, at e2e/slow-agent-device.test.ts:788 (e2e/helpers/agent-device-targets.ts:128).

Run alone, it passes: in 191 s on main 6dcbd34, and in 178 s and 165 s on #1573's branch. It fails only inside the full lane, right after the two-device test's load. That points to a time limit too tight under load, or to ordering between tests. It has not been shown to fail on main in a full lane run.

Logs: /var/folders/tb/j39z273s5kn7lb9tz1dhk8l00000gn/T//simlock-slow-e2e-20261115-170630.log, /var/folders/tb/j39z273s5kn7lb9tz1dhk8l00000gn/T//simlock-slow-e2e-20261115-180422.log. The agent-device ndjson log is deleted when the lane home is cleaned, so what the daemon was waiting on is unknown. Keeping that log when a test fails would show it next time.

Written by an agent.

Activity

  1. added
    bug:new
    flaky-test
    on Nov 15, 2026
  2. self-assigned this
    on Nov 15, 2026
  3. V3RON commented on Nov 15, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done: read the lane logs that ran this test. Only the slow lane reproduces it, so there is no test and no branch.

    Not done: reproduction, root cause, fix.

    Findings

    • Every full-lane run used feat(ios): sources live in a folder as long as the device set #1573's open branch. No full lane has run on main (testing rule 5):

      164529  task-1569  full  pass 188 s
      170630  task-1569  full  FAIL 178 s
      172336  task-1569  -t    pass 165 s
      173004  task-1569  full  pass 182 s
      180422  task-1569  full  FAIL 175 s
      190007  base       -t    pass 191 s
      
    • The 90 s limit is agent-device's, not the e2e's. Raising FIRST_SNAPSHOT changes nothing:

      agent-device 0.21.36 dist/src/sdk-batch.js: snapshot -> envelopeMs: 9e4
      e2e/helpers/agent-device-targets.ts:78  FIRST_SNAPSHOT = { timeout: 180_000 }  (subprocess only)
      
    • Unproven: the previous test's afterEach replaces both devices just before this test, so the runner may start on new copies under load.

    Blocked on: a slow-lane run of e2e/slow-agent-device.test.ts e2e/slow-ios-window.test.ts e2e/slow-baseline.test.ts on main, 2–3 times. If it fails, keep ~/.sls/simlock-ad-* for the ndjson log.

    Written by an agent.

  4. added
    bug:blocked
    and removed
    bug:new
    on Nov 15, 2026
  5. removed their assignment
    on Nov 15, 2026
  6. V3RON commented on Nov 18, 2026

    @V3RON
    ContributorAuthor

    Lane runs on main

    scripts/slow-e2e.sh e2e/slow-agent-device.test.ts e2e/slow-ios-window.test.ts e2e/slow-baseline.test.ts on main 06ff865, 3 times, agent-device 0.21.36 (= the pin):

    115027  pass 215 s
    123643  FAIL 182 s  COMMAND_FAILED daemon_transport_timeout 90000 ms, first snapshot (agent-device-targets.ts:128)
    132431  pass 215 s
    

    So it fails on main too, about 1 run in 3. In the failing run a second iOS test hit the same 90 s timeout on a snapshot: "after an accepted upload install and snapshot, install from a remote: path, ... are refused ..." (149 s).

    The ndjson log was lost again: the lane's temp dir is /tmp/simlock-slow/, not ~/.sls/, and the agent's home is deleted right after the failure.

    Other failures in these runs, not this bug: the Android simlock-kill test (all 3 runs, #1578) and the iOS window test's "front app changed" (runs 1 and 3, someone was using the Mac).

    Logs: /var/folders/tb/j39z273s5kn7lb9tz1dhk8l00000gn/T//simlock-slow-e2e-20261118-123643.log (+ -daemons/).

    Written by an agent.

  7. added
    bug:new
    and removed
    bug:blocked
    on Nov 18, 2026
  8. self-assigned this
    on Nov 18, 2026
  9. V3RON commented on Nov 18, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    The cause is narrower than "too tight under load": the e2e never gives agent-device more than 90 s. FIRST_SNAPSHOT only sets the CLI process timeout. When this test passes, its first snapshot takes 85–88 s, so a 91 s one fails.

    e2e/helpers/agent-device-targets.test.ts > FIRST_SNAPSHOT > "an agent's snapshot run with FIRST_SNAPSHOT reaches agent-device's daemon with a 150000 ms budget". The pinned CLI talks to a stand-in daemon that records the call. It skips without SIMLOCK_E2E_AGENT_DEVICE.

    SIMLOCK_E2E_AGENT_DEVICE=<pinned agent-device.mjs> pnpm test:e2e e2e/helpers/agent-device-targets.test.ts
    AssertionError: expected undefined to be 150000   (agent-device-targets.test.ts:92)
    

    This test's first snapshot, read from the lane's simlock daemon.log (POST /v1/agent-device/rpc):

    115027  84654 ms  200
    132431  87778 ms  200
    123643  90061 ms  500   (same run, "after an accepted upload": 90016 ms 500)
    17 Nov: 2 more at 90037 / 90042 ms 500, many at 60-88 s 200
    

    Root cause

    Defect in the test helper. e2e/helpers/agent-device-targets.ts:78 sets FIRST_SNAPSHOT = { timeout: 180_000 }, which is only the process timeout (e2e/helpers/agent-device.ts:159). The snapshot is sent with no --timeout, so agent-device 0.21.36 keeps its default 90 s request limit (packages/command-registry/src/timeout-policy.ts:7). Only --timeout raises it (registry.ts:451). At 90 s the client gives up and simlock relays agent-device's 500. It shows at slow-agent-device.test.ts:788 and :337, but every FIRST_SNAPSHOT call has it. The helper's comment is out of date.

    Simplest fix

    FIRST_SNAPSHOT = { timeout: 180_000, flags: ["--timeout", "150000"] }. Add AgentDeviceRunOptions.flags and append it after the args in both Agent.runs (agent-device.ts:159, :254). Call sites stay as they are.

    fix applied: 2 passed (reproduction + warmUp); pnpm typecheck clean; then discarded
    

    Alternatives rejected

    • Raise FIRST_SNAPSHOT.timeout only: the 90 s limit stays (handoff above).
    • prepare before each first snapshot: adds a step to every test.
    • Raise agent-device's default for a first snapshot: another repository, and real agents would see the change.

    Risk

    • Not run on the lane: the tool guard refuses this role. Needs a slow-lane run of e2e/slow-agent-device.test.ts -t 'simlock \(iOS\)', 2–3 times.
    • 150 s is a guess above the 88 s seen. No snapshot slower than 90 s has been seen finishing.
    • The reproduction skips where SIMLOCK_E2E_AGENT_DEVICE is unset (CI).

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: no — agent-device could raise its own first-snapshot default

    Written by an agent.

  10. removed their assignment
    on Nov 18, 2026
  11. V3RON commented on Nov 18, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none
    Parked: #1581 — fast track held: "One fix: no — agent-device could raise its own first-snapshot default"; needs the maintainer to pick the fix (e2e --timeout on the first snapshot, or an agent-device default change) and set bug:ready.
    Waiting: none
    Decided: #1581 — blocker met by 3 lane runs on main (1 failed) → moved bug:blocked to bug:new and triaged; flaky-test kept.

    Written by an agent.

  12. added
    bug:ready
    and removed
    bug:new
    on Nov 19, 2026
  13. self-assigned this
    on Nov 19, 2026
  14. V3RON commented on Nov 19, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1783 (#1581)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  15. added a commit that references this issue on Nov 19, 2026
    2f7a2ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:readyflaky-test

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions