Skip to content

test(v2): read the feature transition, not the Windows launcher argv (Windows stack 1/3) - #3548

Merged
lidge-jun merged 3 commits into
devfrom
codex/win-1-launcher-argv
Sep 5, 2026
Merged

test(v2): read the feature transition, not the Windows launcher argv (Windows stack 1/3)#3548
lidge-jun merged 3 commits into
devfrom
codex/win-1-launcher-argv

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

Windows suite stabilization, PR 1 of 3. Fixes the two multi-agent-keep-native-v1 failures on Windows by reading the feature transition instead of the OS launcher's positional argv.

On Windows an npm-installed codex is a .cmd shim, and a shell-less .cmd spawn is rejected by post-CVE Node/Bun, so commandInvocation wraps the call as cmd.exe /d /s /c "<escaped line>". That makes args[1] equal /s; the two tests asserted args[1] === "disable" and a POSIX-joined argv string, so they were asserting the launcher's grammar rather than the state transition. featureActionOf() parses the two shapes commandInvocation actually emits and throws on anything else. Its own test pins both shapes (including an escaped space in the target path and the node_modules/.bin double-escaped form) plus five rejections.

No product change. The repaired tests still run through cmdV2 → codexFeaturesInvocation → commandInvocation; executable identity stays pinned by codex-v2-gate.test.ts and win-exec.test.ts.

Also carries the unit's planning devlog (devlog/_plan/260905_windows_suite_stabilization/), including 007 which retracts a 22-failure diagnosis that turned out to be self-inflicted contamination from a killed run — measured, not assumed.

Stack: this PR → #2 (codex/win-2-unlinked-cwd) → #3 (codex/win-3-k-owner-budget).

Verification

  • bun test tests/multi-agent-keep-native-v1.test.ts (macOS): 12 pass
  • Self-hosted Windows (bun 1.4.0 pinned): 205 pass / 1 skip / 0 fail across the five relevant files
  • GitHub Actions workflow_dispatch on the stack head (run 33926041666): windows 1/4 4462 pass 0 fail, 2/4 4628/0, 3/4 4305/0, 4/4 4413/0 — first all-green Windows run
  • bun run typecheck clean
  • Implementation review (read-only, sol/high): GO-WITH-FIXES, all three folded (helper scope narrowed, retraction wording corrected, superseded banner on the baseline doc)

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

jun added 3 commits September 5, 2026 08:03
Four-shard baseline on the pinned runtime (bun 1.4.0) on a self-hosted Windows
box: 17783 pass, 25 fail, three test-harness defects. An earlier baseline used
the 1.3.14 on PATH and reported 179+ failures across three shards with the
fourth wedged; 001 records that mistake and the controlled A/B that exposed it.

Research is 001-006, one decade doc per implementation phase (010/020/030) plus
a dependent follow-up (040).
…be fired

22 of the 25 baseline failures were contamination, not a defect. Stubbing both
icacls runners left them failing and logged zero runner invocations, so the
mechanism 010 described never executed. The holder was a Windows handle kept by
the wedged 1.3.14 shard-3 process after kill -9; with the leftover directory
removed the fixture is 22 pass in 1.4s.

Retracts 010 and 040 - a helper plus an 18-file migration for a defect that does
not exist. The Windows suite has three real failures, not 25.
On Windows an npm-installed codex is a .cmd shim, and a shell-less .cmd spawn is
rejected by post-CVE Node/Bun, so commandInvocation wraps the call as
cmd.exe /d /s /c "<escaped line>". That makes args[1] equal /s, and these two
tests asserted args[1] === 'disable' and a POSIX-joined argv string, so they were
asserting the OS launcher's argument grammar rather than the state transition.

featureActionOf() parses the two shapes commandInvocation actually emits and
throws on anything else, so a bypassed or malformed invocation still fails. Its
own test pins both shapes - including an escaped space in the target path and the
node_modules/.bin double-escaped form - and five rejections.

No product change: the tests still run through cmdV2 -> codexFeaturesInvocation
-> commandInvocation, and the launcher contract stays pinned by
codex-v2-gate.test.ts and win-exec.test.ts.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 4, 2026 23:05
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: b2d0c26d-ec66-4bf7-b0fa-b968080badbd

📥 Commits

Reviewing files that changed from the base of the PR and between 32e0597 and d9e350d.

📒 Files selected for processing (13)
  • devlog/_plan/260905_windows_suite_stabilization/000_plan.md
  • devlog/_plan/260905_windows_suite_stabilization/001_runtime_fault.md
  • devlog/_plan/260905_windows_suite_stabilization/002_v140_baseline.md
  • devlog/_plan/260905_windows_suite_stabilization/003_void_preload_analysis.md
  • devlog/_plan/260905_windows_suite_stabilization/004_void_singles_analysis.md
  • devlog/_plan/260905_windows_suite_stabilization/005_wedge_resolution.md
  • devlog/_plan/260905_windows_suite_stabilization/006_void_inventory_1314.md
  • devlog/_plan/260905_windows_suite_stabilization/007_acl_defect_retracted.md
  • devlog/_plan/260905_windows_suite_stabilization/010_defect_acl_seam.md
  • devlog/_plan/260905_windows_suite_stabilization/020_defect_launcher_argv.md
  • devlog/_plan/260905_windows_suite_stabilization/030_defect_unlinked_cwd.md
  • devlog/_plan/260905_windows_suite_stabilization/040_acl_stub_hygiene.md
  • tests/codex-integration/multi-agent-keep-native-v1.test.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Sep 4, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 64 / 80

설명

이 PR은 Windows 테스트 스위트를 초록으로 만드는 세 장짜리 스택의 첫 장이다. 제품 코드는 건드리지 않고, tests/codex-integration/multi-agent-keep-native-v1.test.ts 한 파일과 계획 문서 devlog/_plan/260905_windows_suite_stabilization/ 만 올린다. 지금 dev HEAD는 7eddfb3eb 이고, 방금 #3541(호출자 취소가 upstream 실패 로그에 섞이지 않게)과 #3542(continuation spill 쓰기 건강 상태를 responses/management에 노출)가 들어왔다. 그 위에 Windows 스위트 안정화는 별도 레일이다.

실패의 핵심은 간단하다. Windows에서 npm으로 깔린 codex.cmd 심이다. CVE 이후 Node/Bun은 셸 없이 .cmd 를 직접 spawn 하지 못하게 막았고, 그래서 제품 쪽 src/lib/win-exec.tscommandInvocation 이 호출을 cmd.exe /d /s /c "..." 형태로 감싼다. 그러면 테스트 mock이 받는 args[1] 은 액션 문자열 disable 이 아니라 런처 문법의 /s 가 된다. 기존 두 테스트는 args.join(" ")args[1] 로 상태 전이(features disable multi_agent_v2)를 검사한다고 착각했지만, 실제로는 Windows 런처 argv 문법을 검사하고 있었다. macOS에서는 POSIX 패스스루라서 초록이었고, Windows에서만 깨졌다.

고치는 방식은 맞게 짜였다. 테스트 파일 안에 로컬 헬퍼 featureActionOf() 를 두고, POSIX 3토큰 형태(["features", action, feature])와 win32 cmd 래퍼 4토큰 형태(["/d","/s","/c", quoted-line])만 파싱한다. 그 외는 throw 해서 우회·기형 호출이 조용히 통과하지 못하게 했다. 자체 단위 테스트가 공백 포함 경로, node_modules/.bin 더블이스케이프, 그리고 다섯 가지 거절 케이스를 고정한다. 인용 줄도 지금 HEAD의 win-exec.ts 와 맞다. POSIX 분기는 85줄 근처, IS_CMD_SHIM 은 17줄, cmd 래퍼 조립은 89–95줄이다. 제품 경로 src/cli/v2.tscodexFeaturesInvocationcommandInvocation 체인은 그대로 타고, 실행 파일 정체성 핀은 기존 codex-v2-gate / win-exec 테스트가 계속 맡는다.

계획 문서 쪽도 가치가 있다. 처음에 PATH의 Bun 1.3.14로 재서 실패가 잔뜩 보였고, 핀된 1.4.0으로 다시 재니 실제 결함은 세 개뿐이었다. 그중 22개는 kill -9 잔여 핸들 오염이었고 007 이 ACL 시임 진단을 철회했다. 측정으로 가정을 깨는 기록이라, 나중에 같은 함정에 다시 빠지지 않게 막아 준다. 검증 주장도 구체적이다. 해당 파일 macOS 12 pass, 셀프호스트 Windows 관련 파일 205 pass, 스택 헤드 workflow_dispatch에서 Windows 4/4 전 초록이라고 적혀 있다. types.ts/config.ts 분할 캠페인과도 무관해서 닫을 이유가 없다.

라인 253 - 첫 keep-native-v1 테스트가 이제 featureActionOf(args) 결과를 이벤트에 넣는다. 기대값은 여전히 ["features disable multi_agent_v2", "sync"] 라서 상태 전이 의미를 본다. 맞다.
라인 292 - 두 번째 테스트는 featureActionOf(args).split(" ")[1] 로 액션만 뽑는다. 헬퍼가 항상 features <action> <feature> 세 단어를 돌려주니 동작은 하지만, 공백 split에 한 번 더 기대고 있다. 나중에 헬퍼가 액션만 돌려주게 바꾸거나 액션 전용 헬퍼를 두면 읽기가 더 쉽다. 지금은 병합을 막을 결함은 아니다.
devlog/_plan/260905_windows_suite_stabilization/000_plan.md 작업표 - write set 경로가 tests/multi-agent-keep-native-v1.test.ts 로 적혀 있다. 실제 파일은 tests/codex-integration/multi-agent-keep-native-v1.test.ts 이다. 문서만의 오타지만, 다음 사람이 파일을 못 찾을 수 있다.
devlog/_plan/.../010_defect_acl_seam.md · 040_acl_stub_hygiene.md - 이미 007에서 철회된 설계를 그대로 싣는다. 감사 기록으로 두는 선택은 이해되지만, 착륙 커밋 부피가 커진다. 의도된 기록인지 한 번만 확인하면 된다.
featureActionOf win32 분기 - lookbehind (?<!\^) 로 이스케이프되지 않은 공백만 자른다. Bun 1.4.0에서는 문제 없고, 테스트가 공백 경로·더블이스케이프를 직접 고정한다. 좋다.

메인테이너의 판단이 필요한 지점

너의 추천
CI가 초록이면 #3548을 LAND_AS_IS로 머지하자. 제품 변경이 없고, Windows에서만 깨지던 잘못된 단언을 상태 전이 검사로 고쳤으며, 런처 계약은 기존 win-exec/v2-gate 테스트가 계속 지킨다. 000_plan.md 경로 오타는 가능하면 같은 PR에서 한 줄 고치고, #3549/#3550은 독립 레일로 이어서 리뷰하면 된다.

이 댓글은 grok-bot이 작성했습니다

@Ingwannu Ingwannu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at exact head d9e350de545c81de1df4239393815ab4b48fdba1.

This is a test-only correction, not a launcher bypass. The affected assertions still execute cmdV2 -> codexFeaturesInvocation -> commandInvocation; the local parser accepts only the two production argv shapes and validates the semantic features <enable|disable> <feature> transition. Executable resolution and Windows escaping remain covered by the dedicated codex-v2-gate and win-exec suites. No product/runtime path or CI coverage is removed.

Cross-platform CI run 33928123783 is fully green on this SHA, and the concurrency-cancelled target check was rerun successfully in 33928123884. Approved.

Non-blocking documentation note: 000_plan.md still names tests/multi-agent-keep-native-v1.test.ts instead of tests/codex-integration/multi-agent-keep-native-v1.test.ts. Correct that path in the next documentation touch; it does not affect this behavioral regression.

@lidge-jun
lidge-jun merged commit 55df018 into dev Sep 5, 2026
25 of 26 checks passed
@lidge-jun
lidge-jun deleted the codex/win-1-launcher-argv branch September 5, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants