Skip to content

[build-tools] Share remote session teardown across the automation steps - #4431

Open
vonovak wants to merge 4 commits into
codex/session-host-finish-policyfrom
codex/session-teardown-helper
Open

vonovak wants to merge 4 commits into
codex/session-host-finish-policyfrom
codex/session-teardown-helper

Conversation

@vonovak

@vonovak vonovak commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Why

The Agent Device, Appium and Argent steps each had their own teardown. When teardown failed, its error replaced the error that had ended the session, in all three steps.

How

finishRemoteSessionAsync runs every teardown, logs each failure, and rethrows the first one only when the session itself succeeded. All three steps use it.

Each step hands it independent entries: the tunnel close, the collector stop with the process stop in a finally, and the host finish. Before, one entry ran them in sequence, so a rejected Appium collector stop left the Appium process running.

Stack 4/6, based on #4430, followed by #4435#4441.

Test plan

The orchestration tests fail teardown while the session body fails at each phase and assert the body error reaches the caller. Each case failed before this change. A new case rejects the collector stop and asserts the process stop and host finish still run; it failed for Appium before the change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D29AEWN9ajZXbzobHUH4fF

@vonovak
vonovak added this pull request to stack #4421 September 17, 2026 15:18
@vonovak vonovak changed the title codex/session teardown helper [build-tools] Share remote session teardown across the automation steps Sep 17, 2026
@vonovak
vonovak marked this pull request as ready for review September 17, 2026 15:18
@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.42%. Comparing base (30d558b) to head (e780c40).

Files with missing lines Patch % Lines
...ls/src/steps/functions/startArgentRemoteSession.ts 78.58% 3 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                          @@
##           codex/session-host-finish-policy    #4431      +/-   ##
====================================================================
+ Coverage                             72.42%   72.42%   +0.01%     
====================================================================
  Files                                   973      973              
  Lines                                 46363    46369       +6     
  Branches                               9956     9953       -3     
====================================================================
+ Hits                                  33574    33580       +6     
  Misses                                11794    11794              
  Partials                                995      995              

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

vonovak and others added 3 commits September 18, 2026 12:19
The error that ended the session must reach the step, not the teardown error.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D29AEWN9ajZXbzobHUH4fF
The Agent Device, Appium and Argent steps each ran Promise.allSettled over
their teardown and rethrew the first rejection from a finally block, which
replaced the error that had ended the session. One helper now runs every
teardown, logs each failure, and rethrows only when the session body succeeded.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D29AEWN9ajZXbzobHUH4fF
Its module mock listed every export by hand, so the new helper was undefined
and a teardown rejection escaped as an unhandled error.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D29AEWN9ajZXbzobHUH4fF
@vonovak
vonovak force-pushed the codex/session-teardown-helper branch from 167cd84 to 13aa75c Compare September 18, 2026 10:19
A rejected event collection stop no longer leaves the automation process
running. The tunnel close, the collector-then-process pair and the host
finish are separate teardown entries; the process stop sits in a finally.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D29AEWN9ajZXbzobHUH4fF
@vonovak
vonovak force-pushed the codex/session-teardown-helper branch from 28a9cd5 to e780c40 Compare September 18, 2026 11:17
@github-actions

Copy link
Copy Markdown

⏩ The changelog entry check has been skipped since the "no changelog" label is present.

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

Labels

no changelog PR that doesn't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant