BossAgents × ChipWise Engine Installation and Troubleshooting Complete Record

BossAgents × ChipWise Engine Installation and Troubleshooting Complete Record

I. Environment Information

ItemValue
OSWindows 10/11
WSLUbuntu-22.04 (User: andyy1976)
GPURTX 3080
CPUi7-10700K
RAM32GB
Node.jsv24.14.0
BossAgents Port3006
MTClaw Port18790
Ollama Port11434

II. Issues Resolved (Sorted by Severity)

P0: Server Freeze (Response > 2 minutes)

Root Cause: /api/boss/risks calling detectRisksFromLogs(7) queried the audit_logs table for 10.7 million records without a LIMIT, returning 850k records.

Fix:

  • Added limit=100 parameter to detectRisksFromLogs
  • Removed duplicate detectRisksFromLogs calls in boss.js
  • Cleaned 10.7 million old audit logs (retained 17), VACUUM compressed
  • Audit log retention period shortened from 30 days to 3 days
  • Result: Response time reduced from >2 minutes to 21ms

P0: All ChipWise API calls timed out

Root cause:

  1. chipwise-routes.js:42 — handleChipwiseRoutes is not an async function but uses await, SyntaxError caused all requests to hang
  2. server.js:3705 — Every request deletes require.cache and reloads the module chain
  3. Health endpoint times out in 5 seconds, but WSL detection takes 30+ seconds

Fix:

  • Changed handleChipwiseRoutes to an async function
  • Removed delete require.cache hot reloading
  • Increased health timeout from 5s to 120s
  • create endpoint arch_params now supports direct parameter passing (body.arch_params || body)

P1: LLM call chain dead loop (single call >30 seconds)

Root cause: Global _selected: "cloudbase" caused call chain cloudbase(429)→ollama→deepseek(402)→sensenova, each failed model waits 60 seconds before timeout.

Fix:

  • ChipWise independent model priority: identify uses ollama→sensenova (speed priority), create uses sensenova→ollama (strength priority)
  • callLLM adds a noFallback option to skip global fallback chain when the specified provider fails
  • Ollama local service (localhost/127.0.0.1) exempt from API Key validation
  • Ollama model changed from gemma3:4b to qwen2:7b (the actually installed model)
  • identify timeout 15s, create timeout 120s
  • Result: identify reduced from 30s+ to 6s, create reduced from 30s+ to actual LLM inference time

P1: Entire EDA toolchain unavailable

Root cause: Windows cannot directly run Linux EDA tools, requires WSL as intermediary.

Fix:

  • Install WSL Ubuntu 22.04 + conda + EDA tools
  • Create wsl-eda.sh wrapper script (sets PATH then exec command)
  • eda-toolchain.js adds WSL execution support (_checkWslAvailable, _execWsl, _toWslPath, _runTool)
  • WSL detection timeout 30 seconds (slow conda initialization)
  • runIverilog/runVerible/runYosys automatically calls checkToolAvailability for re-detection when cache is unavailable
  • Key: execSync is the only reliable method for WSL execution in this scenario; spawn/execFile are not usable here

P1: Session SESSION messages mixed in

Root cause: currentSessionMessages not handled correctly when null.

Fix:

  • Return empty array when null
  • Change === undefined to == null
  • loadHistory loads only when currentSessionId is null

P2: LLM-generated RTL compilation failure

Root cause:

  1. LLM wraps code in markdown (\\\verilog)
  2. LLM generates nested module structures (module riscv_top { module if_stage {...} }), which Verilog does not allow
  3. _parseModules uses lazy regex [\s\S]*?endmodule causing nested matching errors
  4. Temperature too high causing incomplete code

