Skip to content

ci: cut setup, cache and test waiting from CI - #241

Merged
NightRain233 merged 8 commits into
mainfrom
claude/ci-speedup-014f72
Nov 19, 2026
Merged

NightRain233 merged 8 commits into
mainfrom
claude/ci-speedup-014f72

Conversation

@NightRain233

@NightRain233 NightRain233 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Cuts CI time by removing work: dependency setup, oversized Go caches and real waits in tests. Parallelism and checks are unchanged, except that the web tests run as 2 shards instead of 3.

Changes

  • node_modules cache (.github/actions/setup). Every Node job restored the 443 MB pnpm store (~10 s) and then spent ~10 s linking it. The installed tree (node_modules plus each workspace package's) is now cached under an exact key: lockfile, pnpm-workspace.yaml, .npmrc, patches, every workspace package.json, Node version, OS and arch. There are no restore-keys. On a hit no store is restored. pnpm install --frozen-lockfile still runs and prints "Already up to date"; pnpm's supply-chain policy check (~5 s) still runs too. On a miss the job installs from the store as before. Only repository-gate saves the entry, on pushes to main, right after install and before any check writes into node_modules.
  • Shallow checkout where BASE is unused. changes, repository-gate, web-static and check (teamhub) keep fetch-depth: 0. The other jobs fetch only the commit under test. None of their make targets reads BASE or git history. The setup step that checks BASE's merge base skips shallow clones. Anything there that starts using BASE then fails on the unknown ref instead of comparing HEAD with itself.
  • Go build cache keeps only the entries this run used (.github/actions/check). Each Go job's cache accumulated five days of main pushes: teamhub 1075 MB, desktop 661 MB, computer-go 444 MB. Their copies added up to more than the repository's 10 GB cache limit. On pushes the job backdates the restored build cache by 2 h. Go refreshes an entry's mtime on use only once it is over an hour old. After a successful run, entries this run did not touch are deleted. The cache is content-addressed, so pruning can only cause misses. teamhub drops to 632 MB (~25 s → ~6 s restore) and computer-go to 219 MB.
  • Web tests: 3 shards → 2. Runner time goes from ~216 s to ~148 s per web change. The slower shard's job is 67–87 s, below the old slowest job (computer-go, 119 s) and close to web-static. One shard would be ~110 s of vitest plus setup, slower than today's slowest job.
  • internal/provider Go tests: 55 s → 15 s on Linux. Three Linux-only tests slept through the real 15 s authentication cap and 30 s per-stage discovery budget. Both are now plain package variables, like claudeTerminationGrace in native, that these tests lower tenfold and restore in t.Cleanup. They never run in parallel. A unit test pins the production defaults per platform. Production values are unchanged.
  • provider/native Go tests: ~30 s → ~21 s. Stop graces and fake process delays that only have to outlast a signal or an in-process write now run at 150–200 ms, still more than 100 ms wherever a process must react. The Pi park-probe tests keep their original sleeps because they reach the probe by time rather than by a signal. Stress runs in a Linux container passed: -count=20 at 2 CPUs and -count=10 at 1 CPU.
  • Repository gate ESLint dedupe. The changed-file ESLint now skips the directories in scripts/ci/app-linted-paths.txt. The owning app's CI check lints each of those directories in full with --max-warnings=0 whenever a path under it changes. Prettier and the English-only check still cover every changed file. Tests pin that check-plan selects a CI job for each prefix, and that the owning lint script lists the directory with --max-warnings=0.
  • desktop-release test: 7 s → 0.1 s. It waited out curl --retry 3 backoff on an unresolvable host. A missing file:// folder fails immediately and still proves the address stays out of the log.

Measurements

Baseline: main push run 44441997483, after #227. "After": this PR's run 44447958702, every cache hit. During measurement a temporary commit, since dropped, let pull requests save the caches; normally only main pushes save. Job wall time in seconds; runner noise between runs is about ±15 s.

job before after
repository-gate 92 72 (54–72 over 3 runs)
web-static 94 67 (67–93)
web tests 75 / 71 / 70 (3 shards) 67 / 81 (2 shards)
check (computer-go), tests not cached 119 77
check (teamhub) 59 (187 on a cold-ish run) 41
check (desktop) 82 73
check (packages) 81 76
check (contracts) 65 63
check (teamhub-cli) 64 52
check (installer) 42 43
sum of all jobs 926 726 (−22%)
slowest job 119 81

Per Node job, setup drops from ~27 s to ~18 s. That is ~6 s for the node_modules restore plus ~5 s for the install, which is almost all pnpm's supply-chain policy check.

Not done / follow-ups

  • Skipping pnpm install on a cache hit would save another ~5 s per job, but pnpm's verifyDepsBeforeRun then fails with "Patches were modified", because checkout gives the patch files new mtimes. The check stays on.
  • web-static is bound by ESLint (~50 s, typed rules; no-misused-promises alone is ~60% of rule time). ESLint's cache is unsafe with type-aware rules, so it stays uncached.
  • TestRuntimeMonitorPublishesCatalogFailureImmediately in internal/provider fails under -race on 1 CPU on main too, unchanged by this PR. CI does not run -race.

Required checks

No required check is renamed: repository-gate, check (web) and check (<app>) are unchanged. The shard jobs become web tests (1/2) and web tests (2/2). They feed check (web) and are not required checks themselves.

User wait path

Does not touch the user message → provider_ready path.

🤖 Generated with Claude Code

@NightRain233
NightRain233 force-pushed the claude/ci-speedup-014f72 branch 2 times, most recently from 97b171e to eb517df Compare November 19, 2026 02:59
@NightRain233
NightRain233 marked this pull request as ready for review November 19, 2026 02:59

@linger-review linger-review 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.

Approve with nits (1 P2, 1 P3)

Scope: base main, merge base ddc03f14, 3 commits, 13 files, reviewed at eb517dfe. The coderbook skill was loaded. ponytail-review and karpathy-guidelines were not loaded; I applied the linger review checklist's equivalent items directly. This review ran in a separate session.

Findings

P2

  • apps/computer/local-daemon/internal/provider/protocol_probe.go:28-42 copies an existing helper. probeTunable (newProbeTunable, get, set) matches codexTunable in apps/computer/local-daemon/internal/provider/native/codex_process.go:33-46 line for line; only the name differs. The repo's rule is to share a helper rather than copy it, and the two copies can now drift. Two simpler options:
    • If no probe goroutine outlives the test that lowered the budget, use plain package variables. The scaled tests run sequentially and restore the values in t.Cleanup. This matches how claudeTerminationGrace is lowered in native/claude_resident_unix_test.go:76. Example: var authProbeCap = 15 * time.Second, plus a discoveryStageBudget variable set from defaultDiscoveryStageBudget(runtime.GOOS).
    • If the atomic is needed, move one tunable type into a small internal package and use it from both provider and provider/native.

P3

  • Commit 28b47929 bundles four independent changes. It contains the node_modules cache, the shallow checkouts, the Go build-cache pruning and the 3→2 web shard change. Each can regress on its own; the shard count is a cost trade-off and the cache pruning is a separate cache-policy change. Because main takes rebase merges, none of them can be reverted alone. Splitting the commit by feature would follow the repo's one-problem-per-commit convention.

Verified as fine

  • Shallow checkouts. check-packages, check-teamhub-cli, check-installer, check-desktop, check-contracts, check-computer-go and check-web-tests read neither BASE nor git history (Makefile:109-180, contracts-verify, build-daemon.mjs). repository-gate, web-static (React Doctor --base), changes and check (teamhub) (doc-comment lint) keep fetch-depth: 0. The setup action's early exit on shallow clones only skips the merge-base fallback. A job that starts using BASE would then fail on the unknown ref rather than compare HEAD with itself, as the comment says.
  • node_modules cache.
    • The restore and save paths are identical, which matters because the cache version hashes them. They match pnpm-workspace.yaml's apps/*, packages/* and contracts/generated/typescript globs.
    • The key covers the lockfile, workspace manifests, root package.json (and so pnpm's packageManager), patches, .npmrc, Node version, OS and arch. No restore-keys means a partial tree is never restored.
    • Only repository-gate saves, and only on push. The workflow runs on pushes to main only, so pull requests cannot write an entry other jobs restore.
    • The save runs before make check-repository-gate, so .vite and other tool caches stay out of the entry.
    • setup-node's pnpm store is still used on a miss. pnpm install --frozen-lockfile still runs on a hit.
  • Go build cache pruning.
    • The method holds: backdate everything by 2 h, run the check, then delete entries older than 60 min. Go refreshes an entry's mtime on Get/OutputFile only when it is older than mtimeInterval (1 h), so the entries this run used are the only recent ones.
    • A pruned -a entry or -d output is a cache miss in Go, not a wrong result. Go recreates a deleted trim.txt and README.
    • None of the touched targets overrides GOCACHE (checked apps/computer/run-test.sh and apps/teamhub/Makefile), so ~/.cache/go-build is the right directory.
    • Pruning runs only after success(). A failed run saves the unpruned cache, and the next successful push prunes it.
  • Production behavior unchanged.
    • boundedAuthTimeout still caps at 15 s.
    • The discovery stage budget is still 30 s on Linux and Windows and 15 s elsewhere.
    • TestProbeBudgetDefaults pins both values, including the boundedAuthTimeout edge cases.
    • The scaled tests do not call t.Parallel, so lowering the package-level values cannot leak into parallel tests.
  • Test timing margins. I ran the touched tests with -race on a host at load average about 169 (208 cores), and they passed:
    • go test -race -count=3 ./internal/provider -run 'TestProbeBudgetDefaults|TestCodexAuthenticationColdStartWithinLinuxBudget|TestDiscoverCodexColdInitializeWithinLinuxBudget|TestCodexAuthenticationFailureDiagnostics' passed in 18 s.
    • go test -race -count=2 ./internal/provider/native -run 'TestClaude|TestCodexSteer' passed in 150 s.
  • desktop-release.test.ts. curl does not retry a missing file:// path, so the run still reaches the cannot download path (scripts/ci/desktop-release.sh:151-152). The assertion still proves the folder name stays out of the output.
  • Docs. The shard count is updated in the ci.yml header comment, the Makefile comment and apps/web/AGENTS.md. Required check names are unchanged.
  • Unrelated changes. None found; every changed line traces to the stated goal of cutting CI time.

Process notes

  • The branch is 5 commits behind main. main requires up-to-date branches, so rebase before merging.
  • No merge commits and no fixup commits. The commit author is linked to the GitHub account NightRain233.

CI

All checks pass on eb517dfe, including repository-gate, web-static, web tests (1/2), web tests (2/2), check (web), every check (<app>) job and CodeQL. CI runs the computer daemon's Go tests without -race; I ran the touched provider tests with -race myself (results above). I did not run scripts/ci/desktop-release.test.ts locally; CI covers it.

Automated review by Claude Code


Automated review of eb517df by Claude Code.

@NightRain233
NightRain233 force-pushed the claude/ci-speedup-014f72 branch from eb517df to b415b4a Compare November 19, 2026 03:32
@NightRain233

Copy link
Copy Markdown
Contributor Author

Addressed review 5968739656:

  • P2: probeTunable is gone. authProbeCap and discoveryStageBudget are plain package variables. The scaled tests swap them and restore them in t.Cleanup, the same pattern as claudeTerminationGrace. They never run in parallel, and no probe outlives its test. go test -race -count=3 ./internal/provider/ passed in a Linux container. The only failure under 1-CPU -race was TestRuntimeMonitorPublishesCatalogFailureImmediately, which fails the same way on main.
  • P3: split the CI commit into four: node_modules cache, shallow checkouts, Go build cache pruning, and two web shards. The resulting tree is identical. Rebased on the latest main.

Also added since the review: shorter waits in the provider/native tests, stress-tested on Linux at -count=20 on 2 CPUs and -count=10 on 1 CPU, and the repository gate no longer re-lints directories that their app check lints in full.

@linger-review linger-review 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.

Approve with nits (0 P0, 0 P1, 0 P2, 1 P3)

Scope: follow-up on eb517df, reviewing b415b4a against main (merge base 71b4243). 8 commits and 23 files in the PR; review focused on what changed since eb517df: the commit split, the probe budget rewrite, and the new commits 25c894fb (repository-gate ESLint dedupe) and b415b4aa (shorter native test graces). Loaded coderbook, ponytail-review and karpathy-guidelines. Ran in a separate session.

Previous findings

  • P2 probeTunable duplicated codexTunable: Resolved. The type is gone. authProbeCap (apps/computer/local-daemon/internal/provider/protocol_probe.go:26) and discoveryStageBudget (discovery.go:110) are now plain package variables, following the claudeTerminationGrace pattern. scaleProbeBudgets swaps them and restores them in t.Cleanup.
  • P3 first commit mixed four independent changes: Resolved. It is now split into ab8551a6 (node_modules cache), a6f02938 (shallow checkout), 169bccb3 (Go build cache pruning) and ef813683 (two web shards).

Findings

P3

  • apps/computer/local-daemon/internal/provider/native/pi_resident_test.go:423 and :462: TestPiReleaseDuringParkProbe and TestPiSteerRacingParkIsRejected still sleep to reach the park probe. They do not wait on a signal. The margin past piSettleLaterDelay drops from 300 ms to 200 ms, and the delay itself drops to 150 ms, so the total wait is now 350 ms. On a loaded runner where the fake's settle reaches the run more than 350 ms after turn start, two things can happen. TestPiSteerRacingParkIsRejected unlocks writeMu before the turn settles, the steer is applied, and the test fails with steer = <nil>. The release test still passes but no longer exercises the park-probe race. The change saves about 0.4 s across these tests. Either keep the old margin or wait on an observable state, such as the turn's settled event, before taking the next step. This is optional: I ran both tests 3 times under -race and they passed.

Verified as fine

  • The plain-variable probe budgets are safe as used. No test in internal/provider calls t.Parallel. go test -race -count=1 ./internal/provider/ passes (21 s).

  • ESLint dedupe: check-changed-files.sh skips ESLint only in gate mode, when a third argument is passed. --worktree (local make check) still lints every changed file, and a new test pins this. All of the following lint with the single root eslint.config.mjs, so skipping the gate's per-file pass loses no rule coverage:

    • apps/web: src and e2e
    • apps/desktop: src and scripts
    • apps/teamhub-cli
    • apps/linger-installer: src
    • packages/document-files, packages/document-model, packages/knowledge-format, packages/service-kit
    • packages/local-installation: src

    Each listed prefix's owning lint script starts with eslint --max-warnings=0, covers the directory, and runs from that app's make check-<app> target (Makefile:117–180). The new tests pin both halves: check-plan selects a CI job for every prefix, and the owning lint script covers it. Files outside the prefixes, such as apps/web/vite.config.ts and scripts/*.mjs, are still linted by the gate, and the test asserts that too.

  • Native test graces: TestCodexInitializeCancelUnconfirmed now lowers codexStopGrace through the existing setter, which newCodexFake's cleanup restores. The other changes only shorten constants. The touched tests below pass under -race -count=3 (42 s): TestPiReleaseDuringParkProbe, TestPiSteerRacingParkIsRejected, TestCodexInitializeCancelUnconfirmed, TestClaudeCallerCancelDuringTurn, TestCodexStartupStallKillsTree and TestCodexNamesNewThreadAfterTurnStart.

  • The PR description matches the diff. Production probe values are unchanged (15 s cap, 30 s Linux/Windows stage budget), and TestProbeBudgetDefaults pins them per platform. The commit messages follow the conventions, and there are no merge or fixup commits.

Process notes

  • main is 1 commit ahead of the merge base, so the branch needs a rebase before it can merge. GitHub reports the merge state as BLOCKED.

CI

  • All checks pass, including repository-gate, check (computer-go), web tests (1/2), web tests (2/2), web-static and every app check.
  • CI does not run the daemon Go tests with -race. I ran the -race tests listed above locally on the touched packages, and they passed.

Automated review by Claude Code


Automated review of b415b4a by Claude Code.

NightRain233 and others added 8 commits November 19, 2026 11:45
Every Node job restored the 443 MB pnpm store and spent about 10 s linking
it. The installed tree (node_modules and each workspace package's) is cached
on an exact key: lockfile, workspace manifests and settings, patches, Node
version, OS and architecture. A hit skips the store, and the install only
verifies the tree; a miss installs from the store as before. Only
repository-gate saves the entry, on pushes to main, before any check writes
into node_modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
changes, repository-gate, web-static and check (teamhub) read BASE or git
history; the other jobs fetch only the commit under test. The setup step that
checks BASE's merge base skips shallow clones, so a job there that starts
using BASE fails on the unknown ref instead of comparing HEAD with itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each Go job's cache kept five days of main pushes (teamhub over 1 GB,
restored in about 25 s). On pushes the restored build cache is backdated by
two hours; Go refreshes an entry's mtime on use once it is over an hour old,
so after a successful run the entries still older than an hour went unused
and are deleted before the save. The cache is content-addressed, so pruning
can only cause misses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the web suite's CPU time dropped, three shards each spent more time in
setup than in tests. Two shards cut the runner time per web change from
about 216 s to 148 s; the slower shard's job (67-87 s) stays under the
slowest other job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iting out curl retries

The test pointed at an unresolvable host, so curl --retry 3 backed off for
about 7 s before the script failed. A missing file:// folder fails the same
download immediately and still proves the address stays out of the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… out production budgets

Three Linux-only provider tests slept through the real 15 s authentication cap
and 30 s discovery stage budgets, about 46 s of the package's 55 s on Linux.
The cap and the per-stage budget are package-level values that these tests
lower tenfold, and a unit test pins the production defaults per platform.
Native Runtime fakes wait less where the assertions are proportional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…epository gate

The gate linted every changed file, and for most of them the owning app's
check lints the same directory in full in the same CI run, with
--max-warnings=0. The gate now skips ESLint under the prefixes in
scripts/ci/app-linted-paths.txt; prettier and the English-only check still
cover every changed file. Tests pin that check-plan selects a CI job for each
prefix and that the owning lint script covers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…time tests

Several native Runtime tests waited out 300 ms to 1 s stop graces and fake
process delays that only have to outlast a signal or an in-process write.
They now use 150-200 ms, which still leaves more than 100 ms wherever a
process must react, and the codex initialize-cancel test lowers its 1 s fake
grace through the existing setter. The Pi park-probe tests keep their sleeps:
they reach the probe by time rather than by a signal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NightRain233
NightRain233 force-pushed the claude/ci-speedup-014f72 branch from b415b4a to 1cf211f Compare November 19, 2026 03:45
@NightRain233

Copy link
Copy Markdown
Contributor Author

Addressed review 5968982010 (P3): TestPiReleaseDuringParkProbe and TestPiSteerRacingParkIsRejected are back to their original piSettleLaterDelay (200 ms) plus a 300 ms margin. They reach the park probe by time, not by a signal, so the ~0.4 s saving was not worth the risk. Rebased on the latest main.

@linger-review linger-review 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.

Approve (0 findings)

Follow-up on b415b4a. Scope: base main, merge base 63a918c4, 8 commits / 21 files in the PR; the incremental review covered the rebase plus the one changed commit (1cf211f4). Helper skills loaded: coderbook, ponytail-review, karpathy-guidelines. Ran in a separate session.

Previous findings

  • P3: sleep-based Pi park-probe tests had their margin cut: Resolved. git range-diff shows commits 1–7 unchanged after the rebase. Commit 8 no longer touches the Pi files: pi_resident_fake_test.go:129 keeps piSettleLaterDelay = 200 * time.Millisecond, and pi_resident_test.go:423 and :462 keep piSettleLaterDelay + 300*time.Millisecond. The commit message and PR body now say the Pi park-probe tests keep their original sleeps because they reach the probe by time rather than by a signal.

Findings

None.

Verified as fine

  • Since the previous review, the only changes are the rebase onto current main (git range-diff: commits 1–7 have identical patches) and the removal of the Pi sleep reductions from commit 8. Its commit message was updated to match.
  • The PR body's claim about the native tests ("The Pi park-probe tests keep their original sleeps") matches the diff.

Process notes

  • No merge commits and no fixup commits. The branch is up to date with main (0 commits behind). BLOCKED merge state reflects the pending required review, not a stale branch.

CI

All checks pass at 1cf211f4: repository-gate, web-static, web tests (1/2, 2/2), check (web, computer-go, contracts, desktop, installer, packages, teamhub, teamhub-cli), changes, CodeQL. Nothing was re-run locally. The only new change restores the original test timings, so no new concurrency risk needed a -race run.

Automated review by Claude Code


Automated review of 1cf211f by Claude Code.

@NightRain233
NightRain233 added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 503b6c7 Nov 19, 2026
15 checks passed
@NightRain233
NightRain233 deleted the claude/ci-speedup-014f72 branch November 19, 2026 03:53
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.

1 participant