Skip to content

Speed up process-host import enforcement in CI - #27124

Merged
nwparker merged 6 commits into
mainfrom
nwparker/process-host-ci-speed
Oct 10, 2026
Merged

nwparker merged 6 commits into
mainfrom
nwparker/process-host-ci-speed

Conversation

@nwparker

@nwparker nwparker commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The package extraction added an import check that spent about 30 seconds on the static CI path. This follow-up reduces its work and runs it alongside other checks, keeping it mandatory before CI can succeed.

What Changed

  • Parse imports in one tree walk, without building unused parent links. Every file still parses and invalid syntax still fails.
  • Run the import check in the background and explicitly wait for its successful completion before publishing the unit plan.
  • Update both workflow contracts for the new check’s phase, cancellation, and wait behavior.
  • Migrate the newer memory benchmark from the removed subprocess wrapper to the public package API.

Why

This improves the existing checker and scheduling without changing package APIs, test selection, or shard count. Package builds retain their original locked compilation and publication: controlled Windows measurements favored that simpler path over a persistent build cache for jobs with few builds.

Linked Issue

Maintainer-requested performance follow-up to #26963.

Visual Proof

N/A — CI and tooling changes only.

Testing

  • I manually tested these changes locally.
  • Automated tests added/updated.

Exact final commit 41a3661911657cd510ebaa475d1b68bd36cf7d3a passes all 143 focused tests, full pnpm tc, changed-code quality, and the full anti-slop audit. Both workflow contract suites pass all 37 cases, including phase selection, failure, cancellation, successful no-op registration, and mandatory waits. The benchmark passes eight small smoke measurements. The same exact commit passes frozen installation, package build, all 143 focused cases, live import enforcement, and full typechecking on native Windows through paired host awin. Final CI is clean on that exact commit: 22 checks pass, eight skip under the existing path rules, and no failures or active jobs remain. All five full Node 24 unit shards, Linux and Windows packaging, static/typecheck, runtime contracts, aggregate verification, and evidence collection pass without reruns.

The original guard added 29.485 seconds in the extraction’s static job. An interleaved local comparison returns identical results for all 32,420 sources and reduces parsing/analysis from 10.19 to 7.33 seconds, about 28% less work. The exact final-head static job passes: the mandatory scan takes 25.659 seconds entirely in parallel, finishes 165.162 seconds before its join, and adds no serial wait (the join takes about 0.10 ms). Full unit execution totals 2,904.42 seconds across five shards, median 575.52 seconds. The original extraction sample was 2,887 total / 571 median: differences of about 0.6% / 0.8% across different source snapshots do not establish a regression. Cache state, runner load, and independent main changes prevent claiming a fixed whole-workflow percentage improvement.

Review

Independent native reviewers cleared parser semantics, mandatory background-check enforcement, both workflow contracts, the benchmark migration, and upstream merge preservation. The entire process-host package tree is byte-identical to main. Windows measurement counsel supports keeping its existing build path.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material copied or translated.

Notes

This final change is six files, 104 additions and 39 deletions. Package manifests, compiler settings, runtime code, artifact publication, and unit selection are unchanged. Main #27109’s independent test consolidation is preserved.

Checklist

  • This PR is small and focused.
  • I explained what changed and why.
  • Visual proof is N/A with reason.
  • Self-reviewed for correctness, security, and performance.
  • Cross-platform and SSH compatibility considered.
  • Focused tests, typecheck, quality checks, and package builds pass; native Windows confirms the exact final commit; all selected CI checks, including full unit shards, both packaging jobs and aggregate verification, pass.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The process-host distribution build now reuses output when eligible input and output fingerprints match. Tests cover reuse, recompilation, output repair, and unsupported inputs. The static module-specifier collector processes collected module syntax nodes, with tests for decoded specifiers, declaration order, and parse failures. The preflight workflow runs the process-host import check in the background and waits for it. The benchmark now imports process execution and failure-description functions from process-host-related modules.






























Priority: ➖ Normal

Merge Risk: 🔵 Low · up to b32e1

Build reuse could miss a dependency change when compiler output is unusually large. Reject truncated output before saving state; otherwise the PR appears mergeable with this bounded risk.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly describes the primary CI performance change: speeding up process-host import enforcement. It is concise and relevant, although it does not mention build reuse or parser optimization.
Description check Passed The description is detailed and covers the required explanation, changes, motivation, testing, visual proof, review notes, compatibility considerations, and checklist. It references issue #26963, alth…

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR



















  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b29e5100-1c5f-4b40-9cbd-ff0a2f5934db
