Repository navigation
🤖 tests: close the four clock lint gaps of the agent-loop ratchet - #7490
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3af4ba3fef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🟢 e2e stories (Haiku): 14 passed27 agent steps · 9 replayed from cache · 24 model calls · 137.2k tokens (68% cached) All 14 tests in 9 files
e2e 0.20.0 · 2m 23s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 7.9k tokens (33% cached) All 3 tests in 3 files
e2e 0.20.0 · 21.9s · 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 |
…and treat global like globalThis
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b71e0105ae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… timers } imports
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42567a0ee1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…t() and static computed timer members
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a0dfcc45d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…olve require by binding
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25dd4e69cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Refs coder#7282 ## Summary The 3 turn durations (stream end, stream abort, startup abort) now measure on the stream's HostClock instead of the wall clock. Under a test HostClock, a test that advances the TestClock now sees exactly that time in each `duration`. ## Background coder#7282: under a test HostClock, some comparisons mixed two clocks. The last open items were the 3 durations that moved from `streamManager.ts` into `turnEngine/`: | Duration | Place | Before | After | |---|---|---|---| | stream end | `streamManager.ts` buildStreamEnd usage | `nodeClock.nowMs() - startTime` | `hostClock.nowMs() - durationStartMs` | | stream abort | `turnEngine/AttemptLoop.ts` cleanupAbortedStream | same | same | | startup abort | `turnEngine/TurnRegistry.ts` startup stop | `nodeClock.nowMs() - pending.startTime` | `hostClock.nowMs() - pending.durationStartMs` | ## Implementation 1. The stream record and the pending startup get a second start field, `durationStartMs`, read from StreamManager's existing `hostClock` (`hostClockFor(runner)`). 2. `startTime` stays on the wall clock. It is a record time: the assistant row stamp, the `stream-start` event and the `starting-<startTime>` synthetic id use it. 3. TurnEngine, TurnRegistry and AttemptLoop take `hostClock` as a dep. Out of scope (stays on the wall clock): the assistant and user row stamps. Their consumers (heartbeatService, compaction boundaries in agentSession, taskService, workspaceGoalService, workspaceService, refineService, the renderer timeline) compare them with wall-clock reads. Moving the assistant stamp alone would sort it before the user row of the same turn under a TestClock. coder#7282 keeps that residual and the 4 lint follow-ups from coder#7490. ## Validation New `streamManager.durations.test.ts` (TestClock, no sleeps). On main the 3 tests fail: 12, 8 and 0 ms instead of 90000, 45000 and 30000. With the fix they pass. The existing wall-clock abort test in `streamManager.usage.test.ts` still passes, because the live HostClock is the wall clock. ## Risks Low. In production the HostClock is the wall clock, so the durations are unchanged. A stream record built without `durationStartMs` (only partial test fixtures) would report `NaN`. Typecheck requires the field on every real construction. --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$279.60`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=279.60 -->
Summary
The three clock lint rules of the agent-loop refactor now catch the four forms that review of #7272 found missing. Each gap has its own rule test, which fails on the rules of
mainand passes here. No file in the rules' lists uses a new form except one, and it gets an allow entry with a reason. Lint only: app behavior does not change.Items of #7282 in this PR
local/no-raw-clockmisses timers imported under another name;local/no-host-importsdoes not listtimersortimers/promisestimersandtimers/promises(named, namespace and default), and both configs list both modules as host modules.local/no-global-clock-patchmissesDate.now = () => tDate.noworglobalThis.Date.nowcounts as a patch.local/no-raw-clockmisses a directDate()calllocal/no-raw-clockdoes not countAbortSignal.timeout()tools/skillsCatalogFetch.ts, gets an allow entry of 1 (see below).Implementation
eslint-local-rules.mjs, which oxlint also loads, so the rule changes reach both linters. The module lists and allow maps are repeated ineslint.config.mjsand.oxlintrc.json.make check-oxlint-configpasses.Program, so a call above a hoisted import still counts. An unaliasedimport { setTimeout } from "timers/promises"counts once.Date,AbortSignalorrequirecounts only when it resolves to the host global, and a local value that shadowsDate,globalorglobalThisdoes not count. A type-only declaration such asinterface Datedoes not shadow the value. The rules also countrequire("timers")andawait import("timers")loads,{ default as timers }imports, static computed members such astimers["setTimeout"], and treatgloballikeglobalThis. Two shared helpers (memberName,isHostGlobal) hold this logic for all three rules.Reflect,evalor other dynamic access, soconst d = Date; d.now()passes. A comment atlocal/no-raw-clockrecords this.skillsCatalogFetch.tsallow entry: the search request bounds a network call withAbortSignal.timeout(). The file calls the module-level node host services, not injected ones, so it has no HostClock to arm the deadline on. ItsRAW_CLOCK_CEILINGentry records that the read was there when the ratchet landed.Validation
origin/main, the 5 new tests fail ("reports a Date() call", "reports AbortSignal.timeout()", "reports timers imported from the timers modules under another name", "reports a direct Date.now assignment ...", "the configured module list covers the timers modules"). With this PR, all 27 tests in the two rule test files pass. Each case that review rounds 1 to 4 added has a test that failed before its fix.AbortSignal.timeout()inskillsCatalogFetch.ts, so oxlint runs the new check.make lint-eslintlinted all files (the rule file changed) with no error.Refs #7282
Gates on
3af4ba3fef:make static-check,make lint-eslint,make test(0 failures), crap, DRY and mutation checks, loop-test tripwire RUNS=3 againstorigin/main: 0 trips.Gates on
8d1c71052e(review rounds 1 to 3):make static-check,make lint-eslint(all files),make test(0 failures).6a0dfcc45dadds only the Limits comment.Gates on
25dd4e69cc(review round 4, rule file and its tests only):make static-check,make lint-eslint(all files), the 27 rule tests.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high