Repository navigation
Take a closing tab out of its Agent area at once - #554
Merged
Merged
Conversation
A tab close kept its chip in the strip, marked closing, until Herdr confirmed the tab gone, which is at least half a second for a pane whose process waits out SIGHUP (every Claude Code pane) and longer on a loaded machine. The Agent areas now publish and attach the stored layout less every tab a running close removes whole (a tab close, or its only pane's), so the chip leaves on the event that asked for it. The stored layout keeps the tab, so a refusal, failure or unknown result puts it back where it stood. A close that first opens a replacement shell keeps its tab until Herdr confirms, so the area never stands empty. When the closing tab holds the keyboard, the operator moves to what the area now shows instead of the next tab in Herdr's order, through the same tab focus a click sends. Herdr 0.9.1 focuses the closed tab's left neighbour on its own; with Hide's focus pending, that move is read as its answer instead of being followed, which used to move the screen a second time after the close. Closing a tab in the background no longer moves the operator, and a failed capture restores the selection as a refusal does.
With the closed tab gone from the screen at once, Reopen Closed Tab pressed right after a mistaken close reached the core before Herdr confirmed the close, and the core refused it as "still being confirmed" (the shell did not even send it, since can_reopen was false). The core now offers reopen while this machine's newest close is settling and holds the request until that close is promoted with a captured item, then runs it. A refused or failed close, a close with no captured item, a newer close, or another device in front drops it, so it never reaches an older item on the stack. An unknown result keeps it waiting for the status check.
yansfil
added a commit
that referenced
this pull request
Oct 6, 2026
… keyboard tab (#600) 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가 머지된 뒤 세 번 더 나왔습니다. - 원인: Reopen은 Herdr에서 `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`로 옮겼습니다. - 수정: 은퇴한 선택의 대체 순서를 "선택이 있던 탭 -> 같은 session pass가 checkout에 보여 주기로 한 탭 -> Herdr의 keyboard 위치 -> 첫 pane"으로 바꿨습니다. 시간 조건은 없고 그 pass의 상태만 봅니다. 같은 pass에서 Herdr의 이동을 따라갔다면 보이는 탭이 이미 Herdr의 탭이므로, 따라가기의 결과는 그대로입니다. ``` 수정 전 hided log (CI run 37399148855, 로컬 실패 8건 모두 같은 순서) tab.focus.followed w1:t2 -> w3:t1 origin=herdr pane.selection_retired Retired pane w3:p1; selected w1:p3 tab.visible_aligned w3:t2 -> w1:t2 ``` ## Review - **판단해 주세요**: 대체 후보를 Herdr keyboard 앞에 하나 더 둔 것이 `docs/ARCHITECTURE.md`의 따라가기와 대기 중 알림 규칙과 맞는지 봐 주세요. - 대기 중 알림이 있으면 Herdr의 이동은 확인으로 읽힙니다: 바꾸지 않았습니다. 보이는 탭은 여전히 `reconcile_visible_tabs`가 정하고, 이 수정은 그 결과를 읽기만 합니다. - 대기 중 알림이 없으면 Herdr의 이동을 따라가고 diagnostic을 남깁니다: 바꾸지 않았습니다. 새 test도 seed focus가 따라가졌다는 것을 먼저 확인합니다. - "focused checkout은 선택된 pane을 가진 탭을 그린다"(retirement는 탭을 pane으로 옮김): 그대로이고, 은퇴 대체를 고르는 순서만 바뀝니다. 이 순서를 같은 문단에 적었습니다. - **조심해서 볼 파일**: - `herdr-core/src/runtime/session.rs` - runtime mutex 안. 은퇴가 있을 때만 map 조회 1번과 그 pass의 layout 목록 탐색 1번이 늘고, subprocess나 I/O는 없습니다. - 같은 파일 - Herdr contract. 새 Herdr 호출은 없습니다. 은퇴 뒤 Herdr에 알리는 탭이 다른 영역 탭에서 복원 탭으로 바뀝니다. - 같은 파일 - failure path. 보이는 탭이 그 pass의 layout에 없거나 그 focused pane이 checkout pane이 아니면 기존 순서(Herdr keyboard, 첫 pane)로 내려갑니다. ## Evidence - **확인한 것**: - 새 core test `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`를 남깁니다. 수정 후 통과. - e2e `agent-tab-groups.spec.ts` 전체를 `--repeat-each=40 --workers=8 --retries=0`, `yes` 4개 부하에서 같은 base로 비교: 수정 전 8/40 실패(`:285`, 실패 8건의 hided log 모두 위 순서), 수정 후 480/480 통과. 같은 조건 `--repeat-each=30` 360/360, 해당 test만 40/40. - herdr-core 전체 1474/1475. 실패 1개는 `editor_preview::file_and_diff_previews_share_one_slot`로 이 변경과 무관하고 단독 3/3 통과했습니다. - `cargo fmt --check` 통과. - **확인하지 못한 것**: - 수정 후 처음 돌린 부하 없는 `--repeat-each=20` 한 번에서 `:285` 실패가 1건(239/240) 있었고, log를 남기지 않아 원인을 확인하지 못했습니다. 그 뒤 수정 후 run 880번(부하 포함)에서는 다시 나오지 않았습니다. - 로컬 측정은 #589와 #574가 들어오기 전 main(ca0a994) 위에서 했습니다. 이 브랜치는 그 위로 rebase했고 두 PR은 이 경로를 건드리지 않습니다. rebase 뒤 build와 test는 CI가 확인합니다(기기 디스크 7 GiB로 로컬 build 하한 아래). - 로컬 clippy는 같은 이유로 돌리지 않았습니다.
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.
Summary
탭을 닫으면 Herdr가 탭이 사라졌다고 확인할 때까지 칩이
closing…으로 남았습니다.Claude Code pane은 Herdr가 SIGHUP 유예(~500 ms)를 기다리므로 닫기마다 최소 0.6초가 보였습니다.
이제 탭 닫기와 탭의 유일한 pane 닫기는 승인되는 순간 Agent 영역에서 칩을 빼고, Herdr 확인은 뒤에서 기다립니다.
거절되거나 실패하면 탭이 원래 자리로, 포커스도 원래 탭으로 돌아오고, 결과를 모르면 탭이 다시 보입니다.
같이 바뀐 동작:
closing…을 유지: 분할된 탭 안의 pane 하나, 대체 셸이 필요한 primary 마지막 탭, SSH 기기 탭, 사이드바 agent 행.Review
herdr-core/src/runtime/agent_areas.rsshown_agent_layout- high-frequency path: 스냅샷 읽기마다 실행. 닫기가 없으면 복제 없음, 있을 때만 64개 이하 layout 복제 1회.herdr-core/src/runtime/editor.rsmove_from_closing_target,restore_close_selection- Herdr/core ownership: 닫기 안에서 FocusTab 이벤트를 적용합니다.herdr-core/src/runtime/editor.rsreopen_closed,release_queued_reopen- failure path: 대기 중 reopen이 오래된 항목에 닿지 않게 하는 조건들.Option<String>하나이고 다음 닫기·거절·실패에서 비워집니다.Evidence
herdr-core1428개,hided180개 테스트 통과(verify-cargo.sh test-scoped), fmt와 clippy-D warnings통과.runtime::tests::agent_areas): 즉시 숨김과 거절 시 복귀, Herdr의 자체 포커스 이동 무시, 백그라운드 닫기, 대체 셸 유지, reopen 대기와 거절 시 폐기.