Skip to content

fix: keep a closed agent registered until Reopen closed brings it back - #2316

Merged
yansfil merged 3 commits into
mainfrom
fix/agent-reopen-registration
Nov 9, 2026
Merged

yansfil merged 3 commits into
mainfrom
fix/agent-reopen-registration

Conversation

@yansfil

@yansfil yansfil commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Related: with-hide/hide-private#771

Summary

에이전트 탭을 닫았다가 Cmd+Shift+T(닫은 항목 다시 열기)로 되살리면 화면과 대화는 돌아오지만, Hide가 그 칸을 에이전트로 다시 등록하지 않았습니다.
닫는 순간 등록이 칸과 함께 끝나 버려서, 다시 연 칸은 에이전트 목록에 없고 편지도 못 받고 부모의 지켜보기도 끊겼습니다.

이제 다시 열 수 있는 동안(최근 닫은 목록 20칸 안에 있는 동안) 등록을 붙잡아 두고, 다시 열어 같은 대화가 이어지면 새 칸으로 옮깁니다.
붙잡힌 동안 그 에이전트는 새 상태 closed로 읽힙니다: 일하는 중이 아니고, 부모에게 조용함 경고가 가지 않고, 미션·플랜 상한에 세지 않으며, 그 에이전트에게 보낸 편지는 기다렸다가 다시 열린 칸으로 갑니다.
목록에서 밀려나거나, 새 대화로 시작하거나, hided가 다시 시작되면 등록은 예전처럼 끝납니다. 트리 닫기도 같은 규칙으로 합쳤습니다.

스크린샷 없음: 화면 변경 없음 (core와 CLI 계약만)

Review

  • 판단해 주세요: CLI 계약의 runtime/state에 값 closed가 더해집니다(hide ps, hide agent show, 편지 답). 미션 화면은 closed를 끝남으로 보여 줍니다.
  • 판단해 주세요: 운영자의 Reopen closed는 상한 검사를 거치지 않습니다(플랜 자식을 운영자가 깨우는 것과 같은 예외). 돌아온 에이전트는 다음 spawn부터 다시 세고, 에이전트가 닫힌 에이전트를 되살리는 경로는 없습니다. 미션 상한은 닫힘만 빼고 잠듦은 지금처럼 셉니다. private 문서는 with-hide/hide-private#771.
  • 판단해 주세요: 붙잡힌 등록은 메모리에만 있어 hided 재시작으로 끝납니다. 최근 닫은 목록도 메모리에만 있어 같은 수명입니다.
  • 조심해서 볼 파일: hide-core/src/runtime/closed_registrations.rs - 붙잡기·놓기·이어가기를 한 곳에서 정하는 새 모듈. 잠든 에이전트의 take_over_registration을 그대로 씀.
  • 조심해서 볼 파일: hide-core/src/runtime/editor.rs - 닫기 정리(promote_close_reservations)와 다시 열기 결과 처리, 모든 닫기 경로에서 놓기가 빠지지 않는지.
  • 조심해서 볼 파일: hide-core/src/runtime/delivery.rs - 지켜보기 읽기를 붙잡힌 대상에서 건너뜀, 닫힌 대상에게 가는 편지 경로.
  • 조심해서 볼 파일: hide-core/src/recent_closed/reopen.rs - Pi·omp는 행과 엔진이 세션을 다르게 부르므로, 등록을 다시 연 에이전트와 함께 실어 보냄.
  • 비용 검토: 붙잡힌 등록은 닫힌 항목에 하나씩 붙고 목록 20칸이 상한. 매 delivery 읽기마다 목록을 한 번 훑음(최대 20항목, 트리 64칸). 프로세스·I/O 없음, 잠금 안에서 메모리만.

Evidence

  • 확인한 것: 고치기 전 실패. together 하네스(v1.2.4, 후보 5e87695)에서 다시 연 뒤 after_registered None, 원래 등록 ended:true.
  • 확인한 것: 새 테스트 7개(runtime::tests::closed_registrations): 다시 열면 같은 등록이 새 칸으로(기록·지켜보기·편지 이동), Pi·omp 세션 형태 차이, 목록 밀림·새 대화·항목 없는 정리·재시작에서 끝남, 붙잡힌 동안 편지가 기다렸다 새 칸으로.
  • 확인한 것: 결함 심기(closed_panes의 등록을 None으로)에서 새 테스트 3개와 트리 다시 열기 2개가 실패, 되돌리면 통과.
  • 확인한 것: hide-core 필터 회귀 602개 통과(delivery, agent_sleep, mission, plans, ps, coordination, recent_closed, tree_reopen, tree_close, watch 등). hide-core clippy -D warnings, fmt 통과.
  • 확인한 것: contracts/hide-cli.json 재생성, hided cli_contract::tests::the_committed_contract_is_the_exported_one 통과.
  • 확인한 것: 라이브(이 브랜치 debug 빌드, 격리 state·HOME, 가짜 모델, journey로 --parent here 시작, 코어 close_pane·reopen_closed 이벤트): Claude Code·Codex CLI 기본과 프로필이 같은 agent id·같은 세션·같은 부모로 0.7~1.5초 안에 다시 등록. 닫힌 동안 runtime closed, watch 유지(경고 0). 다시 연 뒤 watch 대상이 새 칸. 프로필을 지운 뒤 다시 열면 거절 알림과 함께 등록 종료(B20 그대로).
  • 확인하지 못한 것: 닫힌 동안 보낸 편지가 다시 연 칸에 전달되는 것은 라이브로 아직 못 봤습니다(첫 런 하네스가 편지 id를 못 읽음, 단위 테스트로만 확인). Pi·Grok·omp·OpenCode 라이브도 아직입니다. 고친 하네스로 다시 돌려 덧붙이겠습니다. 네이티브 Cmd+Shift+T 키 입력은 재지 않았습니다(같은 reopen_closed 이벤트).
  • 확인하지 못한 것: 전체 워크스페이스 clippy·전체 테스트는 CI에 맡김(로컬은 디스크 여유 약 5 GB라 필터 테스트만).
Verification record
  • base 2437635, head 412f417
  • hide-core nextest filtered: 602 passed; clippy hide-core --all-targets -D warnings: pass; hided cli_contract: pass

Closing an agent tab and reopening it with Reopen closed brought the
screen and the conversation back, but the agent's delivery registration
had already ended with its pane, so the reopened pane was no agent:
not in the agent list, no letters, no parent watch.

A close kept for reopen now holds the registration of each agent its
panes ran, the way a sleeping session's is held, for as long as the
item can be reopened. While held the agent reads `closed`: not running,
no watch reading and so no quiet-child warning, no place under a
mission's or a plan's cap, and a letter to it waits with its hour
running. A reopen whose conversation resumes moves the registration to
the new pane through the delivery store's rebind, so its letters, its
watch, its parent and its spawn receipt follow it. An item pushed off
the list, a reopen that starts a new conversation, a close that settles
without an item, and a restart end it as before.

The reopen worker carries the registration with the agent it resumed,
so Pi and omp, whose row and engine name the session differently,
continue too. A tree close now uses the same hold.
@yansfil

yansfil commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

PASS - 소스 리뷰, head 1f0104f99eb16d2d900224d27cff424abaedab12.

현재 serious/ordinary/minor 지적 없음. 코드 수정 없이 읽었습니다.

  • 정확성: 닫기 시작부터 최근 닫은 목록, 트리 보관, 다시 열기 인계까지 등록을 붙잡고, 목록 밀림·항목 없는 종료·새 대화·재시작에서 놓는 경로를 확인했습니다. closed의 list/show/ps/미션·phone 투영과 CLI 계약도 대조했습니다.
  • 분산·단순성·모듈 경계: 트리 전용 보관을 closed_registrations로 합치고 잠들기와 같은 take_over_registration을 씁니다(원칙 13). 추가 경로에 Mutex 아래 I/O는 발견하지 못했습니다.
  • 소유·상한: 보관 목록 20개, 트리 64칸, 실패·밀림에서 해제를 확인했습니다(원칙 14·15). 운영자의 다시 열기는 기존 플랜 Wake처럼 상한 예외이고 다음 spawn부터 다시 셉니다. 미션은 closed만 제외하고 asleep는 계속 세며, 플랜은 asleep/closed를 제외합니다.
  • 계약 지적 해소: docs/delivery.md:1039와 짝 hide-private #771 head bca5598ef263a37025fc68812609fb1b655c90ad가 위 정책을 명시하고 서로 연결됐습니다. 수동 복귀에 새 admission을 더할 필요는 없다고 판단했습니다.
  • 테스트: 공식 v1.2.4 및 이전 후보의 고치기 전 실패, 결함을 다시 심었을 때 5개 실패, 복원 후 필터 602개 통과와 clippy/fmt/CLI 계약 로그를 읽었습니다(원칙 12). 최종 커밋은 검토한 코드에서 문장 하나만 바뀌었습니다. #2312와 실행 코드 겹침은 없고 ARCHITECTURE.md만 겹칩니다.

증거의 한계: 리뷰어는 빌드·테스트·앱 조작을 실행하지 않았습니다. 워커의 격리된 가짜 모델 런에서 Claude·Codex 기본/프로필의 같은 등록 복귀, 부모·watch 대상 이동, 지운 프로필 거절을 확인했습니다. 첫 런은 하네스가 편지 id를 잘못 읽고 watch list --json도 거절되어 레터 실제 전달 및 장시간 조용함 경고 검증을 증명하지 못합니다. Pi·omp 단위 테스트는 세션 관찰을 주입하므로 실제 CLI 경계의 증거가 아닙니다. Pi/Grok/omp/OpenCode 라이브, 네이티브 Cmd+Shift+T, 실제 레터 전달, 업데이트 뒤 깨우기, 최종 head 전체 CI는 c1/c2/verify/ci에서 별도로 확인해야 합니다. 이 PASS는 그 완료를 대신하지 않습니다.

…stration

# Conflicts:
#	contracts/hide-cli.json
#	docs/delivery.md
@yansfil

yansfil commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Evidence update after the body was written (head acd78fa, same product code as 1f0104f plus a main merge):

  • A letter sent while the agent was closed waited and was delivered to the reopened pane (Claude Code and Codex CLI, default and profile), with the watch moved to the new pane and no warning.
  • Pi, Grok and omp re-registered with the same id, session and profile on default and profile; a removed profile is still refused.
  • OpenCode live was not reached: the local journey harness stops at start before reopen (hide-private#780). OpenCode reopens through the same registration hand-over as the others.
  • One refusal on the first reopen of a just-created worktree's last tab is an existing race on main, tracked in hide-private#779.

@yansfil
yansfil added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 9d72a38 Nov 9, 2026
38 checks passed
@yansfil
yansfil deleted the fix/agent-reopen-registration branch November 9, 2026 14:05
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 9, 2026
…rs and operator waits (with-hide#2323)

Closes with-hide#2301
Closes with-hide#2302
Closes with-hide#2300
Closes with-hide/hide-private#684
Related: with-hide/hide-private#778 (짝 문서 PR, 서로 짝)

## Summary

미션 명령이 틀린 답을 주던 세 가지를 고칩니다.
- `hide mission show mission-41`처럼 Hide 편지가 안내하는 미션 id로 보면 그 미션 전체를 보여
줍니다(전에는 `mission_node_unknown`).
- Conductor가 띄운 작업자·검사자가 `hide mission show`로 자기 미션을 읽고, 작업자는 `hide
mission node <자기 노드> --pr/--no-pr/--branch/--line`을 직접 씁니다(전에는
`mission_none`). 그 밖의 변경과 다른 노드는 계속 Conductor 몫입니다.
- `--mission` 없이 쓴 명령은 정해진 순서로 미션을 고릅니다: 내가 지휘하는 열린 미션, 없으면 내가 작업·검사하는
열린 미션 하나, 없으면 마지막에 완료한 내 미션. 열린 미션 둘에 걸쳐 있으면 짐작하지 않고
`mission_ambiguous`로 거절해 `--mission`을 쓰게 합니다.
- 20분 무활동 watch와 90분 no-push 경고가 같은 규칙 하나를 읽고, 노드가 운영자 답(raise, `decide
--node`)을 기다리는 동안에도 조용합니다.
- 지도 N/M(with-hide#684)은 #2200에서 이미 고쳐졌고, 기존 웹 시험이 옛 계산에서 실패함을 확인해 닫습니다.

with-hide#2304(검사가 다시 돌기 전 "CI passed" 편지)는 이 PR에서 뺐고, 원인과 뺀 이유는 이슈에 남겼습니다.

스크린샷 없음: 화면 변경 없음, core·CLI 도움말·계약만 바뀝니다.

## Review

- **판단해 주세요**: 미션 고르는 순서(위 Summary)와, 열린 미션 둘이면 거절하는 쪽을 택한 것. 첫 번째 것을
고르면 작업자가 엉뚱한 미션의 노드를 바꿀 수 있어서입니다. 도움말(`hided/assets/mission/help.md`)과 짝
문서에 순서를 적었습니다.
- **판단해 주세요**: with-hide#2300 사례(start-line)는 이 규칙으로도 경고가 납니다. 그때 CI는 GitHub 504로
실패 상태였고(실패한 CI는 작업자 몫), 운영자 스크린샷 승인은 지도에 `decide --node`로 올라가 있지 않았습니다.
운영자 대기를 조용히 하려면 결정을 노드에 걸어야 합니다(도움말에 적음).
- **조심해서 볼 파일**: `hide-core/src/runtime/mission_criteria.rs` - `Caller`는
명령마다 원장 agents를 한 번만 훑어 호출자의 등록과 장부의 미션들이 가리키는 작업자·검사자 등록을 함께 읽고,
`mission_meant`가 고르는 순서를 한 곳에 둡니다. show, node, record, skip이 이것으로 미션을
고르고 답(미션 보기, 노드 보기, 두 편지 목록)도 그립니다(`mission_view_for`).
- **조심해서 볼 파일**: `hide-core/src/runtime/missions.rs` - `show`와 `show
<node>`는 한 번 읽은 등록으로 보기와 편지 목록을 같이 그리고, 작업자의 `node` 답도 그 등록으로 그립니다(작업자
patch는 에이전트를 바꾸지 않음). Conductor 경로는 전과 같이 답을 그릴 때 한 번 읽습니다.
- **main 병합(with-hide#2316 뒤)**: `runtime/missions.rs`의 충돌은 #2316의
`worker_life`(닫힌 에이전트를 미션에선 끝남으로 읽음)와 이 PR의 `named_agents`·편지 함수를 둘 다 남겨
풀었습니다. `mission_view_for`도 `sleeping_registrations`의 `closed`를 그대로 받아 닫힌
작업자를 끝남으로 그리고, 미션 고르는 규칙은 바뀌지 않았습니다. `contracts/hide-cli.json`은 병합된 소스로
다시 만들어 main과의 차이는 `mission_ambiguous` 네 곳뿐입니다.
- **조심해서 볼 파일**: `hide-core/src/mission_health.rs` - `quiet_waits`가
no-push 경고와 watch(`mission_worker_waits`)의 한 규칙입니다. 전에는 두 곳이 따로 계산해 병합된
PR과 실패한 줄에서 서로 달랐습니다.

## Evidence

- **확인한 것**: 새 core
시험(`a_nodes_worker_and_checker_use_the_mission_commands_of_their_own_node`,
`a_caller_in_two_open_missions_names_the_one_it_means`,
`a_mission_workers_watch_is_quiet_while_its_node_waits_on_the_operator`,
`a_node_waiting_on_the_operator_raises_no_quiet_warning`)은 수정을 되돌리면 실패하고
수정으로 통과합니다. 다중 미션 시험은 거절 규칙을 끄면 작업자가 말없이 mission-1을 받아 실패합니다.
- **확인한 것**: `hide-core` mission·watch·quiet 시험 357개, `hided`
mission·cli_contract·guide 시험 35개(커밋된 `contracts/hide-cli.json` 비교 포함)
통과, `verify-cargo.sh fmt-check`, `clippy -p hide-core -p hided --tests`
경고 없음.
- **확인한 것**: 격리 후보 hided(d9dcfa2)에서 실제 `hide` CLI로 미션 id show,
작업자·검사자의 이름 없는 show, 작업자 자기 노드 pr/branch/line 변경이 되고, 권한 밖 변경은
`mission_not_conductor`로 거절됨(verify 검사자 기록, 끝난 뒤 후보 프로세스 0).
- **확인한 것**: 웹 `src/missions.test.ts` 59개 통과, with-hide#2200 전 계산으로 바꾸면 `expected
'1/2 passed', got '1/3 passed'`로 실패.
- **확인하지 못한 것**: 다중 미션 거절(`mission_ambiguous`)은 core 시험으로만 확인했고 격리 후보
CLI로는 돌리지 않았습니다. 전체 verify 레인은 CI에 맡깁니다.
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