-
Notifications
You must be signed in to change notification settings - Fork 0
Fix TrueForge UI port conflicts, Node 22 segfaults, and CRLF line endings #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ echo "" | |
|
|
||
| echo "[1/6] Checking prerequisites..." | ||
| command -v docker >/dev/null 2>&1 || { echo "Error: docker is required. Install Docker Desktop."; exit 1; } | ||
| if command -v node >/dev/null 2>&1; then echo " - Node: $(node --version)"; else echo "Error: node 18+ is required."; exit 1; fi | ||
| if command -v node >/dev/null 2>&1; then echo " - Node: $(node --version)"; else echo "Error: node 22+ is required."; exit 1; fi | ||
| PYTHON_BIN="$(command -v python3 || command -v python)" | ||
| [ -n "$PYTHON_BIN" ] || { echo "Error: python 3.10+ is required."; exit 1; } | ||
| echo " - Python: $($PYTHON_BIN --version)" | ||
|
|
@@ -64,17 +64,17 @@ echo "" | |
|
|
||
| echo "[5/6] Building and starting the dashboard (background)..." | ||
| (cd apps/dashboard && npm run build) | ||
| (cd apps/dashboard && nohup npm run dev >/tmp/missioncontrol-dashboard.log 2>&1 &) | ||
| (cd apps/dashboard && NEXT_PUBLIC_TRUEFORGE_URL="http://localhost:8790" TRUEFORGE_URL="http://localhost:8790" nohup npm run dev >/tmp/missioncontrol-dashboard.log 2>&1 &) | ||
| sleep 5 | ||
| echo " Dashboard built and starting on http://localhost:3001 (log: /tmp/missioncontrol-dashboard.log)" | ||
| echo "" | ||
|
|
||
| echo "[6/6] Starting TrueForge agent runtime..." | ||
| if command -v npx >/dev/null 2>&1; then | ||
| echo " Starting TrueForge in background..." | ||
| nohup npx @truefoundry/trueforge >/tmp/missioncontrol-trueforge.log 2>&1 & | ||
| nohup npx -y @truefoundry/trueforge >/tmp/missioncontrol-trueforge.log 2>&1 & | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: This direct startup path does not source Severity Level: Major
|
||
| sleep 3 | ||
| echo " TrueForge starting on http://localhost:3000 (log: /tmp/missioncontrol-trueforge.log)" | ||
| echo " TrueForge starting on http://localhost:8790 (log: /tmp/missioncontrol-trueforge.log)" | ||
| else | ||
| echo " npx not found - run 'npx @truefoundry/trueforge' manually" | ||
| fi | ||
|
|
@@ -84,7 +84,7 @@ echo "=========================================" | |
| echo " MissionControl is ready!" | ||
| echo "=========================================" | ||
| echo "" | ||
| echo " TrueForge UI: http://localhost:3000 (after 'npx @truefoundry/trueforge')" | ||
| echo " TrueForge UI: http://localhost:8790 (after 'npx @truefoundry/trueforge')" | ||
| echo " Dashboard: http://localhost:3001" | ||
| echo " MCP endpoint: http://localhost:8000/mcp" | ||
| echo " REST API: http://localhost:8001" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,20 +55,20 @@ if ($out -eq "200") { Write-Host " LiteLLM: UP" -ForegroundColor Green } | |
| else { Write-Host " LiteLLM: FAILED to start (check WSL ~/litellm.log)" -ForegroundColor Red } | ||
|
|
||
| # ---------------------------------------------------------------- [4/8] | ||
| Write-Host "[4/8] Starting TrueForge (WSL :3000)..." | ||
| Write-Host "[4/8] Starting TrueForge (WSL :8790)..." | ||
| $out = "" | ||
| try { $out = (wsl -e bash -lc "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3000 --max-time 4") } catch { $out = "000" } | ||
| try { $out = (wsl -e bash -lc "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8790 --max-time 4") } catch { $out = "000" } | ||
| if ($out -ne "200") { | ||
| wsl -e bash -lc "setsid -f -- bash '$tfRunScript' </dev/null > $tfLog 2>&1" | ||
| $up = $false | ||
| foreach ($i in 1..24) { | ||
| Start-Sleep -Seconds 5 | ||
| $out = wsl -e bash -lc "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3000 --max-time 4" | ||
| $out = wsl -e bash -lc "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8790 --max-time 4" | ||
| if ($out -eq "200") { $up = $true; break } | ||
| } | ||
| if (-not $up) { Write-Host " TrueForge: FAILED (check WSL ~/tf.log)" -ForegroundColor Red } | ||
| } | ||
| $out = wsl -e bash -lc "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3000 --max-time 4" | ||
| $out = wsl -e bash -lc "curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8790 --max-time 4" | ||
| if ($out -eq "200") { Write-Host " TrueForge: UP" -ForegroundColor Green } | ||
|
|
||
| # ---------------------------------------------------------------- [5/8] | ||
|
|
@@ -94,15 +94,15 @@ if ($conn) { | |
| # ---------------------------------------------------------------- [6/8] | ||
| Write-Host "[6/8] Keeping TrueForge MCP registration pointed at this machine..." | ||
| try { | ||
| $mcp = Invoke-RestMethod "http://${wslIp}:3000/api/v1/settings/mcp-servers" -TimeoutSec 10 | ||
| $mcp = Invoke-RestMethod "http://${wslIp}:8790/api/v1/settings/mcp-servers" -TimeoutSec 10 | ||
| $current = ($mcp | ConvertTo-Json -Depth 6) | ||
| $want = "http://${gw}:8000/mcp" | ||
| if ($current -notmatch [regex]::Escape($want)) { | ||
| $body = @{ manifest = @{ | ||
| type = "remote"; name = "demo-infra"; url = $want | ||
| description = "Simulated production infra: 4 services with metrics, logs, deploys, chaos injection and approval-gated rollback/restart tools." | ||
| } } | ConvertTo-Json -Depth 6 | ||
| Invoke-RestMethod -Method Put -Uri "http://${wslIp}:3000/api/v1/settings/mcp-servers" ` | ||
| Invoke-RestMethod -Method Put -Uri "http://${wslIp}:8790/api/v1/settings/mcp-servers" ` | ||
| -ContentType "application/json" -Body $body -TimeoutSec 15 | Out-Null | ||
| Write-Host " MCP registration updated -> $want" -ForegroundColor Yellow | ||
| } else { | ||
|
|
@@ -127,7 +127,7 @@ if (Test-Path $envFile) { | |
| # when a variable is missing. The replacement loop emits only the new | ||
| # value so stale lines are replaced, never duplicated. | ||
| foreach ($key in @("TRUEFORGE_URL", "NEXT_PUBLIC_TRUEFORGE_URL")) { | ||
| $newVal = "${key}=http://${wslIp}:3000" | ||
| $newVal = "${key}=http://${wslIp}:8790" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The new per-key value check does not make the subsequent Severity Level: Major
|
||
| if ($newTxt -notmatch [regex]::Escape($newVal)) { | ||
| if ($newTxt -match "^${key}=") { | ||
| $newTxt = (($newTxt -split "`r?`n") | ForEach-Object { | ||
|
|
@@ -179,7 +179,7 @@ try { | |
|
|
||
| Write-Host "" | ||
| Write-Host "=== READY ===" -ForegroundColor Cyan | ||
| $tfUrl = "http://${wslIp}:3000" | ||
| $tfUrl = "http://${wslIp}:8790" | ||
| Write-Host " Dashboard : http://localhost:3001" | ||
| Write-Host " TrueForge UI : ${tfUrl}" | ||
| Write-Host " MCP endpoint : http://localhost:8000/mcp" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,4 +27,4 @@ fi | |
|
|
||
| cd "$HOME" | ||
| export HOST=0.0.0.0 | ||
| exec npx -y @truefoundry/trueforge --port 3000 | ||
| exec npx -y @truefoundry/trueforge | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The WSL setup installs Severity Level: Major
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ Write-Host "=========================================" | |
| Write-Host "" | ||
|
|
||
| # Step 1: Check Docker | ||
| Write-Host "[1/6] Checking Docker..." -ForegroundColor Yellow | ||
| Write-Host "[1/7] Checking Docker..." -ForegroundColor Yellow | ||
| try { | ||
| docker info > $null 2>&1 | ||
| if ($LASTEXITCODE -ne 0) { throw } | ||
|
|
@@ -24,12 +24,12 @@ try { | |
| } | ||
|
|
||
| # Step 2: Start containers | ||
| Write-Host "[2/6] Starting containers..." -ForegroundColor Yellow | ||
| Write-Host "[2/7] Starting containers..." -ForegroundColor Yellow | ||
| docker compose up -d --build 2>&1 | Out-Null | ||
| Write-Host " PostgreSQL, Redis, MCP server started" -ForegroundColor Green | ||
|
|
||
| # Step 3: Wait for health | ||
| Write-Host "[3/6] Waiting for MCP server..." -ForegroundColor Yellow | ||
| Write-Host "[3/7] Waiting for MCP server..." -ForegroundColor Yellow | ||
| $retries = 0 | ||
| while ($retries -lt 15) { | ||
| try { | ||
|
|
@@ -46,53 +46,49 @@ if ($retries -ge 15) { | |
| } | ||
|
|
||
| # Step 4: Start dashboard | ||
| Write-Host "[4/6] Starting dashboard..." -ForegroundColor Yellow | ||
| Write-Host "[4/7] Starting dashboard..." -ForegroundColor Yellow | ||
| $dashboardDir = Join-Path $PSScriptRoot "apps\dashboard" | ||
| if (-not (Test-Path "$dashboardDir\node_modules")) { | ||
| Push-Location $dashboardDir | ||
| npm install --silent 2>&1 | Out-Null | ||
| Pop-Location | ||
| } | ||
| Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$dashboardDir'; npm run dev" | ||
| Start-Process powershell -ArgumentList "-NoExit", "-Command", "`$env:NEXT_PUBLIC_TRUEFORGE_URL='http://localhost:8790'; `$env:TRUEFORGE_URL='http://localhost:8790'; cd '$dashboardDir'; npm run dev" | ||
| Write-Host " Dashboard starting on http://localhost:3001" -ForegroundColor Green | ||
|
|
||
| # Step 5: Setup WSL - install Linux-native Node.js | ||
| Write-Host "[5/6] Setting up WSL..." -ForegroundColor Yellow | ||
| $wslLinuxNode = wsl -d Ubuntu -- bash -c 'test -f /usr/bin/node && echo ok || echo missing' | ||
| if ($wslLinuxNode -match "missing") { | ||
| Write-Host " Installing Node.js 22 in WSL (first time only)..." -ForegroundColor Yellow | ||
| wsl -d Ubuntu -- bash -c 'curl -fsSL https://deb.nodesource.com/setup_22.x -o /tmp/ns.sh' | ||
| wsl -d Ubuntu -- bash -c 'sudo bash /tmp/ns.sh' | ||
| wsl -d Ubuntu -- bash -c 'sudo apt-get install -y nodejs' | ||
| Write-Host " Node.js installed in WSL" -ForegroundColor Green | ||
| # Step 5: Setup WSL - install Linux-native Node.js 22 locally | ||
| Write-Host "[5/7] Setting up WSL..." -ForegroundColor Yellow | ||
| $localNode = wsl -d Ubuntu -- bash -c 'if [ -x ~/.local/node/bin/node ]; then ~/.local/node/bin/node -v; fi' | ||
| if ($localNode -match "v22") { | ||
| Write-Host " WSL Node.js 22 already installed locally" | ||
| } else { | ||
| Write-Host " WSL Node.js already installed" -ForegroundColor Green | ||
| Write-Host " Installing Node.js 22 in WSL (~/.local/node)..." | ||
| wsl -d Ubuntu -- bash -c 'mkdir -p ~/.local/node && curl -fsSL https://nodejs.org/dist/v22.14.0/node-v22.14.0-linux-x64.tar.gz | tar -xz -C ~/.local/node --strip-components=1' | ||
|
Comment on lines
+65
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 5. Arm64 wsl downloads x64 The Windows setup unconditionally downloads the linux-x64 Node archive, which cannot run in an ARM64 WSL distribution. On Windows-on-ARM systems, the subsequent npm and TrueForge steps therefore fail instead of installing the matching ARM64 build. Agent Prompt
|
||
| } | ||
|
|
||
| # Step 6: Install TrueForge in WSL | ||
| Write-Host "[6/6] Setting up TrueForge in WSL..." -ForegroundColor Yellow | ||
| $wslTf = wsl -d Ubuntu -- bash -c 'command -v trueforge 2>/dev/null || echo missing' | ||
| if ($wslTf -match "missing") { | ||
| Write-Host " Installing TrueForge in WSL (first time only)..." -ForegroundColor Yellow | ||
| wsl -d Ubuntu -- bash -c 'export PATH=/usr/bin:/usr/local/bin:$PATH && npm install -g @truefoundry/trueforge' | ||
| Write-Host " TrueForge installed in WSL" -ForegroundColor Green | ||
| } else { | ||
| Write-Host "[6/7] Setting up TrueForge in WSL..." -ForegroundColor Yellow | ||
| $tfInstalled = wsl -d Ubuntu -- bash -c 'export PATH=~/.local/node/bin:"$PATH" && npm list -g @truefoundry/trueforge >/dev/null 2>&1 && echo "yes" || echo "no"' | ||
| if ($tfInstalled -match "yes") { | ||
| Write-Host " TrueForge already installed in WSL" -ForegroundColor Green | ||
| } else { | ||
| Write-Host " Installing @truefoundry/trueforge in WSL..." | ||
| wsl -d Ubuntu -- bash -c 'export PATH=~/.local/node/bin:"$PATH" && npm install -g @truefoundry/trueforge' | ||
| Write-Host " TrueForge installed in WSL" -ForegroundColor Green | ||
| } | ||
|
|
||
| # Step 7: Start TrueForge | ||
| Write-Host "[7/7] Starting TrueForge in WSL..." -ForegroundColor Yellow | ||
| Start-Process powershell -ArgumentList "-NoExit", "-Command", "wsl -- bash -c 'cd `"/mnt/c/Users/adity/Documents/Mission Control/scripts/wsl`" && bash start-trueforge.sh'" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Checkout path is hard-coded Step 7 always changes into one developer's /mnt/c/Users/adity/Documents/Mission Control checkout, so every clone at a different username, drive, or directory fails the cd and never starts TrueForge. This makes the advertised one-command startup unusable for a normal clean checkout. Agent Prompt
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Setup and launch differ Steps 5–6 install Node and TrueForge specifically into the Ubuntu WSL distro, but Step 7 launches the default distro by omitting -d Ubuntu. When another distro is the default, startup runs where the installed runtime and package do not exist and TrueForge fails to launch. Agent Prompt
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The launcher uses a checkout path belonging to one developer instead of deriving the repository location from Severity Level: Critical 🚨- ❌ TrueForge cannot start from ordinary clone locations.
- ❌ Windows one-click startup fails for other developers.
- ⚠️ Success output incorrectly reports TrueForge as starting.Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** start.ps1
**Line:** 82:82
**Comment:**
*Api Mismatch: The launcher uses a checkout path belonging to one developer instead of deriving the repository location from `$PSScriptRoot`. On any other machine or clone location, WSL changes into a nonexistent directory and cannot find `start-trueforge.sh`, so TrueForge never starts. Resolve the Windows repository path dynamically and convert it to a WSL path.
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 |
||
| Write-Host " TrueForge starting on http://localhost:8790" -ForegroundColor Green | ||
|
|
||
| # Done | ||
| Write-Host "" | ||
| Write-Host "=========================================" -ForegroundColor Green | ||
| Write-Host " Everything is running!" -ForegroundColor Green | ||
| Write-Host "=========================================" -ForegroundColor Green | ||
| Write-Host "" | ||
| Write-Host " Now start TrueForge manually:" -ForegroundColor Cyan | ||
| Write-Host " 1. Open a NEW terminal" -ForegroundColor White | ||
| Write-Host " 2. Type: wsl" -ForegroundColor White | ||
| Write-Host " 3. Type: cd ~" -ForegroundColor White | ||
| Write-Host " 4. Type: npx @truefoundry/trueforge" -ForegroundColor White | ||
| Write-Host "" | ||
| Write-Host " Then in TrueForge UI (http://localhost:3000):" -ForegroundColor Cyan | ||
| Write-Host " Then in TrueForge UI (http://localhost:8790):" -ForegroundColor Cyan | ||
| Write-Host " 1. Add your OpenAI API key" -ForegroundColor White | ||
| Write-Host " 2. Add MCP server -> http://localhost:8000/mcp" -ForegroundColor White | ||
| Write-Host " 3. Create agent 'missioncontrol'" -ForegroundColor White | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: The prerequisite check only tests whether
nodeexists, despite requiring Node 22+ in its error message and installing a runtime that depends on that version. Node 20 or older passes this check and setup proceeds until a later build or TrueForge invocation fails. Parsenode --versionand reject versions below 22 at the prerequisite boundary. [incorrect condition logic]Severity Level: Major⚠️
Prompt for AI Agent 🤖