Repository navigation
Confirm a run's end by the child's observed exit, capped where the kernel could not end it - #519
Merged
Merged
Conversation
HyunjunJeon
pushed a commit
to HyunjunJeon/hide
that referenced
this pull request
Nov 9, 2026
…ore (with-hide#2149) Closes with-hide/hide-private#561 Closes with-hide/hide-private#495 Closes with-hide/hide-private#564 Closes with-hide/hide-private#605 ## Summary e2e 픽스처가 두 번째 에이전트를 너무 일찍 시작해서, 코어가 "다른 시작이 아직 진행 중"이라며 거절하고 픽스처는 30초를 기다리다 실패했습니다. 코어는 시작 하나가 끝나기 전에는 새 시작을 받지 않는데, 첫 에이전트의 행은 그 시작이 끝나기 전에 먼저 보입니다. 이제 테스트는 행이 아니라 코어가 그 시작에 준 답(시작 패널이 읽는 것과 같은 영수증, `task_operation`)을 기다렸다가 다음 시작을 보냅니다. 거절되면 30초를 기다리지 않고 코어의 이유로 바로 실패합니다. 화면 변경 없음: 테스트 코드와 문서만 바뀝니다. ## Review - **조심해서 볼 파일**: `web/e2e/daemon-actions.ts` `startAgentInCheckout` - 코어의 task slot 규칙(`herdr-core/src/runtime/session.rs:3994-4003`)을 그대로 읽는지, `started` 외의 답은 모두 실패로 끝나는지. - **조심해서 볼 파일**: `web/e2e/engine-fixture.ts` - 첫 시작이 끝난 뒤에야 두 번째 시작(또는 family의 spawn)이 나갑니다. 기다림은 코어 신호뿐이고 timeout·sleep·retry는 늘리지 않았습니다. - **원인이 다른 것**: with-hide#444 with-hide#445 with-hide#459 with-hide#479 with-hide#496 은 픽스처가 아니라 spec 안의 기다림에서 실패하고 로그에 거절이 없어 이 PR에서 다루지 않습니다. - **Herdr 레인에서만 난 것**: with-hide#260 with-hide#489 with-hide#502 with-hide#510 with-hide#511 with-hide#519 with-hide#533 은 `*-herdr-*` 레인에서만 났고 그 레인은 #2069로 지워졌습니다. #2069와 아래 반복 run을 적은 댓글로 닫습니다. - **열어 두는 것**: with-hide#490 with-hide#492 with-hide#523 with-hide#529 with-hide#532(`agent_pane_required`)는 이 PR이 끝내지 않습니다. 원인은 with-hide/hide-private#630에서 따로 다룹니다. ## Evidence - **확인한 것**: own engine으로 바뀐 뒤 "second fixture agent" 실패 6건 중 5건(#561 x2, with-hide#495, with-hide#564, with-hide#605; Linux·Windows)의 setup snapshot과 hided 로그를 봤습니다. 모두 두 번째 시작의 request id로 `task_operation.busy` 거절이 남아 있습니다. 나머지 1건(#561, run 42076071271)은 로그를 받지 않았고 오류 줄만 같습니다. - **확인한 것**: 실패 로그 순서는 tab.create 완료 -> busy 거절 -> 첫 시작의 `agent.started`, 통과한 실행은 tab.create 몇 ms 뒤 `agent.started` -> 두 번째 시작입니다. - **확인한 것**: `web`·`desktop` typecheck, lint(e2e 크기 검사 포함) 통과. - **확인한 것**: a79a97b, run 42202678411의 Linux 전체 e2e(6 shard)와 Windows `@platform` e2e를 3번 돌렸습니다. 닫는 11개 제목은 매번 통과했고 재시도도 없었습니다. - attempt 1: Linux 6/6, Windows 1/1 통과. 재시도 후 통과: `desk-lane` "Desk is off on a new install"(Linux 4/6), with-hide#444 close-subtree(Linux 6/6) - attempt 2: Linux 6/6, Windows 1/1 통과, 재시도 없음 - attempt 3: Linux 6/6, Windows 1/1 통과. 재시도 후 통과: `desk-lane` 같은 테스트(Linux 4/6) - **범위 밖**: #444가 attempt 1에서 재시도 후 통과한 것과 `desk-lane`이 두 번 재시도 후 통과한 것은 픽스처 원인이 아닙니다. 이 노드 범위 밖이고 따로 묶여 있습니다. - **확인하지 못한 것**: 로컬 e2e는 돌리지 않았습니다(Rust debug 빌드 디스크 부족). macOS 웹 e2e는 PR CI에 없어 반복하지 않았고, 이 묶음의 21개 이슈 중 macOS에서 난 것은 없습니다.
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.
Refs #476
Summary
run_to_end가 끝낸 child의 종료를 20 ms 안에 확인하지 못하면 원래 결과(시간 초과) 대신 "cleanup unconfirmed"로 답하던 것을, 종료가 관측될 때까지 기다리는 상태 기반 확인으로 바꿉니다. 커널이 process를 끝내지 못한 경우를 뜻하는 상한 하나는 둡니다.hide-platform/src/process.rs의run_to_end는 tree를 끝낸 뒤 reap을RUN_POLL(20 ms) 한 번까지만 확인했습니다. Windows는TerminateJobObject가 돌아온 뒤에 job의 process를 끝내므로, 바쁜 runner에서는 20 ms 안에 종료가 보이지 않을 수 있습니다. 그러면 결과는RunFailure::Wait(RunCleanupFailure, 원래 결과TimedOut)이 되고, kit은 이를 "could not be waited on"으로 옮겨 test의contains("did not finish")가 실패합니다. Make the process and lock wait tests wait for the child or the waiter #503 Review의 판단(RUN_POLL 20 ms 안에 reap을 확인하지 못함)과 같은 경로입니다.RunCleanupFailure를 받아 회복하는 caller는 없었습니다(kit, codex daemon, diagnosis, user agents).confirm_end가 kill 뒤 child의 종료가 관측될 때까지 기다립니다. 시간 초과, 정상 종료, stop으로 끝난 실행 모두 같은 경로입니다.WaitForSingleObject)로 기다리고, Unix에서는 SIGKILL 뒤 다음try_wait가 종료를 보므로 poll 간격으로 확인합니다.END_UNCONFIRMED_AFTER)입니다. 정상 종료 지연에 맞춘 값이 아닙니다. SIGKILL이나 종료된 job은 바쁜 runner에서도 수 ms 안에 끝나므로, 그때도 살아 있는 leader는 커널이 잡고 있는 것(중단할 수 없는 I/O, driver)으로 봅니다. 넘으면process.end_unconfirmed pid=… waited_ms=…를 남기고, 원래 결과와 child를RunCleanupFailure에 담아 돌려줍니다. destructor는 막히지 않습니다.docs/ARCHITECTURE.md의 해당 문장(stop 경로 포함)을 고쳤습니다.process::run_cleanup_tests):confirm_end에 예전 20 ms 한도를 넣으면 첫 test가 실패합니다.Review
hide-platform/src/process.rs-confirm_end와sys::wait_exit. 모든run_to_endcaller가 이 경로를 지납니다. 10 s 상한의 근거는 상수 주석에 있습니다.a_raised_stop_ends_the_child_before_its_deadline가 로컬 macOS 부하에서도 실패했습니다(아래 Evidence).Evidence
scripts/verify-cargo.sh lint통과, Windows targetcargo check --tests통과. 새 test 중 첫 test는 예전 20 ms 한도에서 실패하고 수정 후 통과합니다.yes14개) 아래, stop 경로를 아직 20 ms로 두었던 중간 build로 kit process test 120회(출력 보존): 1회 실패. 실패한 test는a_raised_stop_ends_the_child_before_its_deadline, 오류는child exit was not confirmed before the caller stopped; original failure Stopped였습니다. main의 stop 경로도 같은 20 ms입니다. stop 경로까지 바꾼 최종 build로 같은 조건 150회(출력 보존): kit test 실패 0, 새 platform test 실패 0.hide-platform/tests/watch.rs의a_burst_is_bounded_and_ends_in_an_overflow_rather_than_silence가 부하 아래 실패했고, 단독으로 3회 다시 돌려 모두 통과했습니다. file watch test라 이 변경의 경로를 지나지 않습니다.verify-cargo.sh test(--workspace)가 예전 20 ms 한도를 임시로 넣은 platform으로 kit test까지 다시 build했기 때문입니다. 출력을 남기지 않아 어느 test인지는 확인하지 못했고, 같은 build와 조건을 다시 만들어 270회 반복했지만 재현되지 않았습니다. 위의 stop 경로 실패와 같은 부류로 봅니다.