Repository navigation
🤖 refactor: instructions and the home-clutter reminder read the host through HostFiles, HostPaths and HostClock - #7371
Merged
Merged
Conversation
…through HostFiles, HostPaths and HostClock instructionFiles.ts, systemMessage.ts, homeClutterWatch.ts and tools.ts call the host through nodeHostFiles and nodeHostPaths (5a PR 5), and the timeout of HomeClutterReminderSource runs on the session's HostClock (phase 3). Behavior does not change: the Node layers read the same fs/promises, os and getXumHome bindings at each call. 5b PR 7 of phase 5 (Loop host I/O) of the agent-loop refactor.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
🟢 e2e stories (Haiku): 14 passed27 agent steps · 7 replayed from cache · 31 model calls · 218.7k tokens (70% cached) All 14 tests in 9 files
e2e 0.20.0 · 3m 9s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 8.0k tokens (32% cached) All 3 tests in 3 files
e2e 0.20.0 · 19.4s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 5.3s · 2 targets (web, phone) · run artifacts |
This was referenced Oct 23, 2026
yermakoffivan
pushed a commit
to yermakoffivan/mux
that referenced
this pull request
Oct 26, 2026
… scans (coder#7491) ## Summary Two wall-clock reads next to HostClock code now take their time from the caller's clock: the notification poll after each tool call, and the clutter scanner's start time. In the app both clocks are `nodeClock`, so behavior does not change. Under a test HostClock, the poll's `now` and the sources' own times now come from one clock. ## Items of coder#7282 in this PR | Item | Result | | --- | --- | | `src/common/utils/tools/tools.ts`: `pollAfterToolCall({ now: Date.now() })` after each tool call (found in the review of coder#7371) | Done. The wrapper takes the session clock (`config.clock ?? nodeClock`), the clock the home clutter source already uses. | | `src/node/runtime/homeClutterWatch.ts`: the `Date.now()` defaults of `scan()` and `busyForMs()` (found in the review of coder#7371) | Done. Both take `now` from the caller. The only caller, `HomeClutterReminderSource`, already passes `clock.nowMs()`. | The other open items of coder#7282 are not in this PR. The issue update after the merge lists their results. ## Validation - The new test "a tool call polls the notification sources with the session clock's time" fails on `main`: the poll gets the wall time instead of the TestClock start. It also covers the failure path of the wrapper. - A new `busyForMs` test checks that the busy time counts from the time passed to `scan`, and is 0 when idle. - `make mutate-check`: 17 killed, 4 equivalent (each marked with its reason), 0 survived. Refs coder#7282 Gates on `f9d0b6841c`: `make static-check`, `make lint-eslint`, `make test` (0 failures), crap, DRY and mutation checks, loop-test tripwire RUNS=3 against `origin/main`: 0 trips. --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$89.45`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=89.45 -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
5b PR 7 of phase 5 (Loop host I/O) of the agent-loop refactor. The instruction readers and the home-clutter reminder reach the host through the phase 5 and phase 3 services:
instructionFiles.tsandhomeClutterWatch.tsread files throughHostFiles(🤖 refactor: HostFiles and HostPaths services with Node and memory layers #7319).systemMessage.tsandtools.tstake the user home and the Xum home fromHostPaths(🤖 refactor: HostFiles and HostPaths services with Node and memory layers #7319).HomeClutterReminderSourcearms its scan timeout on the session'sHostClock(phase 3).The five files import no
fs,fs/promisesorosany more, andsystemMessage.tsno longer importsgetXumHome. Behavior does not change: the Node layers read the samefs/promisesandosnamespaces and callgetXumHomeat each call, so theos.homedirspies ofsystemMessage.test.tsandinstructionsService.test.tsstill apply. None of the five files is in thelocal/no-host-importsfile set, so the frozen pairs do not change.Order
Plan order: stack 5b is PR 1 to PR 9, and this PR comes after 5b PR 6 (#7322, merged).
Landing order: this PR lands ahead of 5b PRs 2 to 5, by rule 2 of plan note 1. Those PRs wait for phase 4 and phase 2 PRs that have not merged. This PR waits only for 5a PR 5 (#7319, merged) and phase 3 PR 1 (#7270, merged), and it uses no code of 5b PRs 2 to 5. So it opens on its own, with base main. No open phase 2 to 5 PR changes these five files.
Implementation
utils/main/instructionFiles.ts: the local file reader callsnodeHostFiles.promises.readFile.runtime/homeClutterWatch.ts: the defaultreadDircallsnodeHostFiles.promises.readdir.services/systemMessage.ts: the Claude-compat global dir comes fromnodeHostPaths.userHome(). The global instruction set, the settingsconfig.jsonpath and its directory come fromnodeHostPaths.xumHome().agentNotifications/sources/HomeClutterReminderSource.ts: the constructor takes an optionalclock(absent:nodeClock, as for tool configs that tests build by hand). The scan timeout callsclock.setTimer, and the scan start times come fromclock.nowMs().common/utils/tools/tools.ts: the reminder getsnodeHostPaths.userHome()andconfig.clock.The plan estimated about 320 lines for this PR. It adds 71 lines and removes 21, because no caller passes its own
HostFilesorHostPathsyet (the same reason as in 5b PR 6).Validation
HomeClutterReminderSource.test.ts: a new case runs a poll on a stuck scan with the TestClock. The poll is still open at 249 ms of TestClock time and ends at 250 ms, with no real wait. With the timer pointed back atnodeClock, the case fails.instructionFiles,systemMessage,instructionsService,homeClutterWatch,HomeClutterReminderSource) plustools.test.ts: 135 pass, 0 fail.make static-check,make lint-eslint,make dry-check,make crap-check.make test(host suite lock) on head c9af576:bun test srchad 27679 pass, 7 skip and 1 fail. The fail isrenderer first load > the entry's static imports do not reach the tool definitions module, which fails the same way on main 2e2a2b7 (I ran it there alone).make teststops at the first failing run, so I ran its other steps by hand: the shared scripts/storybook/vscode run (729 pass, 0 fail) and each of the 18 isolated files (0 fail).make static-check, and the plan's tests plustools.test.tsandrendererFirstLoad.test.ts: 138 pass, 0 fail.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$112.49