Repository navigation
Conversation
The omp extension spawned its .sh helpers directly, which on native Windows makes uv_spawn throw EFTYPE synchronously before any error handler exists; omp printed it as an extension error and the guard and seatbelts died. Reuse the shared firstmateShellInvocation (one owner in .pi/extensions/lib/fm-operational-input.ts), convert root-derived script paths to MSYS POSIX form for the bash route, catch the synchronous throw at every spawn site with the existing silent code-0 degradation, and guard stdin against EPIPE. The portable regression overrides process.platform to exercise the bash route on any host, records the invoked command through a PATH shim, and covers the degraded no-bash case; native Windows also verifies drive-letter path conversion through a Windows-style extension path.
On a win32 host whose PATH bash is the WSL launcher, the MSYS-form script path cannot be resolved: the spawn fails to exec or the child exits 127, and every helper silently degraded. Retry once with the WSL mount form (/mnt/<drive>/...) so the helpers actually run there; Git for Windows stays first choice, a real helper verdict (including the guard's 2) is never retried, and degradation stays silent when no bash can run.
…rm via shared lib
…native Windows with skip note
|
@kunchenguid This PR should fix a similar problem as was implemented for the Pi extension by #3838 but for the OMP extension. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
修复 omp 扩展在 Windows 上加载报错的问题:
.omp/extensions/fm-primary-turnend-guard.ts error: EFTYPE: inappropriate file type or format, uv_spawn。背景与已复现的根因:omp 扩展(.omp/extensions/fm-primary-turnend-guard.ts)用 node:child_process 的 spawn() 直接执行 shell 帮助脚本(
${root}/bin/fm-turnend-guard.sh与${root}/bin/<script>形式的 fm-arm-pretool-check.sh / fm-cd-pretool-check.sh 安全带)。在 macOS/Linux 上带 shebang 的 .sh 可被内核直接执行;在 Windows 上 libuv(uv_spawn)无法执行非 .exe/.cmd 文件,spawn 同步抛出 EFTYPE,且抛出发生在扩展为子进程挂 on("error") 处理器之前,未被捕获,omp 将其打印为 Extension <路径> error。
同仓库的 Pi 版扩展(.pi/extensions/fm-primary-turnend-guard.ts)在 Windows 上正常:它通过共享库 .pi/extensions/lib/fm-operational-input.ts 的
firstmateShellInvocation包装(win32 时改为 spawn "bash" <script> 并传入 POSIX 形式脚本路径)+ try/catch 处理。omp 的适配文档 .agents/skills/harness-adapters/references/harness/pi.md 明确记录"On native Windows, the extension runs its Bash helpers through bash"。
本机环境事实(Windows 11,win32):PATH 中的 bash.exe 是 WSL 启动器(~/AppData/Local/Microsoft/WindowsApps/bash.exe);
经它 spawn("bash", ["D:/newP/..."]) 会因路径解析失败退出 127;转换为 WSL 的 /mnt/... 路径后可正常执行(exit 0)。
但 firstmate 的 bin/*.sh 全家在 Windows 上的既定运行环境是 Git for Windows 的 MSYS bash(文档多处提"MSYS confirm budget"),本机装有 Git for Windows(D:/Scoop/apps/git/current/usr/bin/bash.exe 存在,git 经 scoop shim 可用,POSIX 路径 /d/newP/... 在其中可用)。
What Changed
.omp/extensions/fm-primary-turnend-guard.ts(session-start runner, turn-end guard, both PreToolUse seatbelts) throughbashvia the sharedfirstmateShellInvocationon win32, with script paths converted to POSIX form for Git for Windows' MSYS bash and one retry in WSL mount form (/mnt/<drive>/...) when the spawn fails to exec or exits 127; a real helper verdict is never retried, and every spawn site is wrapped so the synchronousuv_spawnEFTYPE throw can no longer escape the extension's error handlers.firstmateMsysPathandfirstmateWslPathpath helpers to.pi/extensions/lib/fm-operational-input.tsand applied the same MSYS-first/WSL-retry loop to its synchronousspawnSyncoperational-input call.tests/fm-omp-windows-shell-invocation.test.sh(portable regression that overridesprocess.platformto win32 on POSIX and skips shim-interception sections natively), fixed thestat -c %Y/stat -f %mprecedence intests/fm-omp-primary-live-e2e.test.sh, and documented the Windows bash-routing contract in.agents/skills/harness-adapters/references/harness/omp.md.Risk Assessment
✅ Low: The change is bounded to the authorized win32 bash-routing/retry scope, every recorded fix-round claim is verifiably present, and the regression suite exercises the real extension through shim interception including native-path and verdict-no-retry cases.
Testing
Drove the change against the real product at three levels. Portable win32 regression (tests/fm-omp-windows-shell-invocation.test.sh) passed all sections on this Linux host via PLATFORM_OVERRIDE with real Node spawns of a real bash: every Bash seam routes through bash, MSYS-form paths are converted and tried first, one 127-degraded retry in WSL mount form succeeds for all five scripts, real rc=2 verdicts are never retried and still surface, and total bash failure degrades silently. Three scenario drivers (supersession, accumulator-reset, async error/close(-2)) proved the two review fixes against the real extension module with real child processes. The opt-in live omp primary e2e ran twice: the first run failed only at the guard-continuation spy wait (a model-timing flake — the guard still returned rc=2), the rerun passed all five live stages end-to-end with the real omp 18.6.3 and a live model in a disposable lab that was torn down in the same turn. Evidence: omp-live-e2e-rerun2.out, omp-windows-shell-invocation.out, supersession-three-scenarios.out, async-supersession.out in the evidence directory. Overall result: go.
Evidence: Live omp primary e2e — full pass on rerun
Source: Live omp primary e2e — full pass on rerun
Evidence: Portable win32 bash-routing regression output
Source: Portable win32 bash-routing regression output
ok - omp session-start, pre-tool, turn-end, and operational-input seams invoke Bash owners through bash on native Windows, retry once in the other path form when a WSL-launcher bash cannot resolve the script, never retry a real verdict, and degrade silently when bash cannot runEvidence: Shim scenario drivers: supersession + residue reset + 127 retry
Source: Shim scenario drivers: supersession + residue reset + 127 retry
Evidence: Async error/close(-2) supersession driver: digest delivered, no failed settle
Source: Async error/close(-2) supersession driver: digest delivered, no failed settle
Evidence: Round-2 rerun live e2e full pass (approved evidence, retained)
Source: Round-2 rerun live e2e full pass (approved evidence, retained)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
git -C ~/.no-mistakes/worktrees/24c5f70e9d6d/01M4AXTZ3KMD7CB9GSHPPJ2VGE statusandgit -C ~/.no-mistakes/worktrees/24c5f70e9d6d/01M4AXTZ3KMD7CB9GSHPPJ2VGE diff). Respond with fix to validate it, or abort.🔧 No changes applied.
1 warning still open:
bash tests/fm-omp-windows-shell-invocation.test.sh— omp turnend-guard + Pi operational-input 的 win32 平台覆盖驱动程序(非实时:platform-override 存根驱动,未驱动真实运行产品)bash tests/fm-operational-input.test.sh— operational-input 载体/编解码行为(单元测试)bash tests/fm-turnend-guard.test.sh— turn-end 监控谓词 + 钩子回归套件(单元测试)FM_OMP_LIVE_E2E=1 bash tests/fm-omp-primary-live-e2e.test.sh— 凭据 omp 主 e2e(实时守护)针对已安装的 omp/18.6.3 运行,但运行被归类为非实时且第一回合断言未显示 SESSION START 文本已应用操作员选定修复:移除 .omp-win-probe/, 保留 tests/fm-omp-primary-live-e2e.test.sh 中的 stat-flag 重新排序证据文件:tests/__pycache__ 未创建;supersession-driver.py 和 supersession-run.sh 已创建,然后作为清理操作移除🔧 Fix applied.
2 issues (1 warning, 1 info) still open:
bash tests/fm-omp-windows-shell-invocation.test.sh — portable regression, all sections on Linux via PLATFORM_OVERRIDE=win32: bash-routing of session-start/both seatbelts/turnend/operational-input, POSIX-path assertion, WSL127 exactly-2-calls retry, native D:/-path opshim retry (MSYS form attempted first, then /mnt/d/...), verdict-2 no-retry (tool blocked, sessionStop continued), degraded silent bash (extension never crashes)bash ~/.no-mistakes/evidence/.../supersession-run.sh — real module + real spawn: superseded attempt (127, no output) does not settle while attempt 2 runs; acc-reset-partial attempt-1 stdout residue (FIRST_ATTEMPT_RESIDUE) absent from the delivered digest; exit127-refuse delivers attempt-2 digest with exactly 2 bash calls per seambash ~/.no-mistakes/evidence/.../async-supersession-run.sh — the round-4 dead-retry trace: bash shim whose shebang interpreter is missing produces the async 'error' then 'close' code -2 event order; the session did not settle {failed} from the superseded attempt and the attempt-2 digest was delivered instead of the manual-fallback messageenv FM_OMP_LIVE_E2E=1 FM_OMP_LIVE_MODEL=ollama-cloud/glm-5.3-flash:high tests/fm-omp-primary-live-e2e.test.sh — opt-in live e2e against the installed omp 18.6.3 in an isolated lab ($ROOT/.omp-live-e2e.$$ with turnend-guard spy): extensions load by auto-discovery, session-start digest reaches model context before turn 1, lock names the omp pid, fm_watch_arm_omp starts a live watcher, an actionable close spawns a ledger-linked successor and wakes main once, and with the successor frozen past FM_GUARD_GRACE the guard returns rc=2, omp raises stop_hook_active=true, and the model calls fm_watch_arm_omp againtimeout 1800 tests/fm-omp-harness.test.sh — fake-API contract suite (16 checks): digest delivery shape, seatbelt block, one compelled continuation, flagged stop stands down; confirms the retry refactor kept every existing contractgit diff inspection of ed49e15 vs base plus guard-flake-probe.sh fixture probing of fm-turnend-guard.sh rc semantics for the stage-3 flake diagnosisdocs/configuration.md:2376- Pre-existing gap revealed by inspection, not made stale by this branch: the Environment variables table lists the OpenCode and Pi sibling rows (FM_OPENCODE_ARM_READY_TIMEOUT_MS, FM_PI_ARM_READY_TIMEOUT_MS) but omits the omp sibling FM_OMP_ARM_READY_TIMEOUT_MS (default 12000, 35000 on win32), owned by .omp/extensions/fm-primary-omp-watch.ts:156 and introduced with the omp harness adapter (feat(bin): add verified omp (Oh My Pi) harness adapter for crew, secondmate, and primary #3867). One-line table-row follow-up for the configuration doc owner; out of this documentation phase's change-scoped scope.✅ **Push** - passed
✅ No issues found.