Skip to content

chore: improve CI performance by splitting build and test phases#2092

Merged
nick-inkeep merged 1 commit intomainfrom
chore/ci-performance-improvements
Feb 17, 2026
Merged

chore: improve CI performance by splitting build and test phases#2092
nick-inkeep merged 1 commit intomainfrom
chore/ci-performance-improvements

Conversation

@nick-inkeep
Copy link
Collaborator

Summary

  • Split the single pnpm check CI step into two phases: build first, then run quality checks
  • Prevents Playwright browser tests (Monaco editor) from competing with heavy builds for CPU on cache-miss runs

Problem

On PR branches with Turbo cache misses (11-13 out of 44 tasks), the pnpm check step runs all builds, lint, typecheck, and tests in parallel with concurrency 15. Heavy builds (Next.js, agents-api, agents-docs) starve Playwright/Monaco of CPU, causing the Monaco editor to stay in skeleton loading state and the screenshot test (should properly highlight nested error state) to time out.

This only affects PR branches — main has warm Turbo cache (0 misses) so builds are instant.

Solution

  1. New "Build packages" step — runs pnpm turbo run build first, completing ALL compilation before tests start
  2. Existing "Run CI checks" step — runs pnpm check (lint + typecheck + test) with builds already cached

When pnpm check runs in phase 2, Turbo sees all build outputs are cached → skips builds → only runs lint, typecheck, and test. The browser test gets full CPU instead of competing with Next.js compilation.

Test plan

🤖 Generated with Claude Code

Split the single `pnpm check` step into two phases:
1. Build all packages first (heavy compilation)
2. Run lint, typecheck, and test (builds already cached)

This prevents Playwright browser tests (Monaco editor) from competing
with heavy Next.js/agents-api builds for CPU on cache-miss runs,
which caused the Monaco editor to get stuck in skeleton loading state
and the screenshot test to time out on ubuntu-16gb runners.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2026

⚠️ No Changeset found

Latest commit: 162a0ad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agents-api Ready Ready Preview, Comment Feb 17, 2026 9:51pm
agents-docs Ready Ready Preview, Comment Feb 17, 2026 9:51pm
agents-manage-ui Ready Ready Preview, Comment Feb 17, 2026 9:51pm

Request Review

@amikofalvy
Copy link
Collaborator

You could take this in a different direction and setup the correct dependencies within turborepo + constrain parallel task count in turbo repo.

This will do a better job of responding to cache hits/misses.

Copy link
Contributor

@claude claude bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(0) Total Issues | Risk: Low

💭 Consider (1) 💭

Inline Comments:

  • 💭 Consider: ci.yml:112-114 Add ENVIRONMENT: test to build step for cache key consistency with the check step

✅ APPROVE

Summary: This is a well-reasoned CI optimization that separates heavy builds from browser tests to prevent CPU contention on cache-miss runs. The approach is sound — Turbo's task graph ensures builds complete before lint/typecheck/test, and cached outputs will be reused in the check step. The one minor consideration is adding ENVIRONMENT: test to the build step to ensure cache key consistency (since it's in globalEnv), but this is non-blocking. The PR description clearly explains the problem, solution, and test plan. Ship it! 🚀

Discarded (1)
Location Issue Reason Discarded
ci.yml Approach validation (positive) Not an issue — reviewer confirmed the two-phase build-then-check pattern is correctly implemented
Reviewers (1)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
pr-review-devops 2 0 0 0 1 0 1
Total 2 0 0 0 1 0 1

Comment on lines +112 to +114
env:
NODE_OPTIONS: --max-old-space-size=4096
CI: true
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 Consider: Add ENVIRONMENT: test for cache key consistency

Issue: The "Build packages" step doesn't set ENVIRONMENT, while the "Run CI checks" step sets ENVIRONMENT: test. Since ENVIRONMENT is in Turbo's globalEnv (turbo.json:11), it affects cache key computation for all tasks.

Why: When the build step runs with ENVIRONMENT=undefined and the check step runs with ENVIRONMENT=test, Turbo computes different cache keys. This could cause the check step to miss the build cache and re-run builds, partially defeating the optimization goal.

Fix:

Suggested change
env:
NODE_OPTIONS: --max-old-space-size=4096
CI: true
env:
ENVIRONMENT: test
NODE_OPTIONS: --max-old-space-size=4096
CI: true

Refs:

@github-actions github-actions bot deleted a comment from claude bot Feb 17, 2026
@nick-inkeep nick-inkeep merged commit 3c101eb into main Feb 17, 2026
15 checks passed
@nick-inkeep nick-inkeep deleted the chore/ci-performance-improvements branch February 17, 2026 21:54
nick-inkeep added a commit that referenced this pull request Feb 17, 2026
nick-inkeep added a commit that referenced this pull request Feb 17, 2026
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

Comments