Skip to content

release: Luomu CAD 0.17.1 — 修复 agent 启动 AutoCAD 时的许可崩溃弹窗 - #11

Merged
luomufanye-cloud merged 2 commits into
mainfrom
fix/acad-launch-windows-env-main
Nov 26, 2026
Merged

luomufanye-cloud merged 2 commits into
mainfrom
fix/acad-launch-windows-env-main

Conversation

@luomufanye-cloud

Copy link
Copy Markdown
Owner

问题

由 agent 通过 luomu-cad 启动 AutoCAD 时,会弹出 "Autodesk Error Report",或者干脆启动失败。具体表现跟发起启动的 agent 宿主有关。

根因

  • DispatchEx 由 DCOM 启动 AutoCAD 时,会把 MCP 服务端进程的环境传给 AutoCAD;这个环境又来自启动 MCP 服务端的 agent 宿主。
  • 很多宿主不会传完整的 Windows 登录环境:
    • Codex 的 shell_environment_policy inherit = "core" 会删掉 ALLUSERSPROFILE 等变量。
    • 官方 MCP SDK 客户端默认只传十来个变量,同样没有 ALLUSERSPROFILE。
  • 缺少 ALLUSERSPROFILE 时,Autodesk 许可代理 AdskLicensingAgent.exe 一启动就抛出 std::runtime_error,每次重试都弹一个错误报告。在 MCP SDK 默认环境下,未修复的代码甚至连 AutoCAD 都启动不了(COM 返回 0x80080005 "服务器运行失败")。

修改

  • cad.py 新增 _complete_windows_environment()。它在 DispatchEx 之前运行,按白名单从当前用户的默认登录环境(CreateEnvironmentBlock)补回缺失的 Windows 登录变量。
  • 已有的值不会被覆盖,白名单以外的变量也不会被复制,所以宿主特意去掉的密钥之类的变量仍然不会传给 AutoCAD。
  • 这一步放在服务端唯一的 AutoCAD 启动路径上。Skill 规定只能通过 cad_start 启动,所以不管哪个 agent 宿主调用,都会经过这里。
  • 新增三个测试:补变量逻辑的单元测试;Windows 上检查登录环境里确实有这几个前置变量;以及真实启动路径测试,断言调用 DispatchEx 时 ALLUSERSPROFILE 已经存在。最后这个测试在去掉修复后会失败。

验证

本机 AutoCAD 2024,经真实 stdio MCP 服务端调用 cad_start,每种环境各启动一个新实例,等待 45 秒后检查:

宿主环境 修复前 修复后
MCP SDK 默认环境(通用 MCP 宿主) AutoCAD 启动失败 启动成功,许可注册成功,弹窗 0 个,崩溃报告 0 个
Codex inherit=core 许可代理崩溃,弹出 3 个窗口 启动成功,许可注册成功,弹窗 0 个,崩溃报告 0 个
完整环境(Claude Code 这类) 正常 正常

pytest:1006 passed,18 skipped。

1.0.0 候选分支上的同一修复见 #10。

🤖 Generated with Claude Code

luomufanye-cloud and others added 2 commits November 25, 2026 19:01
Agent shells that inherit only a core environment (Codex with
shell_environment_policy inherit="core") drop ALLUSERSPROFILE and other
logon variables. DCOM hands the caller's environment to the AutoCAD it
launches, and Autodesk's licensing agent throws std::runtime_error at
startup without ALLUSERSPROFILE. Every retry then raised an
"Autodesk Error Report" dialog.

Before DispatchEx, fill in missing variables from an allowlist using the
user's default logon environment. Existing values are never overwritten,
and nothing outside the allowlist is copied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix the "Autodesk Error Report" dialogs and failed starts when an agent
launches AutoCAD through cad_start: restore missing Windows logon
variables (ALLUSERSPROFILE and others, allowlisted, never overwriting)
before DispatchEx, so the licensing agent starts under every agent host.

Version synced across the package, pyproject, uv.lock, package.json,
capabilities.yaml, README, CHANGELOG and release-validation-0.17.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@luomufanye-cloud luomufanye-cloud changed the title fix: 启动 AutoCAD 前补齐 Windows 登录环境变量(任意 agent 宿主不再弹许可崩溃窗口) release: Luomu CAD 0.17.1 — 修复 agent 启动 AutoCAD 时的许可崩溃弹窗 Nov 26, 2026
@luomufanye-cloud
luomufanye-cloud merged commit 8bb3580 into main Nov 26, 2026
6 checks passed
luomufanye-cloud added a commit that referenced this pull request Nov 26, 2026
Before DispatchEx, restore allowlisted Windows logon variables (ALLUSERSPROFILE and others) missing from the agent host environment, so Autodesk's licensing agent no longer crashes with Error Report dialogs. Same fix as 0.17.1 (#11) on the 1.0.0 candidate line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant