Skip to content

Hold a tab's pane and layout until the tab is announced - #846

Merged
yansfil merged 1 commit into
mainfrom
fix/flaky-agent-tab-strip
Oct 9, 2026
Merged

yansfil merged 1 commit into
mainfrom
fix/flaky-agent-tab-strip

Conversation

@yansfil

@yansfil yansfil commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #754
Closes #756
Closes #744

Summary

  • CI에서 탭 하나의 pane_created와 layout_updated가 그 탭의 tab_created보다 먼저 core에 닿을 때가 있습니다.
  • reconcile 창 안에서 replica는 둘을 snapshot이 이미 가진 것으로 보고 버렸지만, snapshot에는 둘 다 없었습니다. 뒤이어 온 tab_created로 탭은 이미 지나간 layout을 기다리게 됩니다.
  • layout을 기다리는 탭은 workspace 전체의 publish를 막으므로, Agent 탭 줄이 마지막으로 보인 개수(16개 중 4, 7, 8, 9, 15)에서 멈췄습니다.
  • replica가 이런 pane·layout 이벤트를 탭보다 먼저 온 focus처럼 붙잡아 두었다가, 탭이 오면 도착 순서대로 적용합니다. 64개까지 붙잡고, 하나 더 오면 divergence로 보고 replica를 다시 만듭니다.

Review

  • 조심해서 볼 파일: herdr-core/src/session_sync/replica.rs - Herdr contract의 순서 가정과 publish 보류 규칙을 바꿉니다. reconcile 창 밖(Strict)에서 같은 순서는 전에는 replica 재구성과 화면 실패였고, 이제는 같은 보류입니다.
  • 판단해 주세요: 탭이 끝내 오지 않으면 붙잡힌 이벤트는 상한까지 남습니다(탭이 화면에 없을 뿐 workspace는 계속 publish). 이 정도면 충분한지.

Evidence

  • 확인한 것: 로그가 남은 실패 CI run 7개(#744의 checkout-owner 1개 포함) 모두에 같은 두 줄이 있습니다: event.reconciled "created pane references a missing tab"와 "layout references a missing tab".
  • 확인한 것: 실제 Herdr 0.9.3에서 잡은 13탭 burst를 replica에 재생하면 16개가 나옵니다. 탭 하나의 tab_created를 그 pane·layout 뒤로 옮기면 CI와 같은 두 줄이 찍히고 publish된 탭이 3개에서 멈춥니다.
  • 확인한 것: 새 테스트 a_pane_and_layout_announced_before_their_tab_apply_when_it_arrives(Reconcile, Strict 두 모드)는 main의 replica에서 실패하고 이 변경에서 통과합니다.
  • 확인한 것: herdr-core 테스트 1818개, lint, tab-strip-fit.spec.ts 로컬 12/12 통과.
  • 확인하지 못한 것: Herdr가 언제 pane·layout을 tab_created보다 먼저 보내는지는 로컬에서 재현하지 못했습니다(macOS에서는 배치마다 tab, pane, layout 순서). 근거는 CI 로그와 재생입니다.
  • 확인하지 못한 것: 로컬 반복 중 한 번, 테스트 뒤 정리에서 Herdr fixture 폴더 삭제가 ENOTEMPTY로 실패했습니다. 탭 개수와 무관한 정리 경쟁이라 이 PR에 넣지 않았습니다.

On CI a tab's pane_created and layout_updated can reach the core before
its tab_created. Inside the reconcile window the replica dropped both as
already held by the snapshot, which held neither; the tab_created then
applied and the tab waited for a layout that had already come. A tab
waiting for its layout holds its whole workspace back from publishing,
so the agent tab strip stopped changing at whatever it last showed
(issues 754 and 756: 4, 7, 8, 9 or 15 of 16 tabs). Every failed run with
logs carries the same two event.reconciled lines, and a captured burst
replayed with one tab_created moved after its pane and layout froze the
published strip the same way. Outside the window the same order rebuilt
the replica and reported a failure.

The replica now holds such pane and layout events, as it already holds
a focus that comes before its tab, and applies them in arrival order
when the tab arrives. At most 64 are held; one more is a divergence
that rebuilds the replica.

Closes #754
Closes #756
@yansfil
yansfil merged commit 49d438c into main Oct 9, 2026
20 checks passed
@yansfil
yansfil deleted the fix/flaky-agent-tab-strip branch October 9, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment