Skip to content

[build-tools] Stop agent-device artifact polling before daemon shutdown - #4115

Closed
szdziedzic wants to merge 2 commits into
mainfrom
szdziedzic-codex/stop-agent-device-artifact-poll
Closed

[build-tools] Stop agent-device artifact polling before daemon shutdown#4115
szdziedzic wants to merge 2 commits into
mainfrom
szdziedzic-codex/stop-agent-device-artifact-poll

Conversation

@szdziedzic

Copy link
Copy Markdown
Contributor

Why

Follow-up to #4114.

The agent-device artifact poller was launched as a detached, unconditional loop. Once the remote session ended, teardown stopped the daemon but the poller kept requesting its artifact endpoint forever, producing repeated failures and periodic Sentry reports.

How

  • Give the artifact poller a required abort signal and propagate it to the daemon inventory request.
  • Make the five-second polling delay abortable.
  • Combine the build-step signal with a dedicated lifecycle controller.
  • Abort and await polling before stopping the daemon.
  • Keep daemon cleanup in a nested finally so an earlier preview or tunnel cleanup failure cannot leave the poller and daemon running.
  • Report unexpected polling shutdown failures without skipping daemon shutdown.

Test Plan

  • corepack yarn test src/steps/utils/__tests__/agentDeviceArtifacts.test.ts src/steps/functions/__tests__/startAgentDeviceRemoteSession.test.ts --runInBand (11 tests)
  • corepack yarn typecheck in packages/build-tools
  • Type-aware Oxlint on all modified files
  • Oxfmt check on all modified files

@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.82353% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.25%. Comparing base (f145ed7) to head (9a61baf).

Files with missing lines Patch % Lines
...c/steps/functions/startAgentDeviceRemoteSession.ts 45.46% 10 Missing and 2 partials ⚠️
...uild-tools/src/steps/utils/agentDeviceArtifacts.ts 83.34% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4115      +/-   ##
==========================================
+ Coverage   62.25%   62.25%   +0.01%     
==========================================
  Files         994      994              
  Lines       44820    44843      +23     
  Branches     9425     9431       +6     
==========================================
+ Hits        27897    27913      +16     
- Misses      15474    15481       +7     
  Partials     1449     1449              

☔ 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.

@szdziedzic szdziedzic closed this Jul 30, 2026
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