Skip to content

[build-tools] Stop agent-device startup when the session is stopped - #4666

Draft
gwdp wants to merge 3 commits into
gwdp/supervise-device-session-tunnelsfrom
gwdp/agent-device-startup-stop-20261016
Draft

gwdp wants to merge 3 commits into
gwdp/supervise-device-session-tunnelsfrom
gwdp/agent-device-startup-stop-20261016

Conversation

@gwdp

@gwdp gwdp commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Why

A Stop request that arrived while an agent-device session was still starting did not end startup. The worker went on through the build download, Simulator boot, app install and launch, and controller setup, and then reported the session as ready. The same gap showed up in hosted Argent QA (Stop during the download still let Argent start), so the next PRs in this stack cover Argent, Appium and web preview.

How

  • Watch the session status while the agent-device session starts, using the existing status poll. On Stop, cancel the pending startup tasks, let work already running finish, and fail startup with an explicit "stopped during startup" error.
  • Retire that watcher once the session reports ready, and hand off to the normal lifetime wait.
  • Pass the startup signal to the worker API requests (status and ready report), so a pending request ends on Stop.
  • Keep the first failure; teardown errors stay visible.
  • An explicit errored status still fails the session when the duration deadline fires during the status response.
  • Artifact polling is unchanged.

Test Plan

  • Claude Code rebased this onto [build-tools] Supervise device session tunnels #4526 after the startup and egress changes landed on main. main no longer has the GraphQL status fallback, so its cancellation tests were removed and the duration-deadline regression now uses the worker API. Tests added on main since then now let the startup watch wait for its signal, like this PR's own tests.
  • Claude Code ran the build-tools typecheck and the session function/util tests on each commit (1908 and 1909 passed, 8 skipped), plus oxfmt and oxlint on the changed files. The duration-deadline test fails without its fix.
  • CI passes on 7a43ac7.
  • Planned: a hosted check that Stop during download and during serve-sim startup ends the session without a ready report.

Authorship and LLM use

Gabe directed the approach and excluded artifact-poller changes. Codex wrote the original change and tests, with AI and Devin review rounds. Claude Code rebased it, adapted the tests to main and rewrote this description. Gabe has not reviewed the rebased diff yet and can answer questions.

Generated with T3 Code, using Claude Code.

@gwdp

This comment has been minimized.

@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp added this pull request to stack #4606 October 17, 2026 00:19
devin-ai-integration[bot]

This comment was marked as resolved.

@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/agent-device-startup-stop-20261016 branch from 509e8de to 7a43ac7 Compare October 20, 2026 05:05
@gwdp gwdp changed the title [build-tools] Observe agent-device Stop requests during startup [build-tools] Stop agent-device startup when the session is stopped Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.38%. Comparing base (6fe396e) to head (bf60bca).

Additional details and impacted files
@@                            Coverage Diff                            @@
##           gwdp/supervise-device-session-tunnels    #4666      +/-   ##
=========================================================================
+ Coverage                                  75.36%   75.38%   +0.02%     
=========================================================================
  Files                                       1054     1055       +1     
  Lines                                      52323    52359      +36     
  Branches                                   11427    11390      -37     
=========================================================================
+ Hits                                       39430    39466      +36     
  Misses                                     11904    11904              
  Partials                                     989      989              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding a changeset!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant