Skip to content

[build-tools] Forward warm agent-device daemon logs - #4883

Open
gwdp wants to merge 11 commits into
gwdp/serve-sim-server-log-forwardingfrom
gwdp/warm-agent-device-daemon-logs
Open

gwdp wants to merge 11 commits into
gwdp/serve-sim-server-log-forwardingfrom
gwdp/warm-agent-device-daemon-logs

Conversation

@gwdp

@gwdp gwdp commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Why

Warm agent-device daemon logs are missing from the session's controller step.

How

Forward new daemon output into the existing controller step with token redaction. Keep serve-sim output in the Simulator preview step. Stop both readers during cleanup without masking Simulator cleanup failures; do not replay earlier preparation output.

Validation

Routing/cleanup tests, typecheck, lint, formatting, and CI passed. Devin found no issues at the current head. Hosted validation is pending.

Reviewed by Gabe. Implementation and tests by Codex. — Codex

@gwdp

gwdp commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex implemented the logging changes and tests described above. Gabe reviewed this PR. CI is green; hosted validation remains pending. Devin review is settled with no open findings.

— Codex

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (gwdp/serve-sim-server-log-forwarding@4456980). Learn more about missing BASE report.

Additional details and impacted files
@@                           Coverage Diff                           @@
##             gwdp/serve-sim-server-log-forwarding    #4883   +/-   ##
=======================================================================
  Coverage                                        ?   77.52%           
=======================================================================
  Files                                           ?     1135           
  Lines                                           ?    57778           
  Branches                                        ?    12830           
=======================================================================
  Hits                                            ?    44784           
  Misses                                          ?    12873           
  Partials                                        ?      121           

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

gwdp added 7 commits November 13, 2026 01:31
…ent-device-daemon-logs

# Conflicts:
#	packages/build-tools/src/steps/utils/__tests__/warmIosSession.test.ts
#	packages/build-tools/src/steps/utils/warmIosSession.ts
…ent-device-daemon-logs

# Conflicts:
#	packages/build-tools/src/steps/utils/__tests__/warmIosSession.test.ts
…ent-device-daemon-logs

# Conflicts:
#	packages/build-tools/src/steps/utils/warmIosSession.ts
@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

devin-ai-integration[bot]

This comment was marked as outdated.

@gwdp
gwdp marked this pull request as ready for review November 20, 2026 06:03
@gwdp
gwdp requested a review from szdziedzic November 20, 2026 06:03

@szdziedzic szdziedzic left a comment

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.

Requesting changes on #4883:

  1. The new daemon log reader inherits the /usr/bin/tail -n 0 -F issues flagged on base PR #4881 (pathname following on inode swap, -n 0 startup race, silent async spawn/exit failures, and omitted { err } on warnings). Reusing the shared descriptor-based helper from #4881 will address all of these together.
  2. Appending agentLogReader to warm.process.getOutput() mixes agent-device daemon output into preview readiness/control errors attributed to serve-sim.

Live step routing, token redaction before forwarding, secondary-device preparation timing, and teardown order (draining artifacts before stopping the warm host and stopping both readers via Promise.allSettled) all look solid.

Two quick questions alongside the inline comments:

  1. Does agent-device ever rotate or truncate <stateDir>/daemon.log mid-session, and is daemon.log guaranteed to exist before prepare ios-runner exits?
  2. Has a hosted warm iOS run verified a post-preparation daemon line appearing in the controller step?

@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp

gwdp commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Codex follow-up: agent-device now uses the same reader and keeps daemon output in the controller step. Preview errors retain serve-sim output only.

In the agent-device versions I checked, the daemon opens its log before spawn and truncates it during registration. I found no periodic rotation in that lifecycle. Local tests verified step routing and cleanup. A hosted post-preparation log line is still unverified.

— Codex

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Devin Review

Comment on lines +141 to +145
agentLogReader = followWarmLog({
file: path.join(claim.agentDeviceStateDir, 'daemon.log'),
logger,
secrets: logSecrets,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Daemon forwarding depends on file lifetime

followWarmLog opens the file once and keeps reading the same inode. Hosted validation needs to verify that daemon.log already exists after preparation and stays on that inode throughout the session.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

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.

I checked the released agent-device source. It opens daemon.log before spawning the daemon, and preparation waits for the runner. I found no ongoing rotation in that daemon lifecycle. If the log is unavailable at attachment, the worker warns and preserves the session. Hosted confirmation of inode lifetime remains open.

— Codex

@github-actions

Copy link
Copy Markdown

✅ Thank you for adding a changeset!

@gwdp

This comment has been minimized.

@devin-ai-integration

This comment has been minimized.

@gwdp
gwdp requested a review from szdziedzic November 27, 2026 08: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.

2 participants