Repository navigation
Bind each checkout to its own Herdr owner workspace - #250
Merged
Merged
Conversation
A checkout's owner is the Herdr workspace bound to its path (or, for a plain folder, the workspace carrying Hide's owner mark), read from the session Hide already holds. New tab and New agent here create their tab there, opening the owner with worktree.open (or a marked workspace.create) when none is open, instead of reusing the workspace of the visible tab or creating a 'hide <checkout>' workspace.
A closed tab or a pane whose tab is gone is made again in the checkout's owner Herdr workspace, opened first when none is open, instead of in the workspace it was closed from or a new workspace.create. The original index is restored only when the tab lands in the workspace it left.
An agent's identity was its task, else the label of the Herdr workspace it ran in, which named another checkout as often as its own. It is now the task, else the provider (`claude`, `codex`, or the kind Herdr reports), and the tab ladder follows it. The unread workspace label also leaves the pane rows the shell receives.
…orkspace One device folder held by several Herdr workspaces is now one checkout row keyed by its path, like this machine's. A new tab there goes to the workspace Herdr binds to the folder (or the one carrying Hide's mark), and opens one when none is open; opening a row brings its most recent tab forward; purpose goes to the owner. A folder the device helper has not confirmed is refused rather than opened on a guess about its kind.
…he provider name ladder
…space Herdr newly opened worktree.open on the pinned Herdr refuses a linked worktree unless it is opened from the repository's main worktree, and applies its label to a workspace that was already open, which renamed an operator's workspace in the isolated run. The open now starts from the repository root with no label, and a workspace Herdr newly opened is renamed after it opens. The isolated-Herdr e2e covers a new tab asked from an unbound workspace, a linked worktree with no workspace, and a plain folder.
… opens The core remembers, per device checkout, the last tab the device's Herdr had in focus there, as it remembers the visible tab on this machine, and opening the row focuses that tab while it exists; the owner's active tab is the fallback.
The first tab of an owner Herdr opened for a request is the new tab, but it kept Herdr's default name, so a checkout's tab numbering restarted in the new workspace. It is renamed to the requested label; a refusal only logs, since the tab is real.
A fold saved while a device checkout was keyed by its Herdr workspace is renamed to the folder-keyed id once the device's session names that workspace, so upgrading does not collapse the operator's device rows. Also records why plain-folder owner opens share one lock and when a reopened tab keeps Herdr's place.
Resolves agent_start_in_checkout: the checkout's owner stays the tab host, and main's agent-start prompt is carried through it.
Registering a project Herdr has no workspace in created an unbound, unmarked workspace, which the owner rule then passed over: a plain folder got a second, marked workspace on its first tab. Registration now opens the checkout's owner the same way a new tab does.
…them Herdr 0.9.1 emits workspace_closed before the tab_closed or pane_closed that closed a workspace's last tab or pane, and emits a new workspace's creation events after later changes: a seed tab replaced by layout.apply is announced closed and then focused, given a pane and laid out, and a tab given focus as it is created is announced focused before it exists. The replica read each as a divergence and rebuilt from a snapshot, and while it did the latest close stayed unconfirmed, so Reopen Closed Tab was dropped. The replica now remembers the latest ids an event removed and treats an event about one as already applied, holds a focus event until its tab or pane arrives, and lets a tab created in a workspace waiting for its close cancel that wait and read the active tab. Owner workspaces make closing a checkout's last tab close a workspace, which made this path common.
…ady retired A held focus for a pane that never arrived stayed in the replica, and a held focus replayed after a newer applied focus would move focus back. A focus Herdr applies now drops the held ones it supersedes, and retiring a tab or pane drops the focuses held for it. An event treated as already applied logs event.already_applied. A tab that pane_moved creates in a workspace waiting for its close cancels that wait as tab_created does.
An acknowledged pane.move cleared its request stamp before Herdr's events for the move arrived, so the next snapshot, still showing the child beside its parent, asked again. Each repeat moved the pane out of the tab the previous move had made and closed it, so that tab's layout arrived for a closed tab and the workspace never published: the moves repeated until a replica resync happened to break the loop (2 to 11 moves per run on main). With the replica no longer resyncing on those late events the loop ran for the whole test. The stamp now stays until the published layout shows the child in a tab of its own, and the retry interval still bounds a move whose events never come.
main's #249 fixed the same delegated-pane relocation repeat this branch fixed: both keep the move in flight until the layout shows it. Its version also runs the pass after the update's layouts are stored, so the conflicts in agents.rs, terminal.rs and the relocation test take main's side.
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.
Related: PRD
agents/prd/checkout-workspace-binding/prd.mdSummary
Hide가 만든 새 탭이 체크아웃과 상관없는 Herdr 워크스페이스(예: main 탭이
home-graphw8P)에 생기고, 에이전트 이름이 그 워크스페이스 라벨로 보였습니다.이제 체크아웃마다 소유 워크스페이스 하나를 Herdr에서 읽습니다: git은 Herdr가 그 경로에 묶은 워크스페이스, 일반 폴더는 Hide 표시 토큰(
hide_owner)을 가진 워크스페이스입니다.새 탭, New agent, 에이전트 시작, Reopen Closed Tab, 등록 프로젝트 열기가 모두 소유로 가고, 소유가 없으면
worktree.open(폴더는workspace.create+표시)으로 하나를 엽니다.SSH 기기 체크아웃은 폴더로 식별해 mini의 w5N/w5T처럼 한 폴더의 워크스페이스 여럿이 한 줄이 되고, task 없는 에이전트는 제공자 이름(
Claude,Codex)으로 부릅니다.화면 배치는 바뀌지 않습니다. 격리된 Herdr에서 묶이지 않은 워크스페이스의 탭에서 새 탭 두 번을 누른 결과(두 탭 모두 소유 워크스페이스에 생김):
Review
worktree.open이 새로 만들지 않고 그것을 묶습니다(already_open). Hide는 그대로 따르고 이름은 바꾸지 않습니다. B2의 "하나를 연다"를 이렇게 읽어도 되는지.remote.control.checkout_unconfirmed(재시도 가능)로 거절합니다. 추측해서 잘못된 종류의 워크스페이스를 만들지 않으려는 선택입니다.workspace.rename).worktree.open에 label을 주면 이미 열린 운영자 워크스페이스 이름까지 바뀌어서 label을 보내지 않습니다.workspace_closed다음에tab_closed, 새 워크스페이스의 생성 이벤트는 그 뒤의 변경이 끝난 다음에 도착). 복제본은 이를 어긋남으로 보고 스냅샷을 새로 읽었고, 그동안 마지막 닫기가 확인되지 않아 Reopen Closed Tab이 버려졌습니다(agent-tab-groups.spec.ts:157간헐 실패의 원인). 이제 이벤트가 지운 id를 기억해 그 id에 대한 늦은 이벤트는 이미 반영된 것으로 처리하고(event.already_applied로그), 아직 알리지 않은 탭·창에 대한 포커스는 그것이 올 때 적용합니다. main도 같은 거절이sidebar-menus,worktree-delete,worktree-removing-menu에서 납니다.herdr-core/src/session_sync/replica.rsretired_ids/early_focuses- 복제본이 어긋남으로 거절하던 이벤트 중 무엇을 이제 받아들이는지. id는 64개, 보류 포커스는 16개로 제한됩니다.herdr-core/src/live.rsensure_owner/open_owner_tab- Herdr 호출과 실패 경로, 일반 폴더용 프로세스 전역 잠금.herdr-core/src/device_catalog.rsgroup- 기기 체크아웃 id가 워크스페이스에서 폴더 해시로 바뀜, 옛 id 접힘 상태 이관(legacy_checkout_ids).herdr-core/src/runtime/session.rs- 소유 계산이 runtime mutex 안에서 이미 받은 세션만 읽는지(스냅샷당 Herdr 호출·I/O 없음).herdr-core/src/runtime/projects.rsagent_start_in_checkout- main 병합 충돌을 소유 경로를 유지하고 main의 시작 프롬프트(payload.prompt)를 실어 풀었습니다.herdr-core/src/live.rsregistered_owner- 병합 후 main에서 온 탭·워크스페이스 생성 경로를 모두 확인하다 찾은 기존 누락: 프로젝트 등록이 일반workspace.create로 새 워크스페이스를 만들었습니다. 이제 등록도 체크아웃의 소유를 엽니다(git 하위 폴더는 체크아웃 루트, 그 밖은 폴더 표시).Evidence
sasu implement verifyPASS(verify-cargo.sh test,lint),verify-web.sh통과. 전체 web e2e는 84 통과,checkout-owner4/4, hided 로그의event.rejected0건. 나머지 9개는 픽스처의git commit이 이 Mac의 커밋 서명 에이전트(Secretive, 잠김)에 거절된 것이라, 서명을 끈 git 설정 사본(GIT_CONFIG_GLOBAL)으로 다시 돌려 9/9 통과했습니다. verify도 같은 설정으로 돌렸습니다(서명을 쓰는 cargo 테스트 5개가 같은 이유로 실패).web/e2e/checkout-owner.spec.ts4/4: 비소유 탭에서 요청해도 소유로, 소유 없음+묶이지 않은 것 채택(이름 유지), 링크 워크트리 새로 열고 브랜치 이름, 일반 폴더 두 번 빠른 요청에 워크스페이스 하나.agent-tab-groups.spec.ts:157이 3번 중 2번 실패(b46f728 1번, 65ccfc7 2번 중 1번), main(eb30664)은 89/89. 병합 전 head(3b43c18, 로그 이름의 44fa25b8과 같은 tree)는 두 번 모두 93/93이고, 두 실행의 hided 로그 어디에도event.rejected가 없습니다(main은 로그 4개에 있음).agent-tab-groups:157만 부하 중 반복: 고치기 전 6번 중 3번 실패(모든 실행에event.rejected), 고친 뒤 12/12와 8/8 통과,event.rejected0건.sidebar-status.spec.ts:36: 복제본만 고친 상태에서 14번 중 10번 실패(창 이동 93-188회, main은 2-11회), 이동 대기까지 고친 뒤 6/6 통과(이동 1회).layout.apply로 새 워크스페이스의 첫 탭 바꾸기, 새 워크스페이스에 바로 포커스 탭 만들기, 창을 새 탭으로 반복 이동.worktree.open동작 확인: 링크 워크트리는 main worktree cwd가 필요(linked_worktree_source), label은 열린 워크스페이스도 바꿈./Applications/hide.app에서는 확인하지 않았습니다.Tab 2)을 받는 것은 두 요청이 같은 다음 라벨을 계산하기 때문이며 이 변경 전부터 있던 동작입니다(후속).github::tests::timed_out_gh_and_its_pipe_holding_helper_are_terminated(main에서 온 테스트, 이 PR은github.rs를 바꾸지 않음)가 전체 herdr-core 테스트에서 가끔 실패합니다. 연달아 돌린 비교에서 main 0/7, 이 브랜치 12번 중 3번 실패(한 번은 같은 파일의an_issue_panel_reads_only_its_fields...도). 가짜gh가 1초 안에 pid를 쓰지 못해 생기며, 혼자 돌리면 두 쪽 모두 4/4 통과합니다. 새 owner 테스트의git init을 빼도 5번 중 1번 실패해서 원인을 찾지 못했습니다(후속).sasu implement verify는 최종 head에서 통과했습니다.pnpm --dir desktop e2e)는 돌리지 않았습니다.추가 증거
AI tooling: 대부분 AI 도구. PRD의 B1-B16을 코드와 격리 Herdr e2e 결과에 하나씩 대조했습니다.
Verification record
agents/prd/checkout-workspace-binding/prd.md(sha256 c5d637b351bbbfdbe458e1aa499c8663b5f6f311a875455b800866a9c0b291d0)agents/runs/checkout-workspace-binding/verification-report.jsonandagents/runs/checkout-workspace-binding/verification-report.md; source fingerprint d23453553dc787ca7614f8dfdf0c505a49065e1d66c2616e286564f5b4fea12fbash scripts/verify-cargo.sh test(exit 0)bash scripts/verify-cargo.sh lint(exit 0)legacy_checkout_ids; device selection is never persisted. Evidence check: the checkout-owner log is tagged 0d23a72 but ran with the adoption spec that 5fb5b51 commits (registered files are append-only, so not renamed). Follow-ups: Reopen owner-lookup unit test, mark-failure counting,SidebarAgentSnapshot.workspace_labelwire cleanup.worktree.openansweringalready_open. Global plain-folder lock kept with its reason commented. Reopen position rule documented. Purpose never opens an owner (B16). Follow-up: prune legacy ids that never resolve. Open question (split part owner only at index 0) holds by construction: part 0 is the workspace's own folder, the only path Herdr binds or Hide marks.agent_start_in_checkoutkeeps the owner host and carries main'spayload.prompt; every Hide tab creation on the merged head goes throughtab_host/ensure_owner. Follow-up: registration'sneeds_herdr_workspacecompares idsadopt_registrationalways equalizes; harmless becauseensure_ownerreuses a bound or marked owner.tab_closed/pane_closedafterworkspace_closed, a new workspace's creation events arriving after later changes), which resynced and dropped Reopen; main shows the same rejection in three other specs. Fixed in 819054a; the fix exposed a relocation livelock that main's resync had been masking, fixed in 3b43c18.event.already_applied). Follow-up fixed in 626de09:pane_moved's created tab cancels a pending closure. Follow-up left:names_retireddoes not coverworkspace_closed,tab_moved,pane_movedor worktree events (they still resync as before).RELOCATION_RETRY_INTERVAL_MSholds, and the map is pruned to panes Herdr reports. Follow-ups: a unit test forpane_movedcancelling a pending closure, and for theevent.already_applieddiagnostic.recent_closed.can_reopengate can trail the core, and an owner open before a reopen may widen that window (not reproduced).