Fix:

  • Change _parseModules to split by depth pairing of module/endmodule (counting depth)
  • Clean up markdown code blocks (\\\verilog → empty)
  • Clean up markdown headings (### MODULE: → // MODULE:)
  • Change prompt to English, enforce single-file output, prohibit omission, submodules defined before top-level
  • Reduce Temperature from 0.2 to 0.1
  • If compilation fails, fall back to verified POC rv32i_top.v, then rerun iverilog+verible+yosys after fallback

P2: Demo page data is not real

Fix list:

  • Reduce MTClaw L1 routing from 38 words to 12 words
  • Remove fixed 85% from cost-optimizer
  • Unify GET/POST dual architecture
  • Fix doc-worker internal mode
  • Unify three employee definitions (YAML as single source of truth)
  • Supplier data annotation source
  • Label mall prices as 'Reference Price'
  • Calculate speedup based on real measurement data

P2: EDA verification hardcoded POC

Root cause: Frontend verify button hardcodes rv32i_top.v and 4069 cells/992 FF.

Fix:

  • Use code_path returned by create API and real compile/lint/synthesis results
  • Yosys synthesis data dynamically fetched via API
  • Synthesis report dynamically generated

III. EDA Tool Installation Steps

3.1 WSL Ubuntu 22.04

# 安装WSL(如未安装)
wsl --install -d Ubuntu-22.04

# 首次启动设置用户名密码
wsl -d Ubuntu-22.04

3.2 Conda + EDA工具

# 在WSL中安装miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

# 安装EDA工具
conda install -c conda-forge iverilog    # v11.0
conda install -c conda-forge yosys        # v0.51
conda install -c conda-forge verible      # v2024-06-10
conda install -c conda-forge gtkwave      # 可选

3.3 RISC-V工具链

# 预编译工具链
cd ~
wget https://github.com/stnol/riscv-toolchain-gcc-precompiled/releases/download/v16.1.0/riscv64-unknown-elf-gcc-v16.1.0-2024-09-07-linux-ubuntu-22.04.tar.xz
tar xf riscv64-unknown-elf-gcc-*.tar.xz
# 解压到 ~/riscv-toolchain/

3.4 Wrapper脚本

Create /home/andyy1976/wsl-eda.sh:

#!/bin/bash
export PATH="/home/andyy1976/miniconda3/bin:/home/andyy1976/riscv-toolchain/bin:$PATH"
exec "$@"
chmod +x /home/andyy1976/wsl-eda.sh

3.5 验证安装

wsl -d Ubuntu-22.04 -- /home/andyy1976/wsl-eda.sh iverilog -V
wsl -d Ubuntu-22.04 -- /home/andyy1976/wsl-eda.sh yosys --version
wsl -d Ubuntu-22.04 -- /home/andyy1976/wsl-eda.sh verible-verilog-lint --version
wsl -d Ubuntu-22.04 -- /home/andyy1976/wsl-eda.sh riscv64-unknown-elf-gcc --version

四、配置文件修改

4.1 models.json 关键修改

{
  "_selected": "cloudbase",  // 全局默认,不要改(其他数字员工用)
  "ollama": {
    "model": "qwen2:7b",    // 改为实际安装的模型(原为gemma3:4b)
    "key": ""               // 空key,Ollama不需要
  }
}

4.2 环境变量

# ChipWise LLM配置(可选,有默认值)
CHIPWISE_LLM_PRIORITY=ollama,sensenova    # identify优先级
CHIPWISE_CREATE_PRIORITY=sensenova,ollama  # create优先级
CHIPWISE_LLM_TIMEOUT_MS=15000             # identify超时
CHIPWISE_LLM_LONG_TIMEOUT_MS=120000       # create超时

4.3 Ollama模型

# 安装Ollama模型
ollama pull qwen2:7b
# 确认可用
curl http://localhost:11434/api/tags

五、重装注意事项

5.1 必须先启动WSL

最重要:BossAgents服务器启动时检测EDA工具,如果WSL未运行,_wslAvailable缓存为false,后续所有EDA操作都会失败。

# 启动服务器前必须先启动WSL
wsl -d Ubuntu-22.04 -- echo "WSL OK"
# 然后启动服务器
node server.js

5.2 WSL conda初始化慢

首次WSL命令需~30秒(conda activate慢)。eda-toolchain.js的WSL检测超时设为30秒。如果超时,EDA工具会显示不可用,但后续调用时会自动重新检测。

5.3 LLM API Balance

| Model | Status | Description |

|------|------|------|

| SenseNova | ✅ Available | The only available cloud LLM |

| Ollama | ✅ Available | Local on-device, requires Ollama service running |

| CloudBase | ❌ 429 | Quota exceeded, unavailable |

| DeepSeek | ❌ 402 | Insufficient balance, unavailable |

After reinstallation, confirm the SenseNova API Key is valid (in models.json).

5.4 Node.js execSync is the only reliable method for WSL

  • execFile/exec behave abnormally with wsl.exe (callback stdout is empty)
  • spawn returns code null in the context of eda-toolchain require
  • Only execSync is usable

5.5 Windows double quotes conflict with bash -c

# 错误:cmd.exe吃掉双引号导致bash解析错误
cmd.exe /c "wsl.exe -d Ubuntu-22.04 -e bash -c "export PATH=...""

# 正确:使用wrapper脚本
wsl.exe -d Ubuntu-22.04 -e bash -c "/home/andyy1976/wsl-eda.sh iverilog -V"

5.6 WSL路径转换

Windows路径 D:\bossagents\data\chipwise\workspace\rv32i_top.v 在WSL中为 /mnt/d/bossagents/data/chipwise/workspace/rv32i_top.v。eda-toolchain.js的 _toWslPath 自动处理此转换。

5.7 POC File

D:\bossagents\data\chipwise\workspace\rv32i_top.v is a pre-verified RISC-V processor RTL (93 lines, iverilog✅ verible✅ yosys 4069cells/992FF). It serves as the fallback dependency when LLM generation fails and must not be deleted.

5.8 Demo Fallback Cache

D:\bossagents\data\chipwise\demo_result.json contains pre-cached identify and create results. The frontend uses it only when demo=true and module_count=0 (complete failure).

5.9 sudo Password Required

The sudo password for WSL user andyy1976 is unknown. All tool installations must be via conda (no sudo required) or pre-compiled binaries.

5.10 Server Startup Sequence

1. 启动WSL:  wsl -d Ubuntu-22.04 -- echo "WSL OK"
2. 启动Ollama:  ollama serve  (或确认已运行)
3. 启动BossAgents:  node server.js
4. 访问演示:  https://ylxt.chat/chipwise-demo

六、Git提交记录

724a0a4a fix: _parseModules按module/endmodule深度配对拆分,修复嵌套模块解析
66734a20 fix: EDA验证使用真实LLM生成文件而非硬编码POC
43a58565 fix: EDA工具自动重检测+前端缓存仅作最后兜底
78ff1ccd feat: ChipWise四大优化 - Prompt/温度/回退/缓存
137ca028 fix: Create用SenseNova优先(强模型), identify用Ollama优先(快模型)
868d0cda fix: ChipWise Create三重修复
623fb81f fix: ChipWise Create超时120s+移除外层超时+增强RTL解析
93a748b0 fix: ChipWise LLM优先Ollama端侧+商汤兜底, Ollama免key, 模型改为qwen2:7b
5fff8394 fix: ChipWise health超时120s + WSL缓存重置
5caf8031 feat: ChipWise Engine可视化演示页面 + HICOOL复赛策划方案
42df19f5 fix: EDA工具链WSL执行修复 — wrapper脚本+execSync+30s超时
77c1827a feat: EDA工具链支持WSL执行 + 安装脚本
2df250b7 fix: RepairChipWise API全部超时 — async/await语法错误 + require.cache热重载

七、当前系统状态

| 组件 | 状态 | 说明 |

|------|------|------|

| BossAgents Service | ✅ Running | ylxt.chat |

| WSL Ubuntu-22.04 | ⚠️ Requires manual start | wsl -d Ubuntu-22.04 -- echo ok |

| Ollama qwen2:7b | ✅ Available | localhost:11434 |

| SenseNova | ✅ Available | Only available cloud LLM |

| iverilog 11.0 | ✅ WSL | Conda installation |

| yosys 0.51 | ✅ WSL | Conda installation |

| verible 2024-06-10 | ✅ WSL | Conda installation |

| riscv-gcc 16.1.0 | ✅ WSL | Pre-compiled binary |

| ChipWise Identify | ✅ Real LLM | Ollama, ~6 seconds |

| ChipWise Create | ✅ Real LLM | SenseNova→Ollama, ~2 minutes |

| EDA Verification | ✅ Real call | iverilog+verible+yosys via WSL |

| chipwise-demo | ✅ Available | https://ylxt.chat/chipwise-demo |

← 返回案例列表

Try 左帮右臂 Industrial Agent — your digital workforce

Available as a WeChat mini program, web app (ylxt.chat) and desktop client. Start from whichever fits your workflow.

🌐 Web App 💻 Desktop Download 📞 Call 189-8606-6876
WeChat mini program QR
Scan for the WeChat mini program
Share:
🤖 Try Now →
🤖
🎁