📥 Commits

Reviewing files that changed from the base of the PR and between 78aae8d and 56f18f1.

📒 Files selected for processing (2)
  • config/scripts/codex-usage-parser-memory-benchmark.mjs
  • config/scripts/pr-workflow-parallelism.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Comment on lines +279 to +280
fileURLToPath(import.meta.resolve('@orca/process-host')),
join(import.meta.dirname, 'process-failure-message.mjs'),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -eu

sed -n '10,22p' src/packages/process-host/package.json

for file in \
  src/packages/process-host/src/run-process.ts \
  src/packages/process-host/dist/run-process.js
do
  if [[ -f "$file" ]]; then
    printf '\n--- %s ---\n' "$file"
    sed -n '1,100p' "$file"
  fi
done

rg -n --glob '*.ts' --glob '*.js' \
  "from ['\"]\\.|import\\(['\"]\\." \
  src/packages/process-host/src || true

Repository: stablyai/orca

Length of output: 8726


🏁 Script executed:

set -eu
printf '%s\n' '--- package metadata ---'
cat src/packages/process-host/package.json
printf '%s\n' '--- package files ---'
find src/packages/process-host -maxdepth 3 -type f \( -path '*/dist/*' -o -name '*tsconfig*' -o -name '*build*' \) -print | sort
printf '%s\n' '--- benchmark hash references ---'
rg -n -C 8 -F -- 'instrumentationSha256' config/scripts/codex-usage-parser-memory-benchmark.mjs
printf '%s\n' '--- hash helper references ---'
rg -n -C 5 --glob '*.mjs' --glob '*.js' --glob '*.ts' 'sha256|createHash|hashFile|hash.*file' config/scripts src/packages/process-host | head -240
printf '%s\n' '--- built entrypoint ---'
if [ -f src/packages/process-host/dist/run-process.js ]; then
  sed -n '1,180p' src/packages/process-host/dist/run-process.js
else
  printf '%s\n' 'dist/run-process.js is absent'
fi

Repository: stablyai/orca

Length of output: 26388


🏁 Script executed:

set -eu
printf '%s\n' '--- build script ---'
nl -ba src/packages/process-host/scripts/build-dist.mjs
printf '%s\n' '--- tsconfig ---'
cat src/packages/process-host/tsconfig.json
printf '%s\n' '--- benchmark digest definition ---'
nl -ba config/scripts/codex-usage-parser-memory-benchmark.mjs | sed -n '1,35p;250,288p'

Repository: stablyai/orca

Length of output: 18080


Hash the complete @orca/process-host runtime dependency graph.

run-process.js imports project-owned runtime modules. The build emits separate files with TypeScript and does not bundle them. Hashing only the resolved entrypoint allows changes in those dependency files to leave instrumentationSha256 unchanged.

Include every emitted runtime file reachable from the resolved @orca/process-host entrypoint in the hash inputs.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Reject truncated compiler output before saving build state. · build-dist.mjs:110-119

src/packages/process-host/scripts/build-dist.mjs:110-119
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Reject truncated compiler output before saving build state.

compileAndSync uses compile.stdout as the complete compiledFiles list without checking compile.outputTruncated. A truncated --listFiles result can omit dependencies and allow reusable state to be saved with an incomplete input fingerprint.

🐛 Suggested fix
     if (compile.code !== 0) {
       const detail = [compile.stdout, compile.stderr].filter(Boolean).join('\n').trim()
       const reason = compile.timedOut ? 'timed out' : (compile.signal ?? compile.code)
       throw new Error(`process-host compilation failed (${reason})${detail ? `:\n${detail}` : ''}`)
     }
+    if (compile.outputTruncated) {
+      throw new Error('process-host compilation output was truncated')
+    }

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0c76097b-2add-4f5d-b08d-22c1e9eba7f6
📥 Commits

Reviewing files that changed from the base of the PR and between 8e4054e and b32e1b7.

📒 Files selected for processing (2)
  • config/scripts/process-host-build-reuse.test.mjs
  • src/packages/process-host/scripts/build-dist.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@nwparker nwparker changed the title Remove repeated work from process-host CI checks Speed up process-host import enforcement in CI Oct 10, 2026
@nwparker
nwparker merged commit 71733cc into main Oct 10, 2026
30 checks passed
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