Skip to content

Follow the snapshot's focus onto a pane, not the answer that catches up with the last click - #614

Merged
yansfil merged 2 commits into
mainfrom
fix/flaky-608
Oct 6, 2026
Merged

yansfil merged 2 commits into
mainfrom
fix/flaky-608

Conversation

@yansfil

@yansfil yansfil commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Refs #608
Related: #589

Summary

overview-modal.spec.ts "shared Overview preserves work, returns the keyboard and has direct sidebar commands"가 Overview에서 Agents 사이드바 명령 뒤 사이드바가 키보드를 잡지 못하던 제품 원인을 고칩니다(:101).
#589의 회귀입니다: #589 이후 처음 나왔고(run 37406686557), 원인은 #589가 바꾼 pane의 따라가기 effect입니다.

  • 사용자 영향: 터미널을 클릭한 직후 ⌘⇧A(Agents 사이드바)를 누르면, 클릭에 대한 core의 답이 도착하는 순간 키보드가 터미널로 돌아갑니다. 사이드바에서 화살표나 Enter가 터미널로 갑니다. Agent cycle이나 Overview를 거쳐 사이드바로 가도 같습니다.
  • 원인: Keep keyboard focus on the last-clicked pane until the core answers that click #589 이후 PaneView의 "스냅샷의 focused pane 따라가기" effect가 core가 operator focus 번호를 따라잡을 때(caughtUp)도 다시 돕니다. focused pane이 바뀌지 않았는데도 그 순간 focusTerminal을 불러, 그 사이 운영자가 옮긴 키보드를 되돌렸습니다.
    test는 바로 앞 Agent cycle이 이미 focused인 pane에 focus_pane을 보내고 곧바로 사이드바로 가므로, 답이 늦게 오는 runner에서만 실패했습니다.
  • 수정(web만, timer 없이 상태 전이로):
    • 스냅샷의 focus가 이 pane으로 옮겨 온 순간만 따라갑니다. 따라잡음 자체는 이동이 아닙니다.
    • 옮겨 온 순간 아직 따라잡지 못했으면 한 번 대기하고, 따라잡을 때 실행합니다.
    • 그 대기는 focus가 다른 pane으로 가면 버리고, 대기를 세울 때와 실행할 때 키보드 위치가 다르면(운영자가 그 사이 옮김) 버립니다. palette guard는 그대로입니다.

Review

  • 판단해 주세요: core가 거절한 클릭의 답이 클릭 전 pane을 그대로 가리키면, 이제 키보드를 옮기지 않습니다. 키는 클릭한 pane에, focus 테두리는 core의 pane에 남습니다.
    Keep keyboard focus on the last-clicked pane until the core answers that click #589 이전과 같은 동작이고, #589가 따라잡음에서 우연히 맞춰 주던 경우입니다. docs/ARCHITECTURE.md에 그렇게 적었습니다. 이 경우도 맞춰야 한다면 별도 issue로 다루는 게 맞다고 봅니다.
  • 조심해서 볼 파일:
    • web/src/PaneView.tsx - snapshot을 따라 DOM focus를 옮기는 유일한 자리입니다. 대기 상태는 pane 하나에 ref 두 개이고, focus나 따라잡음이 바뀔 때만 계산합니다.
    • web/e2e/stale-snapshot-focus.spec.ts - holdSnapshots가 page에 넘긴 frame 수를 세고, read는 page probe의 arrivals가 그 수에 닿을 때까지 기다립니다. 화면을 바꾸지 않는 답이 처리됐다는 것을 시간 대신 상태로 확인합니다.

Evidence

  • 확인한 것:
    • stale-snapshot-focus.spec.ts에 새 test 2개(#589의 frame 보류 helper 사용):

      • "이미 focused인 pane 클릭 -> 답 보류 -> 사이드바로 키보드 -> 답 전달 -> 사이드바 유지"
      • "뒤처진 채 focus가 pane으로 옴 -> 사이드바로 키보드 -> 답 도착 -> 사이드바 유지"
    • 같은 spec을 세 build로 각 5회, --retries=0:

      build Keep keyboard focus on the last-clicked pane until the core answers that click #589 test 2개 새 test 1 새 test 2
      main(수정 없음) 통과 5/5 실패 5/5 실패
      수정, 키보드 위치 guard 없음 통과 통과 5/5 실패
      이 PR 통과 통과 통과
    • 부하(yes 4개)에서 --repeat-each --workers=8 --retries=0:

      • stale-snapshot-focus.spec.ts 20회: 80/80.
      • overview-modal, recent, recent-agents-restart, pane-focus-ordering, cmdk, palette, sidebar-shell, s2, digit-hints 10회: 249/250.
        실패 1건은 cmdk.spec.ts:215의 ⌘K Recent에 checkout이 하나 더 있던 것입니다. Recent는 core가 기록하고(track_recent_checkouts), 이 PR은 page의 DOM focus만 바꾸므로 무관하다고 봅니다.
    • web typecheck, lint(e2e 크기 검사 포함), 단위 test 1050개 통과.

  • 확인하지 못한 것:
    • CI 첫 시도의 hided log는 남지 않았습니다(artifact에는 통과한 retry의 log만 있음). 이 실패는 page 안의 DOM focus 문제라 hided log에는 원래 흔적이 없습니다.
    • 원래 실패한 overview-modal.spec.ts의 수정 전 부하 반복은 하지 않았습니다. 원인 경로는 새 test가 결정적으로 재현합니다.
    • desktop(Electron) 창에서 직접 확인하지 않았습니다. 바뀐 것은 web의 DOM focus 경로이고, desktop은 같은 web shell을 씁니다.

…up with the last click

Since the page numbers each operator focus, a pane re-ran its follow when
the core's answer caught up, even when the focused pane had not changed.
The answer to a click on the pane already focused then pulled the keyboard
back into the terminal after the operator had moved it to the sidebar or
Overview. The page now follows only a move of the focus onto the pane; a
move that arrives before the answer waits for it once, and is dropped when
the focus leaves the pane or the keyboard has moved since.

Refs #608
@yansfil
yansfil merged commit 51ba1b5 into main Oct 6, 2026
18 checks passed
@yansfil
yansfil deleted the fix/flaky-608 branch October 6, 2026 05:40
yansfil added a commit that referenced this pull request Oct 8, 2026
Related: yansfil/sasu#30 (`/ship merge`가 이 검사를 매 머지마다 돌리고 출력을 보여 주게 하는
쪽)

## Summary

Hide와 GitHub은 PR과 이슈를 `Closes #N` 같은 closing keyword로만 잇는데, 10-06~07에
이슈를 끝낸 PR 7개(#607 #612 #614 #622 #631 #634 #712)가 이 줄 없이 머지됐고 이슈는 손으로 닫혀
연결이 남지 않았습니다.
이제 `scripts/premerge-check.py`가 닫는 이슈가 없는 PR에 머지 명령 바로 위에서 알림을 한 줄 찍습니다.
막지는 않습니다. 이슈 없이 시작한 PR(PRD 작업, CI·문서 변경)도 많기 때문입니다.

```
note: #454 closes no issue. If it finishes one, put `Closes #<issue>` on the body's Closes line before merging (editing the body does not rerun `verify`); with no issue, merge as it is.
#454 may merge now: gh pr merge 454 --merge --match-head-commit a1eda76...
```

## Review

- **판단해 주세요**: 알림만 하고 막지 않는 수준이 맞는지. 막으려면 "이슈 없음"을 PR 본문에 명시하는 규칙이 따로
필요합니다.

## Evidence

- **확인한 것**: 실제 PR로 실행. 이슈를 닫는 #781에는 알림 없음, 닫는 이슈가 없는 #454에는 위 알림이 찍히고
머지 가능 판정은 그대로.
- **확인한 것**: `test_premerge_check.py`에 알림 유무 테스트 1개 추가, `scripts/tests`
206개 통과, `check-no-attribution` 통과.
- **확인하지 못한 것**: PR을 만드는 순간의 알림은 없습니다. 머지 직전에만 알려서, 그때 본문을 고치는 흐름입니다.
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