feat: WSL + TrueForge setup - #10
Conversation
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
PR Summary by QodoAdd WSL provisioning and TrueForge to Windows startup
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
|
Failed to generate code suggestions for PR |
| $wslStatus = wsl -l --running 2>&1 | ||
| Write-Host " WSL is available" -ForegroundColor Green |
There was a problem hiding this comment.
Suggestion: wsl -l --running is a native command, and a nonzero native exit code does not reliably become a terminating PowerShell error under $ErrorActionPreference = "Stop". Consequently, WSL can be unavailable while the script prints WSL is available and proceeds. Check $LASTEXITCODE explicitly before declaring WSL available. [incorrect condition logic]
Severity Level: Major ⚠️
- ⚠️ Missing WSL is reported as a successful prerequisite check.
- ⚠️ Subsequent setup errors obscure the actual installation problem.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** setup-wsl.ps1
**Line:** 13:14
**Comment:**
*Incorrect Condition Logic: `wsl -l --running` is a native command, and a nonzero native exit code does not reliably become a terminating PowerShell error under `$ErrorActionPreference = "Stop"`. Consequently, WSL can be unavailable while the script prints `WSL is available` and proceeds. Check `$LASTEXITCODE` explicitly before declaring WSL available.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix|
|
||
| # Install Node.js in WSL | ||
| Write-Host "[2/3] Installing Node.js in WSL (if needed)..." -ForegroundColor Yellow | ||
| wsl -d Ubuntu -- bash -c "which node >/dev/null 2>&1 || (curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs)" |
There was a problem hiding this comment.
Suggestion: This assumes a distribution registered exactly as Ubuntu, but the preceding check only verifies that WSL exists and does not verify that this distribution is installed. On systems using another distribution or registration name, both setup commands fail while the script continues and reports success. Detect an installed distribution or make the distribution an explicit validated parameter. [platform compatibility]
Severity Level: Major ⚠️
- ⚠️ Setup fails for non-Ubuntu WSL distributions.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** setup-wsl.ps1
**Line:** 23:23
**Comment:**
*Platform Compatibility: This assumes a distribution registered exactly as `Ubuntu`, but the preceding check only verifies that WSL exists and does not verify that this distribution is installed. On systems using another distribution or registration name, both setup commands fail while the script continues and reports success. Detect an installed distribution or make the distribution an explicit validated parameter.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| wsl -d Ubuntu -- bash -c "npm install -g @truefoundry/trueforge 2>/dev/null || true" | ||
| Write-Host " TrueForge ready in WSL" -ForegroundColor Green |
There was a problem hiding this comment.
Suggestion: The || true deliberately converts every TrueForge installation failure into a successful shell exit. Registry failures, permissions errors, and missing prerequisites are therefore hidden, after which the script unconditionally claims that TrueForge is ready. Remove the failure suppression and verify the executable before reporting completion. [error handling]
Severity Level: Major ⚠️
- ⚠️ TrueForge setup failures are reported as successful.
- ❌ The documented TrueForge startup command may be unavailable.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** setup-wsl.ps1
**Line:** 28:29
**Comment:**
*Error Handling: The `|| true` deliberately converts every TrueForge installation failure into a successful shell exit. Registry failures, permissions errors, and missing prerequisites are therefore hidden, after which the script unconditionally claims that TrueForge is ready. Remove the failure suppression and verify the executable before reporting completion.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| docker compose up -d --build 2>&1 | Out-Null | ||
| Write-Host " PostgreSQL, Redis, MCP server started" -ForegroundColor Green |
There was a problem hiding this comment.
Suggestion: The Compose command's output is discarded and its exit status is never checked, so build failures, port conflicts, and invalid Compose configuration are followed by a false started message. The subsequent script continues launching dependent services against infrastructure that may not exist. Check the native command result and stop on failure. [error handling]
Severity Level: Critical 🚨
- ❌ Core containers may not start while startup reports success.
- ⚠️ Dependent health checks and services run against missing infrastructure.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** start.ps1
**Line:** 28:29
**Comment:**
*Error Handling: The Compose command's output is discarded and its exit status is never checked, so build failures, port conflicts, and invalid Compose configuration are followed by a false `started` message. The subsequent script continues launching dependent services against infrastructure that may not exist. Check the native command result and stop on failure.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| $wslNode = wsl -d Ubuntu -- bash -c "which node 2>/dev/null" | ||
| if (-not $wslNode) { | ||
| Write-Host " Installing Node.js in WSL..." -ForegroundColor Yellow | ||
| wsl -d Ubuntu -- bash -c "curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs" 2>&1 | Out-Null |
There was a problem hiding this comment.
Suggestion: Both WSL installation commands suppress their output, and the script only checks for Node and TrueForge before attempting installation. If either installation fails, the script still opens a terminal and reports success without rechecking availability, leaving the user with a terminal in which the documented npx command may fail. Check each command's exit status and verify the installed command afterward. [error handling]
Severity Level: Major ⚠️
- ❌ TrueForge cannot start when Node installation fails.
- ⚠️ Users receive a ready-state message for an unusable terminal.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** start.ps1
**Line:** 64:64
**Comment:**
*Error Handling: Both WSL installation commands suppress their output, and the script only checks for Node and TrueForge before attempting installation. If either installation fails, the script still opens a terminal and reports success without rechecking availability, leaving the user with a terminal in which the documented `npx` command may fail. Check each command's exit status and verify the installed command afterward.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
Code Review by Qodo
1. MCP URL targets WSL itself
|
| Write-Host "" | ||
| Write-Host " Then in TrueForge UI (http://localhost:3000):" -ForegroundColor Cyan | ||
| Write-Host " 1. Add your OpenAI API key" -ForegroundColor White | ||
| Write-Host " 2. Add MCP server -> http://localhost:8000/mcp" -ForegroundColor White |
There was a problem hiding this comment.
1. Mcp url targets wsl itself 🐞 Bug ≡ Correctness
TrueForge runs inside WSL, so registering http://localhost:8000/mcp makes its backend target WSL rather than the MCP port published on the Windows host. Under the repository's intended WSL NAT setup this prevents TrueForge from connecting to the MCP server.
Agent Prompt
## Issue description
TrueForge runs in WSL, but the instructed MCP URL uses `localhost`, which resolves inside WSL rather than to the Windows-hosted Docker port.
## Issue Context
The existing full launcher derives the Windows gateway from WSL and registers the MCP endpoint with that address.
## Fix Focus Areas
- start.ps1[83-85]
- scripts/start-all.ps1[40-44]
- scripts/start-all.ps1[95-107]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
|
||
| # Install Node.js in WSL | ||
| Write-Host "[2/3] Installing Node.js in WSL (if needed)..." -ForegroundColor Yellow | ||
| wsl -d Ubuntu -- bash -c "which node >/dev/null 2>&1 || (curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs)" |
There was a problem hiding this comment.
2. Distro name is hard-coded 🐞 Bug ☼ Reliability
Every new WSL operation requires a registered distro named exactly Ubuntu, so valid setups using Ubuntu-22.04, Debian, or another configured default distro fail. The initial generic WSL check does not verify that this exact distro exists.
Agent Prompt
## Issue description
The scripts hard-code `-d Ubuntu`, excluding valid WSL installations whose distro has another registered name.
## Issue Context
Repository WSL launchers already use the configured default distro through `wsl -e`; alternatively, validate and accept an explicit distro parameter.
## Fix Focus Areas
- setup-wsl.ps1[10-28]
- start.ps1[59-71]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| wsl -d Ubuntu -- bash -c "npm install -g @truefoundry/trueforge 2>/dev/null || true" | ||
| Write-Host " TrueForge ready in WSL" -ForegroundColor Green |
There was a problem hiding this comment.
3. Setup masks installation failure 🐞 Bug ☼ Reliability
setup-wsl.ps1 converts every TrueForge npm failure into success with || true and then unconditionally prints that TrueForge is ready. A network, npm, permission, or package failure therefore produces a completed setup whose documented launch command may not work.
Agent Prompt
## Issue description
The TrueForge install suppresses stderr and forces a successful shell status, causing false setup success.
## Issue Context
Preserve npm diagnostics, check the native exit code, and verify the executable or package before printing readiness.
## Fix Focus Areas
- setup-wsl.ps1[26-33]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| wsl -d Ubuntu -- bash -c "npm install -g @truefoundry/trueforge" 2>&1 | Out-Null | ||
| } | ||
| Start-Process powershell -ArgumentList "-NoExit", "-Command", "wsl -d Ubuntu" | ||
| Write-Host " TrueForge terminal opened (WSL)" -ForegroundColor Green |
There was a problem hiding this comment.
4. Startup ignores install failures 🐞 Bug ☼ Reliability
The new startup step discards Node and TrueForge installation output without checking $LASTEXITCODE, then opens WSL and reports success regardless of either result. Because native-command nonzero exits are not handled here, routine download, apt, sudo, or npm failures leave the promised TrueForge environment unusable.
Agent Prompt
## Issue description
The startup path continues and reports a working TrueForge terminal after failed WSL installation commands.
## Issue Context
Check `$LASTEXITCODE` after each WSL probe/install, surface captured diagnostics, and stop with an actionable error before opening the terminal when setup failed.
## Fix Focus Areas
- start.ps1[61-72]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
User description
Adds WSL setup for TrueForge to start script.
CodeAnt-AI Description
Add automatic WSL setup and launch TrueForge during local startup
What Changed
stop.ps1Impact
✅ One-command TrueForge setup✅ Faster local environment startup✅ Clearer agent configuration steps💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.