Skip to content

ci(platform): stabilize macOS and WSL Vitest - #6825

Merged
cv merged 3 commits into
mainfrom
codex/fix-platform-vitest-main
Jul 14, 2026
Merged

ci(platform): stabilize macOS and WSL Vitest#6825
cv merged 3 commits into
mainfrom
codex/fix-platform-vitest-main

Conversation

@cjagwani

@cjagwani cjagwani commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stabilizes the main-branch Platform Vitest workflow after the previous WSL fix left three residual WSL failures and macOS still failed 216 tests. The workflow now provisions the runtime its cross-platform tests require, while genuine Darwin and WSL timing/path differences are handled explicitly.

Changes

  • Provision Python 3.14 with hash-locked PyYAML and setuptools plus Homebrew Bash, GNU coreutils, gawk, and ripgrep for the macOS lane.
  • Fix Darwin PTY, canonical-path, Unix-socket-length, job-control, and Hermes direct-execution behavior; gate Linux-only memfd/fcntl and exact-rlimit contracts to Linux.
  • Install ripgrep in WSL and fix the remaining outside-repository fixture permission, resolver timeout, and /proc argv transition races.
  • Add workflow contracts and opaque-input watch triggers covering the macOS toolchain and unprivileged WSL boundary.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: CI portability and internal main-module path detection do not change supported user behavior.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: independent diff review found no credential or policy behavior change; action pins, Python wheel hashes, unprivileged WSL execution, and Linux-only boundaries were verified.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — focused CLI, integration, E2E-support, workflow/watch-trigger, Darwin PTY, gateway-control, Hermes/path, and platform-gating tests passed; npm run test:changed passed (31 passed, 15 Linux-only skipped on Darwin).
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result: awaiting the branch-dispatched Platform Vitest workflow on real macOS and WSL runners.
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Charan Jagwani cjagwani@nvidia.com

Summary by CodeRabbit

  • CI Improvements

    • Improved macOS and WSL test environment setup and diagnostics.
    • Added pinned Python and dependency configuration for macOS testing.
    • Ensured standard WSL tests run without elevated privileges.
  • Bug Fixes

    • Improved cross-platform path and socket handling.
    • Increased test reliability for process startup, signal output, and macOS shell behavior.
  • Tests

    • Added workflow validation coverage for runtime setup, dependency versions, permissions, and command configuration.
    • Expanded watch-trigger coverage for platform test workflow changes.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates platform Vitest workflow setup and contract coverage, hardens Hermes main-module detection, and adjusts tests for platform-specific paths, process timing, command invocation, Linux-only behavior, and shell output.

Changes

Platform Vitest workflow contracts

Layer / File(s) Summary
Platform runtime setup and diagnostics
.github/workflows/platform-vitest-main.yaml
The macOS job provisions Python 3.14 with pip caching and reports additional tool versions; the WSL job installs ripgrep.
Workflow contract validation
test/platform-vitest-main-workflow.test.ts, ci/source-shape-test-budget.json
Workflow tests validate macOS runtime ordering and pinned dependencies, WSL privilege boundaries, and root-only contract execution.
Workflow watch routing
test/helpers/vitest-watch-triggers.ts, test/vitest-watch-triggers.test.ts
Changes to the workflow or macOS requirements lockfile trigger the workflow contract test.

Hermes module detection

Layer / File(s) Summary
Resolved main-module check
agents/hermes/generate-config.ts
Main-module detection compares resolved filesystem paths and returns false when the executable path is missing or cannot be resolved.

Cross-platform test portability

Layer / File(s) Summary
Platform-specific process and command handling
src/lib/onboard/docker-driver-gateway-compat-container.test.ts, src/lib/tunnel/gateway-stop-script.test.ts, test/gateway-supervisor-control.test.ts, test/repro-5978-policy-denial-hint.test.ts, test/sandbox-init.test.ts, test/langchain-deepagents-code-managed-mcp-hardening.test.ts
Tests handle Darwin socket and script invocation differences, wait for asynchronous argv rewriting, normalize macOS Bash output, and gate Linux-specific scenarios.
Filesystem path normalization
test/e2e/support/e2e-fixture-context.test.ts, test/local-credential-helper-suite.ts, test/onboard-model-router.test.ts, test/pr-review-advisor.test.ts
Filesystem assertions use real paths and temporary directories use the operating system temp location.
Shared test timeout handling
test/pr-workflow-contract.test.ts
The Hermes resolver test uses the shared execution timeout instead of a fixed spawn timeout.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: area: ci, bug-fix

Suggested reviewers: cv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: stabilizing the Platform Vitest workflow on macOS and WSL.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-platform-vitest-main

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

@github-code-quality

github-code-quality Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage remains at 96%, unchanged from the main branch.

TypeScript / code-coverage/cli

The overall coverage in the codex/fix-platform-v... branch remains at 79%, unchanged from the main branch.

Show a code coverage summary of the most impacted files.
File main 7b13829 codex/fix-platform-v... 03163e5 +/-
src/lib/adapter...ocker/volume.ts 85% 70% -15%
src/lib/onboard...reachability.ts 72% 63% -9%
src/lib/agent/dashboard-ui.ts 89% 83% -6%
src/lib/state/config-io.ts 94% 91% -3%
src/lib/messagi.../persistence.ts 86% 89% +3%
src/lib/adapter.../docker/pull.ts 79% 83% +4%
src/lib/messagi...n-validation.ts 96% 100% +4%
src/lib/adapter...shell/client.ts 83% 88% +5%
src/lib/onboard...shboard-port.ts 89% 94% +5%
src/lib/policy/tiers.ts 80% 94% +14%

Updated July 14, 2026 04:12 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / medium confidence
Primary next action: Review the warnings below.
Findings: 0 blockers · 1 warning · 0 optional suggestions
Status: Canonical ledger: 0 blocker(s), 1 warning(s), 0 suggestion(s).

Model lanes

  • GPT-5.6 Terra (primary): Completed · medium confidence · 0 blockers · 1 warning · 0 suggestions
  • Nemotron 3 Ultra (non-blocking second opinion): Completed · high confidence · 0 blockers · 5 warnings · 0 suggestions
  • Model comparison: normalized findings differ; normalized E2E selections differ; Nemotron reported the same number of blockers, 4 more warnings, the same number of suggestions.

Nemotron is a non-blocking second opinion. Its prose, findings, and E2E guidance do not change the primary assessment above and remain in workflow artifacts only.

E2E guidance

Advisory only: coverage and selector recommendations are non-authoritative. E2E / PR Gate independently computes and dispatches trusted jobs without consuming this output.

Recommended coverage: cloud-onboard, credential-sanitization, full-e2e, hermes-e2e, security-posture
Recommended selectors: cloud-onboard, credential-sanitization, full-e2e, hermes-e2e, security-posture

  • cloud-onboard — Selected from the trusted checked-in E2E coverage inventory.

  • credential-sanitization — Selected from the trusted checked-in E2E coverage inventory.

  • full-e2e — Selected from the trusted checked-in E2E coverage inventory.

  • hermes-e2e — Selected from the trusted checked-in E2E coverage inventory.

  • security-posture — Selected from the trusted checked-in E2E coverage inventory.

  • cloud-onboard — Selected as a trusted checked-in E2E job.

  • credential-sanitization — Selected as a trusted checked-in E2E job.

  • full-e2e — Selected as a trusted checked-in E2E job.

  • hermes-e2e — Selected as a trusted checked-in E2E job.

  • security-posture — Selected as a trusted checked-in E2E job.

1 warning · 0 optional suggestions

Warnings

These merit maintainer attention but do not block by themselves.

PRA-1 Warning — Cover canonical-path entrypoint detection

  • Location: agents/hermes/generate-config.ts:23
  • Category: tests
  • Problem: The changed isMainModule branch now relies on realpathSync to recognize a direct invocation through a canonicalized or symlinked script path, but the existing direct-generation test invokes the ordinary SCRIPT_PATH and does not exercise that branch.
  • Impact: A regression in symlink/canonical-path handling could cause a Hermes image-build entrypoint not to generate its configuration, or execute generation when the module is imported, without the focused test suite detecting it.
  • Recommendation: Extend test/generate-hermes-config.test.ts with a symlinked invocation of generate-config.ts and assert it produces the same configuration as the canonical direct invocation; also assert importing the module remains side-effect free if the harness can load it directly.
  • Verification: Inspect test/generate-hermes-config.test.ts around the direct executable test and confirm whether it invokes a symlink to agents/hermes/generate-config.ts or otherwise covers the realpathSync equality branch.
  • Test coverage: A Vitest regression test that creates a symlink to generate-config.ts, runs the existing strip-types script harness through that link, and verifies generated config/env match canonical direct invocation while an import does not create config files.
  • Evidence: agents/hermes/generate-config.ts:23 compares realpathSync(resolve(process.argv[1])) to realpathSync(fileURLToPath(import.meta.url)). test/generate-hermes-config.test.ts:297 exercises direct generation through SCRIPT_PATH, with no symlink-path case identified in the checked-in test inventory.

Workflow run details

This is an automated, non-authoritative review. Findings are inputs to maintainer adjudication. Warnings and optional suggestions do not require a response or follow-up. A human maintainer makes the final merge decision.

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
@cjagwani
cjagwani marked this pull request as ready for review July 14, 2026 03:49

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/repro-5978-policy-denial-hint.test.ts`:
- Around line 99-102: Update the non-Darwin command construction in the
scriptArgs assignment to shell-escape or quote the interpolated file path within
the script -c command. Preserve the existing command flags and behavior while
ensuring paths containing spaces or shell metacharacters are passed as a single
safe argument.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4e079e19-9cb3-4cdb-8677-9963171ab4da

📥 Commits

Reviewing files that changed from the base of the PR and between 73c3791 and 10a05c5.

⛔ Files ignored due to path filters (1)
  • ci/platform-vitest-macos-requirements.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • .github/workflows/platform-vitest-main.yaml
  • agents/hermes/generate-config.ts
  • ci/source-shape-test-budget.json
  • src/lib/onboard/docker-driver-gateway-compat-container.test.ts
  • src/lib/tunnel/gateway-stop-script.test.ts
  • test/e2e/support/e2e-fixture-context.test.ts
  • test/gateway-supervisor-control.test.ts
  • test/helpers/vitest-watch-triggers.ts
  • test/langchain-deepagents-code-managed-mcp-hardening.test.ts
  • test/local-credential-helper-suite.ts
  • test/onboard-model-router.test.ts
  • test/platform-vitest-main-workflow.test.ts
  • test/pr-review-advisor.test.ts
  • test/pr-workflow-contract.test.ts
  • test/repro-5978-policy-denial-hint.test.ts
  • test/sandbox-init.test.ts
  • test/vitest-watch-triggers.test.ts

Comment on lines +99 to +102
const scriptArgs =
process.platform === "darwin"
? ["-q", "/dev/null", "bash", "--noprofile", "--norc", "-i", file]
: ["-qec", `bash --noprofile --norc -i ${file}`, "/dev/null"];

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Quote the path in the non-Darwin script -c command. The raw ${file} interpolation can split on spaces or treat shell metacharacters as syntax; shell-escape it before building the -c string.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/repro-5978-policy-denial-hint.test.ts` around lines 99 - 102, Update the
non-Darwin command construction in the scriptArgs assignment to shell-escape or
quote the interpolated file path within the script -c command. Preserve the
existing command flags and behavior while ensuring paths containing spaces or
shell metacharacters are passed as a single safe argument.

@cv
cv enabled auto-merge (squash) July 14, 2026 04:10
@cv
cv disabled auto-merge July 14, 2026 04:27
@cv
cv merged commit b85f5b2 into main Jul 14, 2026
55 of 57 checks passed
@cv
cv deleted the codex/fix-platform-vitest-main branch July 14, 2026 04:27
cv added a commit that referenced this pull request Jul 15, 2026
<!-- markdownlint-disable MD041 -->
## Summary

Closes the remaining failures exposed by the Platform Vitest main watch
across WSL and macOS. The patch fixes the original WSL gateway-owner
mismatch, supplies the missing macOS fd dependency, makes Shields timer
takeover fail closed around PID reuse and late descendants, and makes
the WSL root-only Hermes fixtures traversable by the intended peer
without weakening their contents.

## Related Issue

Follow-up to #6825; preserves the bare-gateway stop behavior from #4951.

## Changes

- Compare gateway process and identity-file owners by stable numeric UID
instead of width-limited account names.
- Install fd in the macOS platform lane and pin that dependency in the
workflow contract.
- Bound Shields process inspection, verify start identity immediately
before signaling, stop the exact owner before enumerating descendants,
and require a quiescent descendant pass.
- Add deterministic PID-reuse, transient-inspection, stop-ordering, and
non-quiescent-tree regressions.
- Grant temporary execute-only traversal for the two WSL root peer
fixtures, restore the shared temp-root mode, and return locked fixtures
to mutable before cleanup.

## Type of Change

- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Quality Gates

- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: These are internal
platform-CI and process-safety corrections; the documented tunnel and
timer contracts do not change.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: Independent security
review found no blockers. Exact process identity is the final pre-signal
verification, zombies are treated as gone, replacement PIDs receive no
stop or kill signal, and non-quiescent trees remain frozen and fail
closed.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification

- [x] PR description includes the DCO sign-off declaration and every
commit appears as Verified in GitHub
- [x] Normal pre-commit, commit-msg, and pre-push hooks passed, or npm
run check:diff passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — npm run test:changed: 82 files and 735
tests passed; focused platform and Shields tests: 23 passed; CLI
typecheck and build passed; integration fixtures: 9 passed with 2
root-only tests skipped locally; project membership and structural
checks passed.
- [ ] Applicable broad gate passed — npm test for broad
runtime/test-harness changes; npm run check for repo-wide
validation/coverage changes — authoritative branch Platform Vitest run
is being dispatched on real macOS and WSL runners.
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] npm run docs builds without warnings (doc changes only)
- [ ] Doc pages follow the style guide (doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Improved shield recovery/takeover reliability with deadline-bounded
process inspection, more deterministic hung-owner handling, and stronger
“current vs gone” verification.
- Prevented unsafe signaling during takeover by identity-based
recovery-tree exclusion and tighter freeze/kill escalation logic.
- Hardened Linux gateway shutdown by switching process authorization and
PID discovery to numeric UID checks.
- **Tests**
- Added deadline behavior coverage and expanded shield takeover/recovery
tests for hung and PID-reuse replacement scenarios.
- Updated gateway stop-script and Hermes restart fixture tests,
including stricter permission handling and cleanup.
- **Chores**
  - Added `fd` to macOS CI dependency installation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Charan Jagwani <cjagwani@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-by: Carlos Villela <cvillela@nvidia.com>
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure platform: macos Affects macOS, including Apple Silicon platform: wsl Affects Windows Subsystem for Linux labels Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure platform: macos Affects macOS, including Apple Silicon platform: wsl Affects Windows Subsystem for Linux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants