Skip to content

refactor(daemon): resolve configuration from the owning runtime host - #3826

Merged
thymikee merged 4 commits into
mainfrom
chore/process-globals-daemon
Oct 19, 2026
Merged

thymikee merged 4 commits into
mainfrom
chore/process-globals-daemon

Conversation

@thymikee

@thymikee thymikee commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Part of #3753. Part of #3747.

Pass the runtime host through SessionStore, session journals, artifact paths, idle expiry, HTTP setup, and daemon callers. Remove daemon ambient configuration reads. Required caller and test plumbing touches 136 files (2,087 gross lines). The TV remote fixture explicitly disables unrelated IME setup so building Android artifacts does not exhaust its test timeout.

Bottom layer of daemon → replay/device-selection → runtime → commands → R86. #3823 remains the top gate PR. Rebased onto a661e43d83, including #3818 and #3820.

The progress fixture now passes explicitly ordered files instead of assuming directory enumeration order.

Validation

Head 288e6cceaec5d2e52fd619499465aec6e1f429a4.

pnpm check:affected --run --head 288e6cceaec5d2e52fd619499465aec6e1f429a4 passed; receipt run-0o0t8g, exactCommit=true.

Coverage failures were fixture races: 7e2cae20ed replaces a directory-order assumption with explicit files; 288e6cceae waits for bridge evidence contents rather than file creation. Both fixes are inherited by all layers. Upper patches are unchanged by range-diff.

Prior full-check and Android daemon/provider evidence stays attributed to e223d37244 in #3823’s review-response comment. This round changes only test fixtures and ancestry. Full coverage and GitHub-owned lanes remain CI obligations.

View guided diff Turn on auto-fix

thymikee and others added 2 commits October 19, 2026 17:52
… not the process (#3753)

Every daemon and session-journal module that read `process.env` or
`process.cwd()` now takes the runtime `HostEnvironment` its owner already
holds. `SessionStore` receives the host at construction and hands its cwd to
`SessionScriptWriter`, the recorder, and the replay coordinator; the event-log
cap, idle-reap window, and session-idle expiry take their env as a required
parameter; the HTTP server's env and cwd are required options and reach the
download-archive spawn explicitly. No behavior changes: the daemon always
passed exactly these values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The D-pad fixture does not model IME registration. Explicitly opt out so building Android artifacts cannot turn this scenario into an unrelated helper readiness wait.

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

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.44 MB 5.44 MB +299 B
Package (unpacked) 5.44 MB 5.44 MB +299 B
Package (download) 1.64 MB 1.64 MB +174 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 44.2 ms 41.9 ms -2.3 ms
CLI --help 82.1 ms 79.5 ms -2.6 ms

Pass explicit source files so progress event expectations do not depend on native directory enumeration order.

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

Copy link
Copy Markdown
Member Author

Coverage follow-up: 7e2cae20ed fixes the daemon progress fixture by passing explicit files; the failing assertion assumed filesystem directory order. Cold self-review found no issue in the four-line fixture diff; no additional independent reviewer this round. Foreground check:affected passed at 7e2cae20ed (run-iu9AIj, exactCommit=true). CI is running on the pushed head.

File creation precedes the shell write, so poll the expected cwd evidence rather than file existence.

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

Copy link
Copy Markdown
Member Author

Second coverage fix: 288e6cceae polls the detached bridge’s expected cwd contents; the shell creates the evidence file before writing it, and CI read an empty file (run 39289751890). Head 288e6cceae inherits both this fix and 7e2cae20ed; upper-layer range-diff is unchanged. Foreground check:affected passed (run-0o0t8g, exactCommit=true). Cold self-review found no issue in the test-only diff. CI is running on this head.

@thymikee

Copy link
Copy Markdown
Member Author

The code looks ready at 288e6cc. I found no problems in the change. Configuration now resolves from the owning runtime host, and I saw no change in behavior.

Not blocking: SessionStore now exposes a public host, and five handlers read sessionStore.host.cwd while the router and SessionCommandHandler already receive their own host, so one value travels through two channels (session-store.ts#L66); the doctor checks pass a positional useColor through about 20 call sites, and one check appender built in handleDoctorCommand would remove that churn (session-doctor.ts#L75); the unit suites use createLiveTestHostEnvironment(), so no test would fail if a path read process.cwd() instead of host.cwd, and one router-level test with createTestHostEnvironment({cwd: tmp}) would cover it (host-environment.ts#L11). You can take or leave these.

CI on 288e6cc is still running: 8 jobs are queued or in progress, including Coverage, Integration Tests, Smoke and Repo Guards, and none has failed yet. The latest head only changes the apple host.test.ts wait, after an earlier Coverage race in run 39289751890, so please check Coverage once it finishes. There are no conflicts. Once CI passes, nothing else blocks the merge.

I did not run the tests or check:affected. The receipt run-0o0t8g is your claim, and I did not re-check it. I did not look at the upper stack PRs (3827-3829, 3823), and I did not re-read the earlier Android daemon and provider evidence. The behavior argument assumes nothing in production code changes process.env after startup. I based that on a grep for assignment and delete patterns, so indirect changes could slip past it.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 19, 2026
@thymikee
thymikee merged commit df066e2 into main Oct 19, 2026
15 of 16 checks passed
@thymikee
thymikee deleted the chore/process-globals-daemon branch October 19, 2026 17:43
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-19 17:43 UTC

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

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant