Skip to content

Start the Agent cycle at the pane the page reported before the core echoes it - #548

Merged
yansfil merged 1 commit into
mainfrom
fix/flaky-540
Oct 5, 2026
Merged

yansfil merged 1 commit into
mainfrom
fix/flaky-540

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Refs #540

Summary

#513이 들인 회귀를 고칩니다. Agent pane cycle이 방금 옮긴 pane이 아니라 그 전 pane에서 시작하던 문제입니다.

  • #513과의 관계:
    • #513은 Agent cycle의 최근 pane 순서를 page 메모리에서 core(ui_state.recent_pane_ids)로 옮겼습니다. page는 방문마다 pane_visit을 보내고, cycle은 snapshot의 순서를 읽습니다.
    • Keep the Agent cycle's recent pane order across restarts #513 전에는 page의 순서가 keyboard가 옮겨 간 frame에서 바로 바뀌었지만, 지금은 core가 그 pane_visit을 반영한 snapshot이 올 때 바뀝니다.
    • 그 사이에 cycle을 열면 옛 순서를 읽어 그 전 pane이 맨 앞입니다.
    • #540의 실패(recent.spec.ts:181, 기대 w2:p1, 실제 w1:p1)는 cycle로 w2:p1에 옮긴 직후, sidebar에서 다시 cycle을 연 단계였습니다. Keep the Agent cycle's recent pane order across restarts #513 머지 직후 첫 queue run에서 처음 났습니다.
  • 수정(web/src/recent.ts):
    • page는 보낸 방문과 그때의 core 순서를 기억합니다. core 순서가 그 뒤 움직이기 전까지 보낸 pane을 맨 앞에 둔 순서를 읽습니다.
    • core 순서가 한 번 움직이면 다시 core의 순서를 그대로 씁니다. 다른 창의 방문이 core의 맨 앞을 바꾸는 경우도 core가 정합니다.
    • 순서의 주인은 그대로 core이고, page는 자기가 보낸 쓰기를 echo 전에 읽을 뿐입니다.
  • 문서: docs/UI_BEHAVIOR.md와 docs/ARCHITECTURE.md의 순서 문장에 echo 전의 읽기를 더했습니다.

Review

  • 판단해 주세요: core가 거절한 방문(목록에 없는 pane)은 core 순서를 움직이지 않으므로 page가 그 pane을 맨 앞으로 계속 읽습니다. 그런 pane은 cycle 행이 되지 않아(세션에 없는 pane은 빠짐) 보이는 차이는 없다고 봤습니다.
  • 조심해서 볼 파일: web/src/recent.ts - failure path. unechoedVisit은 순서가 움직였다고 처음 본 순간 기다림을 끝냅니다. 순서가 처음 값으로 돌아와도 다시 살아나지 않게 하려는 것이고, 기존 test 하나가 그 경우를 잡았습니다.

Evidence

  • 확인한 것: 결정적 test를 먼저 썼고, 수정 전 실패를 확인했습니다.
    • test: areaCycle.test.ts "starts at the pane the page just reported, before the core echoes it, then follows the core"
    • echo를 붙잡은 채 cycle을 열면 수정 전에는 CI와 같이 ['t2-pane', 'other-tab-pane'](옛 순서)였고, 수정 후에는 보낸 pane이 맨 앞입니다.
    • echo 뒤와 다른 창의 방문 뒤에는 core의 순서를 따릅니다.
  • 확인한 것: web typecheck, lint(e2e 크기 예산 포함), unit test 1033개 통과.
  • 확인한 것: 로컬 macOS, CPU 부하(yes 6개) 아래에서 다음을 반복했습니다.
    • recent.spec.ts 8/8 통과
    • #513의 recent-agents-restart.spec.ts 5/5 통과
  • 확인하지 못한 것: 로컬 e2e로 수정 전 실패를 재현하지는 못했습니다. 수정 전 build로도 같은 부하에서 12/12 통과했고, 이 Mac에서는 echo까지의 틈이 짧습니다. 재현은 위 unit test가 맡습니다.

…choes it

Since the pane order moved into the core, the cycle read the core's order,
which moves only when the core echoes a pane_visit. A cycle opened in that
gap started at the pane before. Until the core's order moves after a
report, the reported pane now leads the order the page reads.
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.

1 participant