Skip to content

Wait for the Windows shell condition Herdr checks before a fixture agent start - #730

Merged
yansfil merged 3 commits into
mainfrom
fix/checkout-pr-shell-ready
Oct 7, 2026
Merged

yansfil merged 3 commits into
mainfrom
fix/checkout-pr-shell-ready

Conversation

@yansfil

@yansfil yansfil commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #726

Summary

Windows에서 fixture는 pane process-info로 "shell이 혼자"인지 보고 agent를 시작했습니다. 하지만 고정된 Herdr(v0.9.1)의 Windows agent.start는 다른 조건을 씁니다: 프로세스 표에서 shell pid를 부모로 적은 프로세스가 하나도 없어야 합니다(시작 시각 비교 없이 pid만, 후손까지).
#726 run에서 pane의 cmd.exe(7964)는 세션을 만들고 끝난 smss.exe의 pid를 다시 받았고, csrss.exe·winlogon.exe가 아직 그 pid를 부모로 적고 있었습니다. process-info는 shell 혼자로 보였지만 Herdr는 그 pane을 끝까지 busy로 거절했습니다(재시도는 다른 pid를 받은 새 pane이라 통과).

  • "Herdr가 이 shell을 available로 보는가"를 함수 하나(shellAvailability)로 두고, startHerdr의 setup 대기와 startAgentAtShell이 둘 다 부릅니다. Windows에서는 Herdr의 조건 그대로(hide-children.exe로 shell을 부모로 적은 프로세스를 읽음), macOS·Linux는 전과 같이 foreground group입니다.
  • shell보다 먼저 시작한 프로세스가 shell pid를 적고 있으면 기다려도 오지 않는 상태라 바로 그 프로세스를 적고 실패합니다.
  • c323729d가 startHerdr의 두 shell에만 하던 교체를 helper 하나(unclaimedWorkspace)로 합쳐, spec이 fixture.run으로 보내는 workspace create(spawnAgent 포함)도 같은 코드를 씁니다.
  • docs/TESTING.md와 docs/ARCHITECTURE.md(Starting an agent)에 Windows 조건을 적었습니다.

Review

  • 판단해 주세요: 교체는 "shell보다 먼저 시작한 프로세스가 shell pid를 부모로 적음"을 본 뒤 한 번만 합니다. 교체본도 그러면 각 프로세스의 pid·시작 시각·이름을 적고 실패합니다. timeout·재시도·sleep은 늘리지 않았습니다.
  • 판단해 주세요: 제품 영향: 실제 Windows 사용자도 이런 pid를 받은 pane에서는 agent를 영원히 시작하지 못합니다(agent_start::start_at_shell은 30초 뒤 실패). Herdr의 결함이라 upstream issue 초안을 운영자 승인 대기로 남겼습니다(제안: 후손 판정에 시작 시각 비교).
  • 조심해서 볼 파일: web/e2e/herdr-fixture.ts run - 모든 spec의 workspace create가 지나갑니다. Windows가 아니면 그대로 반환하고, Windows에서는 만든 직후 pane마다 hide-children.exe를 한 번 돌립니다.
  • 조심해서 볼 파일: startHerdr - 교체 검사가 prompt 대기 뒤에서 앞(만든 직후)으로 옮겨졌습니다. Herdr는 create에 답하기 전에 shell pid를 저장하므로(src/pane.rs spawn) 대기가 필요 없습니다.
  • 범위 밖: tab create·pane split로 만든 pane은 교체하지 않습니다(그런 pane에서 Windows agent를 시작하는 spec은 지금 없음). 그런 pane의 agent start는 프로세스를 적고 바로 실패합니다. desktop/e2e/agent-spawn-fixture.ts의 waitForSpawnShell도 같은 판정이지만 agent-spawn.spec.ts가 @platform이 아니라 Windows에서 돌지 않아 손대지 않았습니다.

Evidence

  • 확인한 것:
    • 원인: 실패 job log(112680845736)의 자식 목록 7976 ... older csrss.exe, 8024 ... older winlogon.exe. issue 본문은 600자에서 잘려 이 부분이 빠져 있었습니다.
    • Herdr 조건: v0.9.1 소스 src/app/agents.rs(available_shell_name이 platform::available_pane_shell 호출, 없으면 agent_pane_busy), src/platform/windows.rs(available_pane_shell → descendant_entries, th32ParentProcessID만 비교). upstream #3485에서 maintainer가 "Windows process-info는 shell만 보여도 agent start는 후손이 있으면 거절"이라고 확인.
    • Name the core's own machine by its node id and convert stored state once #664 무관: #664는 web/e2e/herdr-fixture.ts·checkout-pr.spec.ts를 바꾸지 않았고, 실패는 spec이 hided를 시작하기 전 workspaceAt 안이었습니다.
    • 로컬: web lint(eslint e2e 포함), desktop typecheck(desktop/e2e가 이 fixture를 import, tsc -p e2e), policy 검사 5개, design-contract, script tests 168개 통과.
  • 확인하지 못한 것:
    • Windows에서 로컬로 돌리지 못했습니다(이 Mac뿐). 새 Windows 조건은 이 PR의 windows e2e lane에서 agent start마다 돕니다.
    • 교체 경로 자체는 pid 재사용이 우연히 일어나야 돌아서 CI에서 일부러 재현할 수 없습니다. 로직은 c323729d에서 이미 돌던 것을 helper로 옮긴 것입니다.

On Windows the pinned Herdr counts a pane's shell as available only while
no process in the process table names it as its parent, by pid alone,
which `pane process-info` does not show. The fixture waited on the
foreground job instead, so a shell whose pid Windows had reused from the
exited smss.exe that csrss.exe and winlogon.exe still name looked alone
while Herdr refused it for the rest of the run.

startAgentAtShell now reads that condition with hide-children.exe and
fails at once when an older process claims the shell. The workspace
replacement startHerdr used for its own two shells is one helper,
unclaimedWorkspace, which every `workspace create` sent through
fixture.run now goes through as well.
startHerdr's setup wait still read the macOS and Linux condition on
Windows while startAgentAtShell read the Windows one. Both now call
shellAvailability, so the two waits cannot drift apart again.
@yansfil
yansfil merged commit bf0d379 into main Oct 7, 2026
19 checks passed
@yansfil
yansfil deleted the fix/checkout-pr-shell-ready branch October 7, 2026 10:25
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.

Flaky test: a checkout's card names the checkout by its real path

1 participant