Skip to content

fix(lab): preserve producer deadline authority through child close - #3713

Merged
lidge-jun merged 1 commit into
devfrom
codex/lane-b-ci-fabric-deadline
Sep 5, 2026
Merged

fix(lab): preserve producer deadline authority through child close#3713
lidge-jun merged 1 commit into
devfrom
codex/lane-b-ci-fabric-deadline

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

A producer result can race a pending deadline or child-close event and be accepted after a timeout. Keep the first failure authoritative, check elapsed deadlines before activity/result admission, and wait for child close before releasing latched-failure cleanup. The newly handled stderr failure follows that same termination path.

Product budgets, child permissions/environment, core activation boundaries and ordinary on-time success remain unchanged. This focused verification prerequisite addresses the public CI failure in run 33986641840 and is included as an ancestor of #3700 head e59b730; that verified composed PR will land both layers together. This standalone diff contains no catalog feature changes.

Verification

  • Independent C4 plan and production/security reviews passed after correcting the stderr-first path.
  • Added deterministic process/timer/clock cases with valid-result controls and actual consumer scratch-lifecycle assertions; both layout maps register the new file.
  • Remote pinned Bun 1.4.0 at 8b5dbde: original-file RED 4 pass / 12 fail; restored GREEN 16 pass / 0 fail; unchanged real-child Lab plus new cases 65 pass / 0 fail under CI=true. Typecheck and privacy scan exited 0. Original-file hashes, timers/spies, scratch cleanup and zero owned processes were verified. The composed head e59b730 passed full hosted CI 33989738843, including both macOS shards and every actual producer. Standalone baseline run 33989678237 reached its job limit in macOS shard 1 before Lab tests: its last logged file was tests/clients/client-connect.test.ts. That run is not relabelled passing. Current-dev merge-candidate verification for fix(catalog): preserve Go efforts and independent picker ordering #3700 remains in progress before the composed landing.
  • No local test suite, typecheck or build was executed, per owner instruction. No timeout or assertion was relaxed.

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.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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 5, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 5, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 73 / 80

이 PR은 Lab fabric 격리 프로듀서가 이미 끝난 데드라인을 무시하고 늦은 result를 받아들여 버리는 레이스를 고칩니다. 베이스는 지금 dev HEAD 6dd23d631 (#3707 Cursor executable/freeform 스키마)이고, 갈래는 codex/lane-b-ci-fabric-deadline 입니다. 손대는 핵심은 src/lab/fabric/producer-isolate.ts 와 새 테스트 tests/lab/lab-fabric-producer-deadline.test.ts 이며, layout 등록만 곁들입니다. 본문이 말하는 공개 CI 실패(run 33986641840)와 #3700(Go efforts / picker ordering) 아래층 검증 선행 조건과 맞습니다. 제품 카탈로그·권한·예산 숫자는 안 바꿉니다. types.ts/config.ts 분할과도 안 겹칩니다.

쉽게 말하면 이렇다. 아이솔레이트 자식이 느리면 감독이 SIGKILL을 보내고 timeout을 걸어야 한다. 그런데 지금 HEAD의 finish / settleTimeout / close 순서는, 타임아웃이 걸린 뒤에도 버퍼에 남은 result 줄이나 close 직전 프로토콜을 성공으로 받아들일 수 있다. 이 PR은 (1) killReason 이 한번 잡히면 그 실패가 끝까지 권위를 갖고, (2) activity/result를 받기 전에 expiredDeadline 으로 idle/total 중 더 이른 쪽을 다시 검사하고, (3) 실패를 확정하기 전에 childClosed 를 기다려 scratch 정리가 레이스 나지 않게 한다. stderr error 도 같은 종료 경로로 보낸다. 벽시계(Date.now)와 예산 시계(performance.now)를 갈라 써서, NTP로 시간이 흔들려도 예산은 흔들리지 않게 했다.

테스트는 가짜 DeadlineChild + 캡처된 setTimeout 으로 시간을 손으로 민다. idle 타이머 뒤 버퍼 result, 타이머 없이 시각만 지난 result, 같은 청크의 late activity+result, total 고정, idle/total 타이 브레이킹, 첫 timeout 뒤 뒤늦은 프로토콜/스트림 오류까지 잠근다. 정상 on-time success와 제품 예산 숫자는 그대로다. #3700 이 이 브랜치를 베이스로 잡고 있으므로, 이 레이어가 안 들어가면 catalog ordering 스택도 Lab 감독 실패에 막힐 수 있다. 지금 체크 롤업은 성공이 많지만 macos 조각이 빨간 적이 있어 exact-head 재확인이 필요하다.

경로/심볼 - src/lab/fabric/producer-isolate.ts expiredDeadline / settleTimeout / childClosed - 첫 실패 권위와 close 대기.
경로/심볼 - budgetNow vs now - 예산은 performance, 텔레메트리 lastActivityAt 은 주입 시계.
라인 - activity/result 공통 경로의 deadline 재검사 - 타이머 콜백이 늦게 와도 늦은 성공을 막음.
경로 - child.stderr?.on("error") - stdout/stdin과 같은 harness_failure 종료.
경로 - tests/lab/lab-fabric-producer-deadline.test.ts + layout.json - deterministic process/timer/clock 회귀.
경로 - 제품 totalTimeoutMs / inactivityTimeoutMs 값 자체 - 변경 없음(본문 약속과 일치).

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

  • macos 1/2 실패가 이 패치와 관련인지, 플래키인지: exact-head 재실행 후 머지할지
  • #3700 과 한 트레인으로 squash할지, 이 검증 레이어를 먼저 단독 머지할지
  • SIGKILL close 경로가 여전히 일반 "total timeout" 메시지로 떨어지는 것이 inactivity 권위 규칙과 문서상 충분한지

너의 추천
exact-head CI(특히 macos lab)가 초록이면 먼저 단독 머지하세요. #3700 아래층이고 dev 직행이라 지금 방향(D-lane 이후 B catalog)에 바로 도움이 됩니다. 랜딩 후 #3700 retarget/dev 재검증. types/config 분할 무효화 대상 아님.

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

@lidge-jun
lidge-jun merged commit e59b730 into dev Sep 5, 2026
30 of 32 checks passed
@lidge-jun
lidge-jun deleted the codex/lane-b-ci-fabric-deadline branch September 5, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant