Skip to content

[build-tools] Separate agent-device and simulator preview logs - #4585

Merged
gwdp merged 5 commits into
mainfrom
gwdp/serve-sim-agent-device-logs
Oct 15, 2026
Merged

gwdp merged 5 commits into
mainfrom
gwdp/serve-sim-agent-device-logs

Conversation

@gwdp

@gwdp gwdp commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

Keep agent-device controller output and its simulator preview in separate log phases.

How

  • Keep serve-sim output in its own preview phase while the agent-device controller step stays active.
  • Share credential redaction across both startup paths.
  • Drain preview output before closing its phase, and keep uploads in the controller step.

Test Plan

  • CI passed on the current head.
  • Tested the full stack locally with Gabe: EAS CLI, Universe API/workflow worker, build-tools and serve-sim 0.6.3 on an iPhone 17 Simulator. The website preview, remote Settings navigation and log ingestion worked.
Earlier and automated validation

After restacking, Codex ran 57 focused tests and built all 13 EAS packages successfully. Earlier focused tests, typecheck, lint and formatting passed; Claude reviewed correctness and cleanup ownership.

Earlier launch E2E covered Universe-generated steps through build-tools download/install/start to serve-sim on a real iOS Simulator, checking one app start, launch arguments and the deep link. Those runs used loopback cloud tunnel/reporting adapters and a pinned local build/device. The local website session used real ngrok tunnels; hosted EAS execution was not tested.

Screenshots Screenshot 2026-10-09 at 3 55 38 PM Screenshot 2026-10-09 at 3 55 47 PM Screenshot 2026-10-09 at 3 56 17 PM

Authorship and LLM use

Gabe wrote the initial implementation, directed the iterations and requested the split once he was happy with the result. Codex made fixes, split the PRs and updated this description; Claude and Devin reviewed. The reviews led to redaction and shutdown refinements. Gabe reviewed the final code through #4601 and tested the local website flow for these logging changes.

@gwdp

This comment has been minimized.

@codecov

This comment has been minimized.

@gwdp
gwdp force-pushed the gwdp/serve-sim-agent-device-logs branch from 2b1ff95 to 068f946 Compare October 9, 2026 19:49
@gwdp
gwdp force-pushed the gwdp/serve-sim-agent-device-logs branch from 068f946 to e705964 Compare October 9, 2026 22:59
@gwdp

gwdp commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex separated agent-device and simulator-preview logging, preserved credential redaction, and restacked the layer under Gabe's direction. Gabe reviewed the final code through #4601 and tested the local website flow. Current-head CI is green; screenshots and local test evidence are preserved.

— Codex

@gwdp
gwdp marked this pull request as ready for review October 9, 2026 23:20
@gwdp
gwdp requested a review from szdziedzic October 9, 2026 23:21
@gwdp
gwdp added this pull request to stack #4599 October 10, 2026 00:26
@gwdp
gwdp removed this pull request from stack #4599 October 10, 2026 08:38
@gwdp
gwdp added this pull request to stack #4604 October 10, 2026 08:40
@gwdp
gwdp removed this pull request from stack #4604 October 10, 2026 16:54
@gwdp
gwdp added this pull request to stack #4606 October 10, 2026 16:55
@gwdp

This comment was marked as outdated.

@devin-ai-integration

This comment was marked as outdated.

Comment on lines +618 to 620
const previewRetired = await retirePreview;
onStopped(hostStopped && !hostExited && previewRetired);
await screenshots.finishAsync(hostStopped);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we include the background macOS encoder setup in the preview phase's shutdown accounting? If the session finishes while ensureMacosPreviewEncoderInstalledAsync is still pending, onStopped() emits END_PHASE, but Homebrew output and the setup catch handler continue writing through the same phase logger afterward.

I reproduced this by deferring encoder setup, awaiting host.finishAsync(), then emitting output and rejecting setup: both the output and “Could not start refreshing the session preview” warning appeared after END_PHASE.

Please retain the setup task, make its subprocess cancellable, and cancel/drain it before ending the phase, while keeping readiness nonblocking. A test covering late output and late rejection would protect this ordering. I checked the downstream code through #4601; it still has this path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 594435a62.

The host now retains encoder setup, cancels its owned subprocess group during shutdown, and waits for setup/output drain before ending the preview phase. Readiness stays nonblocking; expected shutdown cancellation does not emit a failure warning.

The late-success and late-failure ordering regressions fail before this fix and pass afterward. All 173 related tests pass, including a real Node parent/descendant fixture, plus build-tools typecheck, changed-file lint/format and changeset validation. No new native or hosted acceptance was run.

— Codex

@douglowder

Copy link
Copy Markdown
Contributor

eas-cli now uses changesets for changelogs (#4580). The required "Check for a changeset" check fails on PRs that edit CHANGELOG.md.

To update this PR:

  1. Revert the changes to CHANGELOG.md.
  2. Run yarn changeset, select the changed packages and the bump type, and write the summary.
  3. Commit the new file in .changeset/.

The release adds the PR link and the author to the entry. If this PR needs no changelog entry, revert the CHANGELOG.md changes and add the "no changelog" label.

@gwdp

gwdp commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Rebased this layer onto gwdp/serve-sim-server-log-artifact and moved its release note from CHANGELOG.md into its own changeset. Current-main behavior was preserved.

Validation: focused build-tools tests, changeset validation, changed-file lint/format and build-tools typecheck passed. No new native or hosted acceptance was run for this restack.

Published head: f92bce4fcfb3509f3d206ca51b2a6c974a27cfb9.

— Codex

@gwdp
gwdp force-pushed the gwdp/serve-sim-agent-device-logs branch from ecd6e28 to f92bce4 Compare October 15, 2026 01:23
Base automatically changed from gwdp/serve-sim-server-log-artifact to main October 15, 2026 03:34
@gwdp
gwdp force-pushed the gwdp/serve-sim-agent-device-logs branch from f92bce4 to af8874c Compare October 15, 2026 03:34
@gwdp

gwdp commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Implemented the encoder setup cancellation/drain fix in 594435a62 at Gabe’s direction, after local self-review and two independent source reviews. The new tests cover phase closure ordering and subprocess output drain; 173 related tests and the local static checks pass.

— Codex

@gwdp

gwdp commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Simplified the tests in 3e8173f9a at Gabe’s request: removed the extra encoder subprocess harness and both fixture files. The focused cancellation and log-phase ordering regressions remain; production code is unchanged.

All 177 related tests, including existing shared subprocess tests, and build-tools typecheck pass.

— Codex

@github-actions

Copy link
Copy Markdown

✅ Thank you for adding a changeset!

@gwdp
gwdp merged commit 6d8c29c into main Oct 15, 2026
10 checks passed
@gwdp
gwdp deleted the gwdp/serve-sim-agent-device-logs branch October 15, 2026 05:09
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.

3 participants