Repository navigation
Keep a retired selection on the tab the checkout shows before Herdr's keyboard tab - #600
Merged
Merged
Conversation
… keyboard tab A reopen's seed tab can be focused after the reopen answered, and the core follows that focus. When layout.apply replaces the seed, the selected pane retires, and its replacement took the pane Herdr's keyboard was on, which can be another Agent area's tab, so the screen left the restored tab. The replacement now prefers the tab the same session pass has the checkout showing before Herdr's focused pane. Refs #425
yansfil
added a commit
that referenced
this pull request
Oct 6, 2026
Refs #594 Related: #600 (같은 `session.rs`, 그 위에 rebase) ## Summary Agent cycle(⌃Tab)을 commit한 직후 다시 cycle을 열면 순서가 틀어지던 core 결함을 고칩니다. `keys.spec.ts` "⌃Tab and ⌥Tab commit once"가 macOS에서 가끔 첫 시도에 실패하던 원인입니다. - 기전: 다른 tab의 pane으로 가는 `focus_pane`은 Herdr에 `pane.focus`를 보냅니다. Herdr는 바로 답하고, 그 때문에 바뀐 active tab은 session stream으로 나중에 알립니다. - core에는 그 tab 이동을 기다리는 기록이 없어서, 늦게 온 이동을 Herdr 자신의 이동으로 보고 따라갔습니다(`tab.focus.followed`가 지나온 tab 순서대로 남음). - 화면이 이전 tab으로 돌아가고 shell이 그 pane을 방문으로 기록해, 다음 cycle의 순서가 틀어졌습니다(CI: cycle 2가 `w1:p1` 대신 `w1:p4`). - 고침: Herdr가 보이지 않는 tab의 pane focus는 그 tab을 기존 tab 기다림(`pending_tab_focus`)에 기록합니다. 새 장부는 없습니다. - pane focus와 함께 sent가 되고, 그 pane control이 도는 동안 만료되지 않으며, Herdr의 답부터 같은 3초 deadline을 받습니다. - 다음 이동이 대체하면 기존 규칙대로 `superseded_tab_focus`가 되어 늦은 답이 소비됩니다. 거절, 보내기 전 대체, lane이 받지 못함이면 지웁니다. - Herdr가 이미 그 tab에 있으면(또는 Hide의 남은 tab 요청이 그 tab이면) 아무것도 기록하지 않습니다. - `docs/ARCHITECTURE.md`의 pending model 문단에 이 기다림을 적었습니다. test 파일(`keys.spec.ts`)은 바꾸지 않았고 retry, timeout, sleep, allow를 더하지 않았습니다. ## Review - **판단해 주세요**: "Herdr가 tab을 옮기는가"를 `herdr_active_tab_ids`와 Hide의 남은 tab 요청으로 판단합니다. 남은 요청이 있으면 그 tab을 Herdr가 곧 보일 tab으로 봅니다. - **조심해서 볼 파일**: `herdr-core/src/runtime/session.rs` - runtime mutex 안. 추가된 일은 navigator에서 pane의 tab을 찾고 기다림 하나를 쓰는 것뿐이고 I/O는 없습니다. - **조심해서 볼 파일**: `session.rs` `expire_pending_view_focus` - failure path. pane control이 도는 동안 그 pane이 건 tab 기다림은 만료하지 않습니다(pane 쪽 규칙과 같음). - **비용 검토**: `focus_pane`마다 navigator의 tab과 pane을 한 번 훑습니다. 새 상시 작업, 알림, queue는 없습니다. ## Evidence - **확인한 것 (수정 전 실패)**: 새 core test 2개는 기다림을 거는 함수를 비우면 실패하고 되돌리면 통과합니다. - **확인한 것 (#600 위)**: main af09e76(#600, #602 포함)에 rebase한 162c1b54에서 `nextest -p herdr-core` 1491개 통과, clippy `-D warnings`, fmt 통과. - **확인한 것 (부하 아래 e2e, 162c1b5)**: `yes` x6, 3 workers, retries 0으로 `agent-tab-groups` 120/120(12개 x10), `recent`(Recent와 area cycle) 20/20. - **확인한 것 (재현 probe)**: commit 직후 다시 cycle하는 15 round probe를 같은 부하에서 12번: 수정 전 9개 cycle 불일치와 run 1개 실패, 수정 후(rebase 뒤 포함) 360개 cycle 모두 일치. - **확인하지 못한 것**: `keys.spec.ts`(desktop native focus)는 로컬에서 돌리지 않습니다. 이 PR의 CI desktop lane으로 봅니다. 원래 실패는 run 몇 번에 한 번이라 녹색 run 하나로 재발 없음을 증명하지 못합니다. - **확인하지 못한 것**: core test `usage_activity_hints_are_accepted_without_persisting_ui_state`가 e2e 부하 중 전체 실행에서 한 번 실패했습니다. 단독 60번 반복에서 main 코드 1/60, 이 브랜치 2/60과 1/60이라 이 변경과 무관한 기존 경합으로 봅니다. <details><summary>추가 증거</summary> - 새 test: `view_authority_a_pane_focus_s_late_tab_move_is_its_answer_not_an_outside_focus`(pane focus 4번 뒤 stream이 t3, t1, t2, t1을 늦게 알려도 화면은 t1, 그 뒤 Herdr 자신의 t3 이동은 따라감). - 새 test: `view_authority_a_pane_focus_tab_wait_ends_when_no_tab_move_will_arrive`(거절, Herdr가 이미 그 tab, stream이 끝내 알리지 않음의 세 경우 모두 기다림이 끝나고 이후 Herdr의 이동을 따라감). - 수정 전 실패 메시지: "Herdr naming w-order:t3 does not move the tab the operator chose last", "a focus in another tab moves Herdr's tab". - probe는 조사용이라 커밋하지 않았습니다. </details>
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 #425
Related: #554
Summary
agent-tab-groups.spec.ts"New tab and Reopen use the requested area"가 Reopen 직후 왼쪽 영역의 복원 탭 대신 오른쪽 영역 탭을 보여 주던 제품 원인을 고칩니다(:285).#554의 회귀입니다: 이 실패 모양은 #554 PR 자신의 CI run(2026-10-05 18:31Z)에서 처음 나왔고, #554가 머지된 뒤 세 번 더 나왔습니다.
workspace.create로 seed 탭(w3:t1)을 만들고layout.apply로 그 탭을 복원 탭(w3:t2)으로 바꿉니다.seed 탭의 이벤트는 Reopen의 답보다 늦게 도착할 수 있고, 그때 기다리는 알림이 없으므로 core는 seed 탭 focus를 Herdr의 이동으로 따라갑니다(
tab.focus.followed).seed가 사라지면 선택된 pane
w3:p1이 은퇴하는데, 그 대체가 Herdr의 keyboard가 있던 다른 Agent 영역의 pane(w1:p3)을 골랐고,tab.visible_aligned가 화면을w3:t2에서w1:t2로 옮겼습니다.같은 pass에서 Herdr의 이동을 따라갔다면 보이는 탭이 이미 Herdr의 탭이므로, 따라가기의 결과는 그대로입니다.
Review
docs/ARCHITECTURE.md의 따라가기와 대기 중 알림 규칙과 맞는지 봐 주세요.reconcile_visible_tabs가 정하고, 이 수정은 그 결과를 읽기만 합니다.herdr-core/src/runtime/session.rs- runtime mutex 안. 은퇴가 있을 때만 map 조회 1번과 그 pass의 layout 목록 탐색 1번이 늘고, subprocess나 I/O는 없습니다.Evidence
a_followed_reopen_seed_that_goes_leaves_the_operator_on_the_restored_tab: FakeHerdr로 Reopen 답 -> seed 생성과 focus(따라가짐 확인) -> seed가 사라지고 복원 탭 도착 + Herdr keyboard는 오른쪽 영역 순서를 재현합니다.수정 전에는 checkout 활성 탭이
t2(기대t4)로 실패하고 hided와 같은pane.selection_retired,tab.visible_aligned를 남깁니다. 수정 후 통과.agent-tab-groups.spec.ts전체를--repeat-each=40 --workers=8 --retries=0,yes4개 부하에서 같은 base로 비교:수정 전 8/40 실패(
:285, 실패 8건의 hided log 모두 위 순서), 수정 후 480/480 통과. 같은 조건--repeat-each=30360/360, 해당 test만 40/40.editor_preview::file_and_diff_previews_share_one_slot로 이 변경과 무관하고 단독 3/3 통과했습니다.cargo fmt --check통과.--repeat-each=20한 번에서:285실패가 1건(239/240) 있었고, log를 남기지 않아 원인을 확인하지 못했습니다. 그 뒤 수정 후 run 880번(부하 포함)에서는 다시 나오지 않았습니다.