Skip to content

fix(quality-gates): cross-platform CodeRabbit CLI execution [#731] - #752

Merged
rafaelscosta merged 5 commits into
mainfrom
fix/cross-platform-wsl-731
May 18, 2026
Merged

fix(quality-gates): cross-platform CodeRabbit CLI execution [#731]#752
rafaelscosta merged 5 commits into
mainfrom
fix/cross-platform-wsl-731

Conversation

@rafaelscosta

@rafaelscosta rafaelscosta commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #731 (reported by @duboneh).

The CodeRabbit CLI execution paths were hardcoded to assume Windows + WSL (wsl bash -c '...' wrapper, /mnt/c/... paths, installation_mode: wsl). On macOS/Linux those commands failed silently and the Layer-2 quality-gate automation never enforced the review — the auto-healing loop in @dev / @qa / @devops / @architect / @data-engineer simulated success while doing nothing.

Patterns applied (per @duboneh PoC)

Pattern 1 — Inline cross-platform branching (runtime)

  • .aiox-core/core/orchestration/workflow-executor.js (runCodeRabbitAnalysis)
  • .aiox-core/core/quality-gates/layer2-pr-automation.js (runCodeRabbit)
  • .aiox-core/development/tasks/github-devops-pre-push-quality-gate.md (inline code block + error-handler messages)

Default: installation_mode || (process.platform === 'win32' ? 'wsl' : 'native'). cli_path defaults to ~/.local/bin/coderabbit. Explicit installation_mode: 'wsl' | 'native' overrides platform detection. Explicit raw command: string overrides cli_path (back-compat). Error-handler messages switch on process.platform so macOS/Linux/Windows operators each see the right recovery hint.

Pattern 2 — wsl_config: block → cli_path: + platform_notes:

DELETED installation_mode: wsl + wsl_config: blocks (no overlay; full removal) from:

  • .aiox-core/core/quality-gates/quality-gate-config.yaml
  • 3 agent personas: dev.md, qa.md, devops.md

Replaced with cli_path: ~/.local/bin/coderabbit + platform_notes: describing both invocation shapes.

Pattern 3 — execution_guidelines rewritten neutral

5 agent personas (dev, qa, devops, architect, data-engineer) had their execution_guidelines text rewritten from "CRITICAL: CodeRabbit CLI is installed in WSL, not Windows / use 'wsl bash -c' wrapper for ALL commands" to cross-platform guidance. commands: blocks now expose explicit _native and _wsl template suffixes side-by-side.

ASCII workflow diagrams updated in qa-review-story.md + dev-develop-story.md. environment-bootstrap.md note rewritten as cross-platform.

Regression coverage

tests/unit/quality-gates/cross-platform-coderabbit.test.js8 tests, all pass:

  1. macOS (darwin) builds native command (no wsl bash -c)
  2. Linux builds native command
  3. Windows (win32) wraps with wsl bash -c
  4. Explicit installation_mode: 'native' override on Windows
  5. Explicit installation_mode: 'wsl' override on macOS
  6. Raw command: string override (back-compat)
  7. Custom cli_path honored on macOS
  8. Custom cli_path honored on Windows

IDE projection sync

npm run sync:ide propagated agent persona changes to 7 IDEs: claude-code, codex, gemini, github-copilot, cursor, antigravity, kimi. Compatibility Parity Gate + IDE Command Sync Validation should be green.

Validation

  • npm run lint → exit 0
  • npx jest tests/unit/quality-gates/cross-platform-coderabbit.test.js → 8/8 pass
  • grep -rn 'installation_mode: wsl\\b\\|wsl_config:' .aiox-core/development/agents/*.md → zero matches
  • All remaining wsl bash -c references are Windows-prefixed examples or _wsl template suffixes (verified manually)
  • npm run sync:ide clean — no projection drift
  • CI essentials green (Test, Jest matrix, ESLint, TypeScript, CodeQL, Compatibility Parity Gate, IDE Command Sync Validation)

Out of scope (separate follow-ups)

  • The Cross-Platform (\${{ matrix.os }}, Node \${{ matrix.node }}) smoke matrix check in CI is skipping (unexpanded YAML variable in a workflow). Unrelated bug — separate issue worth filing.
  • smoke_test_exports (Node 24) flakes (false positive — readline ERR_USE_AFTER_CLOSE in non-TTY context). Smoke test should pass a non-interactive flag instead of relying on node -e "require('bin/aiox.js')".
  • .aiox-core/development/agents/qa/MEMORY.md still mentions installation_mode: wsl but it is a runtime memory file (not config) — intentionally left alone per the constitution's data sovereignty rules.

Test plan

  • CI essentials green on this branch
  • Bypass dance (ruleset 13330052 + legacy branch protection) atomic with trap EXIT restore
  • Post-merge: students on macOS/Linux see real CodeRabbit output during *pre-push / *review / *develop-story instead of silent skips

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Summary by CodeRabbit

  • New Features

    • Cross-platform CodeRabbit CLI support with automatic platform detection (native on macOS/Linux; WSL wrapper on Windows), configurable CLI path and installation mode, and separate native/WSL command templates.
  • Documentation

    • Widespread updates to agent guides, tasks, skills and rules with platform-aware invocation, path-handling notes, and revised troubleshooting/auth guidance.
  • Tests

    • Added regression tests validating cross-platform command construction, path translation, and tilde-expansion behavior.
  • Chores

    • Registry and install manifest refreshed to reflect updated files and metadata.

Review Change Stack

rafaelscosta and others added 2 commits May 18, 2026 01:51
Closes #731 (reported by @duboneh).

The CodeRabbit CLI execution paths were hardcoded to assume Windows + WSL
(`wsl bash -c '...'` wrapper, `/mnt/c/...` paths, `installation_mode: wsl`).
On macOS/Linux those commands failed silently and the Layer-2 quality-gate
automation never enforced the review. The auto-healing loop in @dev / @qa /
@devops / @architect / @data-engineer simulated success while doing nothing.

## What changed

Three patterns applied across runtime + config + agent surfaces:

### Pattern 1 — Inline cross-platform branching (runtime)

- `.aiox-core/core/orchestration/workflow-executor.js` (`runCodeRabbitAnalysis`)
- `.aiox-core/core/quality-gates/layer2-pr-automation.js` (`runCodeRabbit`)
- `.aiox-core/development/tasks/github-devops-pre-push-quality-gate.md`
  (`runCodeRabbit` inline code block + error-handler messages)

Default behavior:
- `installation_mode || (process.platform === 'win32' ? 'wsl' : 'native')`.
- `cli_path` defaults to `~/.local/bin/coderabbit`.
- Explicit `installation_mode: 'wsl' | 'native'` still wins (lets ops force
  WSL on macOS for testing, etc).
- Explicit raw `command:` string still wins over `cli_path` (back-compat).

Error-handler messages now switch on `process.platform`: macOS/Linux users
see native recovery commands, Windows users see WSL-wrapped ones.

### Pattern 2 — `wsl_config:` block → `cli_path:` + `platform_notes:`

DELETED `installation_mode: wsl` + `wsl_config:` blocks (no overlay; full
removal) from:
- `.aiox-core/core/quality-gates/quality-gate-config.yaml`
- `.aiox-core/development/agents/dev.md`
- `.aiox-core/development/agents/qa.md`
- `.aiox-core/development/agents/devops.md`

Replaced with:
```yaml
cli_path: ~/.local/bin/coderabbit
platform_notes:
  macos_linux: "Run cli_path directly from project root (no wrapper)."
  windows: "Wrap with 'wsl bash -c' and rewrite project paths to /mnt/<drive>/..."
```

### Pattern 3 — execution_guidelines rewritten neutral

Replaced "CRITICAL: CodeRabbit CLI is installed in WSL, not Windows" + the
"use 'wsl bash -c' wrapper for ALL commands" prescriptions with cross-platform
guidance in 5 agent personas (dev, qa, devops, architect, data-engineer).
`commands:` blocks now have explicit `_native` and `_wsl` template suffixes
so agents can see both shapes side-by-side.

ASCII workflow diagrams updated in:
- `.aiox-core/development/tasks/qa-review-story.md`
- `.aiox-core/development/tasks/dev-develop-story.md`

`environment-bootstrap.md` note also rewritten as cross-platform.

### Regression coverage

`tests/unit/quality-gates/cross-platform-coderabbit.test.js` — 8 tests:
- macOS (darwin) builds native command
- Linux builds native command
- Windows wraps with `wsl bash -c`
- Explicit `installation_mode: 'native'` override on Windows
- Explicit `installation_mode: 'wsl'` override on macOS
- Raw `command:` string override (back-compat)
- Custom `cli_path` honored on macOS
- Custom `cli_path` honored on Windows

Test suite: 8/8 pass.

### IDE projection sync

`npm run sync:ide` propagated the agent persona changes to:
- `.claude/skills/AIOX/agents/{...}/SKILL.md`
- `.codex/agents/*.md`
- `.gemini/rules/AIOX/agents/*.md`
- `.kimi/skills/aiox-{...}/SKILL.md`

109 files synced across 7 IDEs (claude-code, codex, gemini, github-copilot,
cursor, antigravity, kimi). Compatibility Parity Gate + IDE Command Sync
Validation should be green on this branch.

## Validation

- [x] `npm run lint` exit 0
- [x] `npx jest tests/unit/quality-gates/cross-platform-coderabbit.test.js` → 8/8 pass
- [x] `grep -rn 'installation_mode: wsl\b\|wsl_config:' .aiox-core/development/agents/*.md` → zero matches
- [x] All remaining `wsl bash -c` references are Windows-prefixed examples or `_wsl` template suffixes (verified manually)
- [x] `npm run sync:ide` clean — no projection drift

## Out of scope (separate follow-ups)

- The `Cross-Platform (${{ matrix.os }}, Node ${{ matrix.node }})` smoke
  matrix check in CI is `skipping` (unexpanded YAML variable). Unrelated bug.
- `qa/MEMORY.md` mentions `installation_mode: wsl` but is a runtime memory
  file, not config — intentionally left alone (per @advisor guidance).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nges

Pre-push hook regenerated the registry to reflect the cleanup in agent
personas (removed `installation_mode: wsl` / `wsl_config:` blocks, reworked
usedBy/dependencies for the coderabbit_integration sections). entityCount
815 → 816.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
aiox-core Ready Ready Preview, Comment May 18, 2026 5:24am

Request Review

@github-actions github-actions Bot added area: agents Agent system related type: test Test coverage and quality area: core Core framework (.aios-core/core/) area: docs Documentation (docs/) labels May 18, 2026
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7d7304c4-3a6d-41b5-b7b9-3179dc49b9ac

📥 Commits

Reviewing files that changed from the base of the PR and between 5d41445 and 951de8e.

📒 Files selected for processing (2)
  • .aiox-core/data/entity-registry.yaml
  • .aiox-core/install-manifest.yaml
✅ Files skipped from review due to trivial changes (1)
  • .aiox-core/install-manifest.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .aiox-core/data/entity-registry.yaml

Walkthrough

This PR makes CodeRabbit invocation platform-aware: it reads layer2.coderabbit.cli_path and optional installation_mode, expands ~ for native runs, rewrites Windows paths for WSL, updates core runners, adds Jest tests for variants, and updates agent/skill/task docs and manifests.

Changes

Cross-platform CodeRabbit CLI execution framework

Layer / File(s) Summary
Core platform-aware CLI execution framework
core/orchestration/workflow-executor.js, core/quality-gates/layer2-pr-automation.js, core/quality-gates/quality-gate-config.yaml
Implements platform-aware command construction using configurable cli_path and installation_mode; defaults to WSL on win32 and native otherwise; rewrites project paths for WSL and expands ~ via os.homedir() for native runs.
Cross-platform command construction test coverage
tests/unit/quality-gates/cross-platform-coderabbit.test.js
Regression tests validate command strings across darwin/linux/win32, installation_mode overrides, explicit command passthrough, custom cli_path, drive-letter -> /mnt/... rewrite, and tilde handling.
Agent configuration and documentation updates across skill systems
.aiox-core/development/agents/*, .claude/skills/AIOX/agents/*/SKILL.md, .codex/agents/*, .gemini/rules/AIOX/agents/*, .kimi/skills/aiox-*/SKILL.md
Replaces WSL-only command examples with cli_path + platform_notes, adds native vs WSL templates, and updates execution and error-handling guidance for missing CLI, auth, and timeouts.
Development task workflow documentation
development/tasks/dev-develop-story.md, development/tasks/environment-bootstrap.md, development/tasks/github-devops-pre-push-quality-gate.md, development/tasks/qa-review-story.md
Updates task docs to show platform-aware CodeRabbit invocation patterns and platform-conditional troubleshooting messages; documents installation_mode override.
Registry metadata and install manifest updates
.aiox-core/data/entity-registry.yaml, .aiox-core/install-manifest.yaml
Refreshes registry metadata (lastUpdated, entityCount, checksums) and updates manifest SHA256/size entries for modified files.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Suggested labels

area: devops

Suggested reviewers

  • oalanicolas
  • Pedrovaleriolopez
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: implementing cross-platform CodeRabbit CLI execution to resolve issue #731, moving away from Windows/WSL-only assumptions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cross-platform-wsl-731

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 and usage tips.

@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage Report

Coverage report not available

📈 Full coverage report available in Codecov


Generated by PR Automation (Story 6.1)

coderabbitai[bot]
coderabbitai Bot previously requested changes May 18, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 7

Caution

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

⚠️ Outside diff range comments (1)
.aiox-core/data/entity-registry.yaml (1)

14221-14233: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don’t zero out agent dependency graphs for docs-only persona edits.

These agent blocks now have dependencies: [], but the PR scope only updates cross-platform CLI guidance/platform notes in the persona files. Wiping their dependency lists severs stable registry relationships without a matching capability change, which degrades graph/impact tooling and makes this regeneration inconsistent with the actual change set.

Also applies to: 14251-14272, 14384-14397, 14566-14578

🤖 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 @.aiox-core/data/entity-registry.yaml around lines 14221 - 14233, The PR
incorrectly clears the agent "dependencies" arrays (e.g., the block containing
story-draft-checklist) even though the change is docs-only; restore the original
dependency lists instead of leaving dependencies: [] (or omit the modified
dependency key entirely) for the affected agent entries so registry
relationships remain intact. Revert the dependency changes for the listed agent
blocks (the ones at the other ranges mentioned) by copying back the pre-PR
dependency values from main/origin or by removing your dependency edits so only
documentation/platform guidance lines are changed.
🧹 Nitpick comments (2)
tests/unit/quality-gates/cross-platform-coderabbit.test.js (1)

62-67: ⚡ Quick win

Consider adding test for WSL path interpolation correctness.

The current test verifies that the WSL command contains the cli_path string, but it doesn't validate that a real project path would be correctly interpolated into the command. This gap means the test wouldn't catch the ${PROJECT_ROOT} bug in layer2-pr-automation.js where the variable isn't actually defined.

Consider adding a test that verifies the WSL command includes a properly converted project path (e.g., checking for /mnt/c/... when running on a simulated Windows environment with a C: drive project root).

Example test enhancement
it('interpolates and converts project path in WSL command on Windows', async () => {
  setPlatform('win32');
  // Mock process.cwd() to return a Windows path
  const originalCwd = process.cwd;
  process.cwd = () => 'C:\\Users\\dev\\project';
  
  await layer.runCodeRabbit();
  
  expect(capturedCommand).toContain('/mnt/c/Users/dev/project');
  expect(capturedCommand).toMatch(/cd "\/mnt\/c\/Users\/dev\/project"/);
  
  process.cwd = originalCwd;
});
🤖 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 `@tests/unit/quality-gates/cross-platform-coderabbit.test.js` around lines 62 -
67, Add a new unit test that simulates Windows/WSL path interpolation by setting
setPlatform('win32'), mocking process.cwd() to return a Windows path like
'C:\\Users\\dev\\project', calling layer.runCodeRabbit(), and asserting that the
capturedCommand includes the converted WSL path '/mnt/c/Users/dev/project' and a
cd into that path (e.g., matches /cd "\/mnt\/c\/Users\/dev\/project"/); ensure
you restore the original process.cwd after the test. Reference the existing test
harness symbols runCodeRabbit (on the layer object), setPlatform, and
capturedCommand to locate where to add the assertions.
.aiox-core/core/quality-gates/layer2-pr-automation.js (1)

99-115: ⚡ Quick win

Consider extracting platform-aware command construction to shared utility.

The platform detection and command construction logic (lines 99-115) is duplicated between this file and workflow-executor.js (lines 781-797). This creates a maintenance burden and increases the risk of inconsistencies.

Consider extracting this logic to a shared utility module (e.g., .aiox-core/core/utils/coderabbit-command-builder.js) that both modules can import. This would centralize the platform detection, path conversion, and command construction logic.

🤖 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 @.aiox-core/core/quality-gates/layer2-pr-automation.js around lines 99 - 115,
The command construction logic around this.coderabbit (preferring
this.coderabbit.command, falling back to cli_path and installation_mode and
handling WSL vs native) should be extracted into a shared utility function
(e.g., buildCoderabbitCommand) so both modules reuse the same implementation;
implement buildCoderabbitCommand(coderabbit, projectRoot, platform) to
encapsulate: use coderabbit.command if present, derive cliPath from
coderabbit.cli_path || '~/.local/bin/coderabbit', compute mode from
coderabbit.installation_mode || (platform === 'win32' ? 'wsl' : 'native'), and
return the appropriate command string (WSL wrapper or native binary) and export
it, then replace the inline logic in layer2-pr-automation (the command variable)
and workflow-executor (the duplicated block) to import and call
buildCoderabbitCommand with this.coderabbit and PROJECT_ROOT.
🤖 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 @.aiox-core/core/orchestration/workflow-executor.js:
- Around line 785-797: The cliPath default uses a tilde which may not expand in
child_process exec; update the code that sets cliPath (use the
coderabbitConfig.cli_path fallback logic where cliPath is assigned) to
programmatically expand a leading "~" to the actual home directory via
os.homedir() (or require('os').homedir()) before building the command string
used in command, and ensure both the WSL branch (where command is formed using
this.projectRoot and cliPath) and the native branch use the expanded absolute
path instead of a literal "~".
- Around line 790-794: In the mode === 'wsl' branch (where wslPath, command and
cliPath are set in the workflow-executor implementation), add an explicit WSL
availability check when running on Windows (process.platform === 'win32') before
constructing/executing the wsl command: synchronously probe for WSL (e.g.,
spawnSync('wsl', ['-l']) or check existence of wsl.exe) and if the check fails
throw or return a clear, platform-specific error suggesting enabling/installing
WSL and Windows Subsystem for Linux components instead of proceeding to run the
command; additionally, when catching failures from executing command, if
process.platform === 'win32' augment the error message to include the same WSL
installation guidance so callers see actionable advice.

In @.aiox-core/core/quality-gates/layer2-pr-automation.js:
- Line 107: The default cliPath assignment using this.coderabbit.cli_path ||
'~/.local/bin/coderabbit' relies on shell tilde expansion and can fail in spawn
contexts; update the logic that sets cliPath so any leading "~" is expanded
programmatically (use os.homedir()) before the value is passed to
child_process.spawn or used elsewhere—modify the assignment/normalization around
the cliPath variable in layer2-pr-automation.js (the this.coderabbit.cli_path
handling) to replace a leading tilde with the current user home directory, or
delegate to a shared utility function used elsewhere to centralize tilde
expansion.
- Around line 99-115: The WSL command string in the command-construction block
uses an undefined ${PROJECT_ROOT}; replace that placeholder by converting
this.projectRoot to a WSL-compatible path (using the same helper/approach used
in workflow-executor.js for converting projectRoot) and interpolate that
resolved path into the wsl bash -c 'cd ...' command; update the branch where
mode === 'wsl' that builds command (references: this.coderabbit,
cliPath/this.coderabbit.cli_path, mode) so it uses the actual converted project
root string instead of ${PROJECT_ROOT}.

In @.aiox-core/data/entity-registry.yaml:
- Around line 14031-14051: The registry entry for quality-gate-config is missing
its runtime edges; update the quality-gate-config entry (symbol:
quality-gate-config, path:
.aiox-core/core/quality-gates/quality-gate-config.yaml) to reflect the new
consumers by adding workflow-executor.js and layer2-pr-automation.js to usedBy,
restore any appropriate dependencies in dependencies (or plannedDeps) that those
workflows expect, and change lifecycle from "orphan" to the correct state (e.g.,
"active" or "integrated") so the registry accurately represents the new runtime
contract; apply the same corrections for the other occurrences referenced (the
entries at the mentioned indices).

In @.codex/agents/architect.md:
- Around line 340-342: The docs hardcode the review base with the flag `--base
main` in the two example commands, which breaks repos whose default branch is
`master` or custom; update those examples to avoid a hardcoded branch by showing
a dynamic/default approach (e.g., omit `--base` so the tool uses the repository
default) or demonstrate using the repository's current/default branch (e.g.,
replace `--base main` with a shell substitution like `--base $(git symbolic-ref
--short HEAD)`), and update both macOS/Linux and Windows examples that contain
`--base main`.

In @.gemini/rules/AIOX/agents/architect.md:
- Around line 340-342: Replace the hardcoded "--base main" in the two command
examples (the macOS/Linux example "~/.local/bin/coderabbit --prompt-only --base
main" and the Windows example "wsl bash -c 'cd /mnt/<drive>/<path> &&
~/.local/bin/coderabbit --prompt-only --base main'") with a default-branch
variable/placeholder (e.g., DEFAULT_BRANCH or {{default_branch}}) and update the
surrounding text to instruct users to set that variable to their repo's default
branch; ensure both occurrences use the exact same placeholder name so
reviewers/scripts can reliably substitute it.

---

Outside diff comments:
In @.aiox-core/data/entity-registry.yaml:
- Around line 14221-14233: The PR incorrectly clears the agent "dependencies"
arrays (e.g., the block containing story-draft-checklist) even though the change
is docs-only; restore the original dependency lists instead of leaving
dependencies: [] (or omit the modified dependency key entirely) for the affected
agent entries so registry relationships remain intact. Revert the dependency
changes for the listed agent blocks (the ones at the other ranges mentioned) by
copying back the pre-PR dependency values from main/origin or by removing your
dependency edits so only documentation/platform guidance lines are changed.

---

Nitpick comments:
In @.aiox-core/core/quality-gates/layer2-pr-automation.js:
- Around line 99-115: The command construction logic around this.coderabbit
(preferring this.coderabbit.command, falling back to cli_path and
installation_mode and handling WSL vs native) should be extracted into a shared
utility function (e.g., buildCoderabbitCommand) so both modules reuse the same
implementation; implement buildCoderabbitCommand(coderabbit, projectRoot,
platform) to encapsulate: use coderabbit.command if present, derive cliPath from
coderabbit.cli_path || '~/.local/bin/coderabbit', compute mode from
coderabbit.installation_mode || (platform === 'win32' ? 'wsl' : 'native'), and
return the appropriate command string (WSL wrapper or native binary) and export
it, then replace the inline logic in layer2-pr-automation (the command variable)
and workflow-executor (the duplicated block) to import and call
buildCoderabbitCommand with this.coderabbit and PROJECT_ROOT.

In `@tests/unit/quality-gates/cross-platform-coderabbit.test.js`:
- Around line 62-67: Add a new unit test that simulates Windows/WSL path
interpolation by setting setPlatform('win32'), mocking process.cwd() to return a
Windows path like 'C:\\Users\\dev\\project', calling layer.runCodeRabbit(), and
asserting that the capturedCommand includes the converted WSL path
'/mnt/c/Users/dev/project' and a cd into that path (e.g., matches /cd
"\/mnt\/c\/Users\/dev\/project"/); ensure you restore the original process.cwd
after the test. Reference the existing test harness symbols runCodeRabbit (on
the layer object), setPlatform, and capturedCommand to locate where to add the
assertions.
🪄 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: Pro

Run ID: 6d5cf9c8-04a6-4511-bdfe-f70f42e027c0

📥 Commits

Reviewing files that changed from the base of the PR and between 536bda9 and a74b6fe.

📒 Files selected for processing (35)
  • .aiox-core/core/orchestration/workflow-executor.js
  • .aiox-core/core/quality-gates/layer2-pr-automation.js
  • .aiox-core/core/quality-gates/quality-gate-config.yaml
  • .aiox-core/data/entity-registry.yaml
  • .aiox-core/development/agents/architect.md
  • .aiox-core/development/agents/data-engineer.md
  • .aiox-core/development/agents/dev.md
  • .aiox-core/development/agents/devops.md
  • .aiox-core/development/agents/qa.md
  • .aiox-core/development/tasks/dev-develop-story.md
  • .aiox-core/development/tasks/environment-bootstrap.md
  • .aiox-core/development/tasks/github-devops-pre-push-quality-gate.md
  • .aiox-core/development/tasks/qa-review-story.md
  • .aiox-core/install-manifest.yaml
  • .claude/skills/AIOX/agents/architect/SKILL.md
  • .claude/skills/AIOX/agents/data-engineer/SKILL.md
  • .claude/skills/AIOX/agents/dev/SKILL.md
  • .claude/skills/AIOX/agents/devops/SKILL.md
  • .claude/skills/AIOX/agents/qa/SKILL.md
  • .codex/agents/architect.md
  • .codex/agents/data-engineer.md
  • .codex/agents/dev.md
  • .codex/agents/devops.md
  • .codex/agents/qa.md
  • .gemini/rules/AIOX/agents/architect.md
  • .gemini/rules/AIOX/agents/data-engineer.md
  • .gemini/rules/AIOX/agents/dev.md
  • .gemini/rules/AIOX/agents/devops.md
  • .gemini/rules/AIOX/agents/qa.md
  • .kimi/skills/aiox-architect/SKILL.md
  • .kimi/skills/aiox-data-engineer/SKILL.md
  • .kimi/skills/aiox-dev/SKILL.md
  • .kimi/skills/aiox-devops/SKILL.md
  • .kimi/skills/aiox-qa/SKILL.md
  • tests/unit/quality-gates/cross-platform-coderabbit.test.js

Comment thread .aiox-core/core/orchestration/workflow-executor.js Outdated
Comment on lines +790 to +794
if (mode === 'wsl') {
const wslPath = this.projectRoot
.replace(/^([A-Z]):/, (_, drive) => `/mnt/${drive.toLowerCase()}`)
.replace(/\\/g, '/');
command = `wsl bash -c 'cd "${wslPath}" && ${cliPath} --prompt-only -t uncommitted 2>&1'`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Missing WSL availability check on Windows.

When mode === 'wsl', the code assumes WSL is installed and accessible. If WSL is not available on a Windows system, the error message will be generic ("command not found" at line 821) rather than platform-specific guidance.

Consider adding an explicit WSL availability check on Windows hosts, or enhance the error message to suggest WSL installation when the command fails on win32.

💡 Example WSL availability check
     if (mode === 'wsl') {
+      // Quick check if WSL is available on Windows
+      if (process.platform === 'win32') {
+        try {
+          require('child_process').execSync('wsl --status', { stdio: 'ignore' });
+        } catch {
+          return {
+            success: false,
+            error: 'WSL not available. Install WSL or set installation_mode to "native".',
+            issues: [],
+          };
+        }
+      }
       const wslPath = this.projectRoot
         .replace(/^([A-Z]):/, (_, drive) => `/mnt/${drive.toLowerCase()}`)
         .replace(/\\/g, '/');
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (mode === 'wsl') {
const wslPath = this.projectRoot
.replace(/^([A-Z]):/, (_, drive) => `/mnt/${drive.toLowerCase()}`)
.replace(/\\/g, '/');
command = `wsl bash -c 'cd "${wslPath}" && ${cliPath} --prompt-only -t uncommitted 2>&1'`;
if (mode === 'wsl') {
// Quick check if WSL is available on Windows
if (process.platform === 'win32') {
try {
require('child_process').execSync('wsl --status', { stdio: 'ignore' });
} catch {
return {
success: false,
error: 'WSL not available. Install WSL or set installation_mode to "native".',
issues: [],
};
}
}
const wslPath = this.projectRoot
.replace(/^([A-Z]):/, (_, drive) => `/mnt/${drive.toLowerCase()}`)
.replace(/\\/g, '/');
command = `wsl bash -c 'cd "${wslPath}" && ${cliPath} --prompt-only -t uncommitted 2>&1'`;
🤖 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 @.aiox-core/core/orchestration/workflow-executor.js around lines 790 - 794,
In the mode === 'wsl' branch (where wslPath, command and cliPath are set in the
workflow-executor implementation), add an explicit WSL availability check when
running on Windows (process.platform === 'win32') before constructing/executing
the wsl command: synchronously probe for WSL (e.g., spawnSync('wsl', ['-l']) or
check existence of wsl.exe) and if the check fails throw or return a clear,
platform-specific error suggesting enabling/installing WSL and Windows Subsystem
for Linux components instead of proceeding to run the command; additionally,
when catching failures from executing command, if process.platform === 'win32'
augment the error message to include the same WSL installation guidance so
callers see actionable advice.

Comment thread .aiox-core/core/quality-gates/layer2-pr-automation.js
Comment thread .aiox-core/core/quality-gates/layer2-pr-automation.js Outdated
Comment on lines +14031 to +14051
quality-gate-config:
path: .aiox-core/core/quality-gates/quality-gate-config.yaml
layer: L1
type: module
purpose: Quality Gate Configuration
keywords:
- quality
- gate
- config
- configuration
usedBy: []
dependencies: []
externalDeps: []
plannedDeps: []
lifecycle: orphan
adaptability:
score: 0.4
constraints: []
extensionPoints: []
checksum: sha256:979b60cbf77d0478f8a894a3190299d74c2aa0924bbefe964d2aa402adc3eb33
lastVerified: '2026-05-18T04:51:57.997Z'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restore the new quality-gate config edges in the registry.

This entry is marked as orphaned with no dependers, but this PR’s core behavior change explicitly routes workflow-executor.js and layer2-pr-automation.js through .aiox-core/core/quality-gates/quality-gate-config.yaml. Leaving usedBy, dependencies, and lifecycle disconnected here makes the registry lie about the new runtime contract and will mislead registry-driven tooling.

Also applies to: 10584-10585, 10827-10828

🤖 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 @.aiox-core/data/entity-registry.yaml around lines 14031 - 14051, The
registry entry for quality-gate-config is missing its runtime edges; update the
quality-gate-config entry (symbol: quality-gate-config, path:
.aiox-core/core/quality-gates/quality-gate-config.yaml) to reflect the new
consumers by adding workflow-executor.js and layer2-pr-automation.js to usedBy,
restore any appropriate dependencies in dependencies (or plannedDeps) that those
workflows expect, and change lifecycle from "orphan" to the correct state (e.g.,
"active" or "integrated") so the registry accurately represents the new runtime
contract; apply the same corrections for the other occurrences referenced (the
entries at the mentioned indices).

Comment on lines +340 to +342
2. Feature branches (against `main`):
- macOS/Linux: `~/.local/bin/coderabbit --prompt-only --base main`
- Windows: `wsl bash -c 'cd /mnt/<drive>/<path> && ~/.local/bin/coderabbit --prompt-only --base main'`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid hardcoding main as the review base branch.

Line 341 and Line 342 force --base main, which breaks correctness for repositories whose default branch is master or custom.

Suggested fix
-         - macOS/Linux: `~/.local/bin/coderabbit --prompt-only --base main`
-         - Windows:     `wsl bash -c 'cd /mnt/<drive>/<path> && ~/.local/bin/coderabbit --prompt-only --base main'`
+         - macOS/Linux: `~/.local/bin/coderabbit --prompt-only --base ${DEFAULT_BRANCH:-main}`
+         - Windows:     `wsl bash -c 'cd /mnt/<drive>/<path> && ~/.local/bin/coderabbit --prompt-only --base ${DEFAULT_BRANCH:-main}'`
🤖 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 @.codex/agents/architect.md around lines 340 - 342, The docs hardcode the
review base with the flag `--base main` in the two example commands, which
breaks repos whose default branch is `master` or custom; update those examples
to avoid a hardcoded branch by showing a dynamic/default approach (e.g., omit
`--base` so the tool uses the repository default) or demonstrate using the
repository's current/default branch (e.g., replace `--base main` with a shell
substitution like `--base $(git symbolic-ref --short HEAD)`), and update both
macOS/Linux and Windows examples that contain `--base main`.

Comment on lines +340 to +342
2. Feature branches (against `main`):
- macOS/Linux: `~/.local/bin/coderabbit --prompt-only --base main`
- Windows: `wsl bash -c 'cd /mnt/<drive>/<path> && ~/.local/bin/coderabbit --prompt-only --base main'`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use a default-branch variable instead of hardcoded main.

Line 341 and Line 342 hardcode --base main, which can mis-target reviews in repositories that use a different default branch.

Suggested fix
-         - macOS/Linux: `~/.local/bin/coderabbit --prompt-only --base main`
-         - Windows:     `wsl bash -c 'cd /mnt/<drive>/<path> && ~/.local/bin/coderabbit --prompt-only --base main'`
+         - macOS/Linux: `~/.local/bin/coderabbit --prompt-only --base ${DEFAULT_BRANCH:-main}`
+         - Windows:     `wsl bash -c 'cd /mnt/<drive>/<path> && ~/.local/bin/coderabbit --prompt-only --base ${DEFAULT_BRANCH:-main}'`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
2. Feature branches (against `main`):
- macOS/Linux: `~/.local/bin/coderabbit --prompt-only --base main`
- Windows: `wsl bash -c 'cd /mnt/<drive>/<path> && ~/.local/bin/coderabbit --prompt-only --base main'`
2. Feature branches (against `main`):
- macOS/Linux: `~/.local/bin/coderabbit --prompt-only --base ${DEFAULT_BRANCH:-main}`
- Windows: `wsl bash -c 'cd /mnt/<drive>/<path> && ~/.local/bin/coderabbit --prompt-only --base ${DEFAULT_BRANCH:-main}'`
🤖 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 @.gemini/rules/AIOX/agents/architect.md around lines 340 - 342, Replace the
hardcoded "--base main" in the two command examples (the macOS/Linux example
"~/.local/bin/coderabbit --prompt-only --base main" and the Windows example "wsl
bash -c 'cd /mnt/<drive>/<path> && ~/.local/bin/coderabbit --prompt-only --base
main'") with a default-branch variable/placeholder (e.g., DEFAULT_BRANCH or
{{default_branch}}) and update the surrounding text to instruct users to set
that variable to their repo's default branch; ensure both occurrences use the
exact same placeholder name so reviewers/scripts can reliably substitute it.

Two real bugs CodeRabbit caught + one new regression test:

## Bug 1: ${PROJECT_ROOT} placeholder never expanded

`layer2-pr-automation.js` left `cd ${PROJECT_ROOT}` as a literal placeholder
in the WSL command string. `child_process.spawn` with `shell: true` only
expands env vars that ARE set — PROJECT_ROOT is never set at call sites,
so the cd target was empty and the command silently `cd`'d into the home
directory, then ran coderabbit there instead of in the project root.

Fix: substitute `process.cwd()` (or explicit `coderabbit.projectRoot`)
in-place and convert to `/mnt/<drive>/<path>` for the WSL host. The
resulting command now contains a real absolute path, matching what
`workflow-executor.js` already did via `this.projectRoot`.

## Bug 2: Tilde expansion not reliable in spawn contexts

Both `workflow-executor.js` (uses `child_process.exec`) and
`layer2-pr-automation.js` (uses `spawn { shell: true }`) shipped
`cli_path` literally as `~/.local/bin/coderabbit`. Shell expansion works
when the call goes through a real shell, but the `workflow-executor` path
goes through `execAsync` which is `/bin/sh -c` on POSIX (so OK) but is
host-dependent on Windows (cmd.exe does NOT expand `~`). Programmatic
expansion via `os.homedir() + path.join` removes the ambiguity.

Applied to:
- `.aiox-core/core/orchestration/workflow-executor.js`
- `.aiox-core/core/quality-gates/layer2-pr-automation.js`
- `.aiox-core/development/tasks/github-devops-pre-push-quality-gate.md`
  (kept in sync — same pattern in the doc's inline JS block)

## Regression test added

`cross-platform-coderabbit.test.js`:
- "converts Windows project root to /mnt/<drive>/... inside wsl command"
- "expands tilde (~) in cli_path via os.homedir() — defensive"

Full suite: 10/10 pass (was 8 — +2 new).

## CodeRabbit feedback not addressed (with reason)

- **Helper extraction**: deferred. Two call sites + 16 lines duplicated is
  cheaper to maintain than a new module + import paths + test surface.
  Per advisor guidance — premature abstraction.
- **WSL availability check on Windows**: deferred to a separate issue.
  If `wsl` is not installed on Windows, the user already sees a clear
  `'wsl' is not recognized` error from cmd. Adding a `spawnSync('wsl',
  ['-l'])` probe before every CodeRabbit invocation costs latency on every
  call and replaces one error message with another. Not a regression
  introduced by this PR.
- **Entity-registry dependency cleanup**: the `dependencies: []` zeroed
  on agent personas is a CORRECT consequence of removing `wsl_config:` +
  `installation_mode: wsl` blocks. Those blocks named phantom dependencies
  (Ubuntu distribution, /mnt paths) that the registry interpreted as
  edges. Removing the source removed the edges. The registry is consistent
  with the post-fix state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
coderabbitai[bot]
coderabbitai Bot previously requested changes May 18, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 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 @.aiox-core/core/quality-gates/layer2-pr-automation.js:
- Around line 120-122: The drive-letter replacement only matches uppercase
letters; update the regex used in the wslProjectPath computation (the
.replace(/^([A-Z]):/, (_, drive) => `/mnt/${drive.toLowerCase()}`) call) to be
case-insensitive so lowercase drive letters are handled too (for example use a
case-insensitive flag or allow a-z in the character class) while keeping the
same replacement logic that maps the captured drive to /mnt/{drive}.
- Around line 111-123: The tilde expansion produces a Windows-style path that
breaks inside WSL; change the cliPath logic so that when mode === 'wsl' you do
not expand a leading '~' (i.e. keep rawCliPath as-is when
rawCliPath.startsWith('~')), and ensure the command uses that literal cliPath
(so the WSL shell will expand ~), or alternatively convert any expanded Windows
path into a WSL /mnt/... path before building command; update references in this
block (rawCliPath, cliPath, mode, projectRoot, wslProjectPath, command)
accordingly.
🪄 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: Pro

Run ID: f5d6fdc8-e20b-497b-84d6-915af2227a45

📥 Commits

Reviewing files that changed from the base of the PR and between a74b6fe and f0cc11f.

📒 Files selected for processing (5)
  • .aiox-core/core/orchestration/workflow-executor.js
  • .aiox-core/core/quality-gates/layer2-pr-automation.js
  • .aiox-core/development/tasks/github-devops-pre-push-quality-gate.md
  • .aiox-core/install-manifest.yaml
  • tests/unit/quality-gates/cross-platform-coderabbit.test.js
✅ Files skipped from review due to trivial changes (1)
  • .aiox-core/install-manifest.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • .aiox-core/development/tasks/github-devops-pre-push-quality-gate.md
  • .aiox-core/core/orchestration/workflow-executor.js
  • tests/unit/quality-gates/cross-platform-coderabbit.test.js

Comment thread .aiox-core/core/quality-gates/layer2-pr-automation.js Outdated
Comment thread .aiox-core/core/quality-gates/layer2-pr-automation.js Outdated
…731]

Two more real bugs CodeRabbit caught on the round-1 fix:

## Bug 3: Pre-expanded tilde poisons the WSL command

Round-1 expanded `~` via `os.homedir()` unconditionally — but on Windows
that yields `C:\Users\<user>` (a Windows path). Injecting that into a
`wsl bash -c '...'` command means the cd path inside WSL points at a
Windows path the WSL distribution cannot resolve. The previous round
moved the bug, didn't fix it.

Fix: split the cli_path handling by mode.
- **native mode** (macOS/Linux): expand `~` via `os.homedir() +
  path.join(...)`. The resolved absolute path is shell-agnostic.
- **WSL mode** (Windows or explicit override): keep the literal `~`.
  The WSL distribution's own bash expands it to the WSL user's HOME
  (`/home/<wsl-user>`) — the only correct expansion in that context.

## Bug 4: Drive-letter regex only matched uppercase

`/^([A-Z]):/` rejects `c:\path` (lowercase drive letter from
`process.cwd()` on some configurations / npm test environments).
Changed to `/^([A-Za-z]):/`. Replacement still lowercases the captured
drive (per WSL convention `/mnt/c/...`).

Applied to all three call sites.

## Regression coverage

`cross-platform-coderabbit.test.js` — 2 new tests + 1 reshape:
- "handles lowercase drive letters when converting to /mnt/<drive>/..."
- "keeps tilde (~) literal in cli_path in WSL mode — bash expands it inside WSL"
- "wraps the command... (win32)" now asserts the host's homedir-prefixed
  cli_path does NOT appear in the WSL command (more precise than the
  previous "no homedir" check which was incidentally tripped by cwd).

Full suite: 12/12 pass (was 10 — +2 new).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…#731]

CI's Install Manifest Validation step failed because the IDS-Hook
regenerated `entity-registry.yaml` in the pre-push (after the round-2
commit) but the matching hash in `install-manifest.yaml` was not
updated. `npm run generate:manifest` corrects the drift.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rafaelscosta
rafaelscosta dismissed stale reviews from coderabbitai[bot] and coderabbitai[bot] May 18, 2026 05:32

Round 1 actionables addressed in commit f0cc11f (PROJECT_ROOT substitution + tilde via os.homedir). Round 2 follow-up addressed in commit 5d41445 (WSL tilde literal + lowercase drive regex). Manifest drift fixed in 951de8e. All 4 actionables resolved.

@rafaelscosta
rafaelscosta merged commit 38cfa89 into main May 18, 2026
42 checks passed
@rafaelscosta
rafaelscosta deleted the fix/cross-platform-wsl-731 branch May 18, 2026 05:33
tuanmedeiros pushed a commit to tuanmedeiros/aios-core-synkraay that referenced this pull request Jun 2, 2026
…#731] (SynkraAI#752)

* fix(quality-gates): cross-platform CodeRabbit CLI execution [SynkraAI#731]

Closes SynkraAI#731 (reported by @duboneh).

The CodeRabbit CLI execution paths were hardcoded to assume Windows + WSL
(`wsl bash -c '...'` wrapper, `/mnt/c/...` paths, `installation_mode: wsl`).
On macOS/Linux those commands failed silently and the Layer-2 quality-gate
automation never enforced the review. The auto-healing loop in @dev / @qa /
@devops / @architect / @data-engineer simulated success while doing nothing.

## What changed

Three patterns applied across runtime + config + agent surfaces:

### Pattern 1 — Inline cross-platform branching (runtime)

- `.aiox-core/core/orchestration/workflow-executor.js` (`runCodeRabbitAnalysis`)
- `.aiox-core/core/quality-gates/layer2-pr-automation.js` (`runCodeRabbit`)
- `.aiox-core/development/tasks/github-devops-pre-push-quality-gate.md`
  (`runCodeRabbit` inline code block + error-handler messages)

Default behavior:
- `installation_mode || (process.platform === 'win32' ? 'wsl' : 'native')`.
- `cli_path` defaults to `~/.local/bin/coderabbit`.
- Explicit `installation_mode: 'wsl' | 'native'` still wins (lets ops force
  WSL on macOS for testing, etc).
- Explicit raw `command:` string still wins over `cli_path` (back-compat).

Error-handler messages now switch on `process.platform`: macOS/Linux users
see native recovery commands, Windows users see WSL-wrapped ones.

### Pattern 2 — `wsl_config:` block → `cli_path:` + `platform_notes:`

DELETED `installation_mode: wsl` + `wsl_config:` blocks (no overlay; full
removal) from:
- `.aiox-core/core/quality-gates/quality-gate-config.yaml`
- `.aiox-core/development/agents/dev.md`
- `.aiox-core/development/agents/qa.md`
- `.aiox-core/development/agents/devops.md`

Replaced with:
```yaml
cli_path: ~/.local/bin/coderabbit
platform_notes:
  macos_linux: "Run cli_path directly from project root (no wrapper)."
  windows: "Wrap with 'wsl bash -c' and rewrite project paths to /mnt/<drive>/..."
```

### Pattern 3 — execution_guidelines rewritten neutral

Replaced "CRITICAL: CodeRabbit CLI is installed in WSL, not Windows" + the
"use 'wsl bash -c' wrapper for ALL commands" prescriptions with cross-platform
guidance in 5 agent personas (dev, qa, devops, architect, data-engineer).
`commands:` blocks now have explicit `_native` and `_wsl` template suffixes
so agents can see both shapes side-by-side.

ASCII workflow diagrams updated in:
- `.aiox-core/development/tasks/qa-review-story.md`
- `.aiox-core/development/tasks/dev-develop-story.md`

`environment-bootstrap.md` note also rewritten as cross-platform.

### Regression coverage

`tests/unit/quality-gates/cross-platform-coderabbit.test.js` — 8 tests:
- macOS (darwin) builds native command
- Linux builds native command
- Windows wraps with `wsl bash -c`
- Explicit `installation_mode: 'native'` override on Windows
- Explicit `installation_mode: 'wsl'` override on macOS
- Raw `command:` string override (back-compat)
- Custom `cli_path` honored on macOS
- Custom `cli_path` honored on Windows

Test suite: 8/8 pass.

### IDE projection sync

`npm run sync:ide` propagated the agent persona changes to:
- `.claude/skills/AIOX/agents/{...}/SKILL.md`
- `.codex/agents/*.md`
- `.gemini/rules/AIOX/agents/*.md`
- `.kimi/skills/aiox-{...}/SKILL.md`

109 files synced across 7 IDEs (claude-code, codex, gemini, github-copilot,
cursor, antigravity, kimi). Compatibility Parity Gate + IDE Command Sync
Validation should be green on this branch.

## Validation

- [x] `npm run lint` exit 0
- [x] `npx jest tests/unit/quality-gates/cross-platform-coderabbit.test.js` → 8/8 pass
- [x] `grep -rn 'installation_mode: wsl\b\|wsl_config:' .aiox-core/development/agents/*.md` → zero matches
- [x] All remaining `wsl bash -c` references are Windows-prefixed examples or `_wsl` template suffixes (verified manually)
- [x] `npm run sync:ide` clean — no projection drift

## Out of scope (separate follow-ups)

- The `Cross-Platform (${{ matrix.os }}, Node ${{ matrix.node }})` smoke
  matrix check in CI is `skipping` (unexpanded YAML variable). Unrelated bug.
- `qa/MEMORY.md` mentions `installation_mode: wsl` but is a runtime memory
  file, not config — intentionally left alone (per @advisor guidance).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(ids): regenerate entity-registry after [SynkraAI#731] agent persona changes

Pre-push hook regenerated the registry to reflect the cleanup in agent
personas (removed `installation_mode: wsl` / `wsl_config:` blocks, reworked
usedBy/dependencies for the coderabbit_integration sections). entityCount
815 → 816.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(quality-gates): address CodeRabbit feedback on PR SynkraAI#752 [SynkraAI#731]

Two real bugs CodeRabbit caught + one new regression test:

## Bug 1: ${PROJECT_ROOT} placeholder never expanded

`layer2-pr-automation.js` left `cd ${PROJECT_ROOT}` as a literal placeholder
in the WSL command string. `child_process.spawn` with `shell: true` only
expands env vars that ARE set — PROJECT_ROOT is never set at call sites,
so the cd target was empty and the command silently `cd`'d into the home
directory, then ran coderabbit there instead of in the project root.

Fix: substitute `process.cwd()` (or explicit `coderabbit.projectRoot`)
in-place and convert to `/mnt/<drive>/<path>` for the WSL host. The
resulting command now contains a real absolute path, matching what
`workflow-executor.js` already did via `this.projectRoot`.

## Bug 2: Tilde expansion not reliable in spawn contexts

Both `workflow-executor.js` (uses `child_process.exec`) and
`layer2-pr-automation.js` (uses `spawn { shell: true }`) shipped
`cli_path` literally as `~/.local/bin/coderabbit`. Shell expansion works
when the call goes through a real shell, but the `workflow-executor` path
goes through `execAsync` which is `/bin/sh -c` on POSIX (so OK) but is
host-dependent on Windows (cmd.exe does NOT expand `~`). Programmatic
expansion via `os.homedir() + path.join` removes the ambiguity.

Applied to:
- `.aiox-core/core/orchestration/workflow-executor.js`
- `.aiox-core/core/quality-gates/layer2-pr-automation.js`
- `.aiox-core/development/tasks/github-devops-pre-push-quality-gate.md`
  (kept in sync — same pattern in the doc's inline JS block)

## Regression test added

`cross-platform-coderabbit.test.js`:
- "converts Windows project root to /mnt/<drive>/... inside wsl command"
- "expands tilde (~) in cli_path via os.homedir() — defensive"

Full suite: 10/10 pass (was 8 — +2 new).

## CodeRabbit feedback not addressed (with reason)

- **Helper extraction**: deferred. Two call sites + 16 lines duplicated is
  cheaper to maintain than a new module + import paths + test surface.
  Per advisor guidance — premature abstraction.
- **WSL availability check on Windows**: deferred to a separate issue.
  If `wsl` is not installed on Windows, the user already sees a clear
  `'wsl' is not recognized` error from cmd. Adding a `spawnSync('wsl',
  ['-l'])` probe before every CodeRabbit invocation costs latency on every
  call and replaces one error message with another. Not a regression
  introduced by this PR.
- **Entity-registry dependency cleanup**: the `dependencies: []` zeroed
  on agent personas is a CORRECT consequence of removing `wsl_config:` +
  `installation_mode: wsl` blocks. Those blocks named phantom dependencies
  (Ubuntu distribution, /mnt paths) that the registry interpreted as
  edges. Removing the source removed the edges. The registry is consistent
  with the post-fix state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(quality-gates): CodeRabbit round 2 — WSL tilde + lowercase drive [SynkraAI#731]

Two more real bugs CodeRabbit caught on the round-1 fix:

## Bug 3: Pre-expanded tilde poisons the WSL command

Round-1 expanded `~` via `os.homedir()` unconditionally — but on Windows
that yields `C:\Users\<user>` (a Windows path). Injecting that into a
`wsl bash -c '...'` command means the cd path inside WSL points at a
Windows path the WSL distribution cannot resolve. The previous round
moved the bug, didn't fix it.

Fix: split the cli_path handling by mode.
- **native mode** (macOS/Linux): expand `~` via `os.homedir() +
  path.join(...)`. The resolved absolute path is shell-agnostic.
- **WSL mode** (Windows or explicit override): keep the literal `~`.
  The WSL distribution's own bash expands it to the WSL user's HOME
  (`/home/<wsl-user>`) — the only correct expansion in that context.

## Bug 4: Drive-letter regex only matched uppercase

`/^([A-Z]):/` rejects `c:\path` (lowercase drive letter from
`process.cwd()` on some configurations / npm test environments).
Changed to `/^([A-Za-z]):/`. Replacement still lowercases the captured
drive (per WSL convention `/mnt/c/...`).

Applied to all three call sites.

## Regression coverage

`cross-platform-coderabbit.test.js` — 2 new tests + 1 reshape:
- "handles lowercase drive letters when converting to /mnt/<drive>/..."
- "keeps tilde (~) literal in cli_path in WSL mode — bash expands it inside WSL"
- "wraps the command... (win32)" now asserts the host's homedir-prefixed
  cli_path does NOT appear in the WSL command (more precise than the
  previous "no homedir" check which was incidentally tripped by cwd).

Full suite: 12/12 pass (was 10 — +2 new).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(manifest): regenerate install-manifest hash for entity-registry [SynkraAI#731]

CI's Install Manifest Validation step failed because the IDS-Hook
regenerated `entity-registry.yaml` in the pre-push (after the round-2
commit) but the matching hash in `install-manifest.yaml` was not
updated. `npm run generate:manifest` corrects the drift.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Agent system related area: core Core framework (.aios-core/core/) area: docs Documentation (docs/) type: test Test coverage and quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cross-platform support: CLI commands hardcoded to WSL on macOS/Linux

1 participant