Repository navigation
fix: share pane requests when waking after an update - #2312
Conversation
|
PASS - PR #2312 소스 리뷰, head 이전 차단 사유 닫힘: serious / correctness,
경로는 워커 checkout의 |
|
#2297 ( |
|
PASS - PR #2312 증분 소스 리뷰, head
이전 지적 폐쇄 상태는 유지됩니다. 실행 증거는 워커 원문을 독립적으로 읽어 확인했습니다.
최초 Codex 90초 실패의 원인은 여전히 미확정입니다. |
…e#2322) Closes with-hide#2299 Closes with-hide#2303 Closes with-hide#2296 Closes with-hide/hide-private#719 Related: with-hide#2312 (carries the fix for with-hide#2297) ## Summary Four commands gave a wrong answer; each now says what actually happened. - `hide agent show` given an ended agent's name or pane said `agent_unavailable` with "retry the same intent". It now finds that agent and shows it ended. A key that matches no agent gets a message that says how to find one, and no longer suggests a retry. - `hide agent list --live` lists only running agents. Plain `hide agent list` still prints every agent, so existing callers keep working. - `hide workspace remove` said `worktree_remove_stopped` ("worktree remains") when Git had removed the worktree but its list could not be read afterwards (a full disk). If the folder is gone, it now answers that the worktree was removed. - A pane program's first `hide` call, made before its holder had recorded that the program was running, was refused `pane_not_found`. The call now waits for that start to finish. Real CLI on an isolated candidate hided, after its one registered agent `agent-1` (`journey-controller`, pane `h1:p1`) ended: ``` $ hide agent show agent-1 -> runtime "ended" $ hide agent show journey-controller -> agent-1, runtime "ended" (before: agent_unavailable, "retry the same intent") $ hide agent show h1:p1 -> agent-1, runtime "ended" $ hide agent show nobody -> agent_unavailable: Hide knows no agent by that: take its id from hide agent list (agent-N); hide agent show also takes a spawn's id (spawn-N), the agent's name or its pane $ hide agent list -> [agent-1] $ hide agent list --live -> [] ``` ## Review - **판단해 주세요**: with-hide#2303 is solved with an opt-in `--live` switch rather than by changing what `list` prints. Dropping ended agents from the default would silently change the output of scripts and agents that read `list --json` to find an ended child's result; a switch adds the short form without breaking them. - **판단해 주세요**: When an ended agent and a running agent share a name or a pane, `show` picks the running one. With two running agents, it answers `target_ambiguous`. With only ended ones, it picks the newest (`coordination::shown_record`, pinned by `an_agent_that_ended_is_shown_ended_by_its_id_name_or_pane`). - **판단해 주세요** (private#719): A start under way is waited for at most `hide_node_link::holders::PROOF_START_WAIT` (500 ms), not the start's own 10 s limit, because every hook proves its pane through this path. 500 ms is under half the shortest hook budget (`MEMORY_BUDGET`, 1.25 s), and far longer than the gap between the holder starting the program and writing that it runs. A pane still starting after that answers `pane_starting` with "run the same command again in a moment"; a pane whose program ended answers `pane_not_running`; neither says `pane_not_found` any more. - **with-hide#2297 is not fixed here**: its cause is the same as with-hide#2312's. A node renewal took its request number from the node's own counter, so the core's next creation reused a number and read "the pane request has already finished". In the operator's log, 3 renewals were followed by 3 refused creations, and the 4th creation passed. with-hide#2312 owns the fix and closes with-hide#2297. - **조심해서 볼 파일**: - `hide-host/src/panes.rs` - failure path and the hooks' path: every pane caller's proof runs here (bootstrap, stream open, `Call::PaneInspect`). - `hide-host/src/worktrees.rs` - failure path. Only the case where Git said removed and its list then failed now trusts the folder. The case where Git said it failed still reads remains unless both list and folder say gone. - `hide-core/src/coordination/mod.rs` - `shown_record` reads the ledger under the runtime lock: one pass over the agents, no I/O. - **비용 검토**: - Proof per call: unchanged (one record read) for a running or ended pane. Only a record still `reserved`/`preparing` adds three things: one diagnostic line (`pane.proof.start_wait`, pane id and wait only, written through the node's log sink), one condition-variable wait on the node's start table, and a second record read. - The wait's deadline is taken before the diagnostic, so logging adds nothing to it. Neither holds the core's runtime lock, and the start table's own lock is released while waiting. - Worst wait: 500 ms per call. It holds one bridge client slot (16 at most) or one node lane worker for that long. A holder that never writes `running` costs each hook call 500 ms, not 10 s. - `list --live` filters in the same single pass over the ledger. ## Evidence - **확인한 것**: - with-hide#2299, with-hide#2303: `an_agent_that_ended_is_shown_ended_by_its_id_name_or_pane` checks id, name and pane for one ended agent. It also checks a newer ended agent with the same name, a running agent beside them, and an unknown key. `every_answer_reads_a_sleeping_agent_asleep_and_running_once_it_wakes` checks that `list --live` drops ended agents. The CLI parse test and `a_missing_agent_pane_names_where_to_run_the_command` pin the switch and the new message, and `the_committed_contract_is_the_exported_one` passes on the regenerated contract. - with-hide#2299, with-hide#2303 live: the block above came from the agent journey's own isolated runtime (private HOME, state in a new temp folder, the candidate's debug `hided`/`hide`/`hide-holder`), with a stand-in agent registered in a real pane. Teardown confirmed no candidate process or folder left. - with-hide#2296: `a_removal_git_made_is_removed_when_its_readback_cannot_list_worktrees` uses a stand-in `git` whose `worktree list` fails with `fatal: unable to write new index file` once the folder is gone. Without the fix it fails with `Err(Stopped { stop: StateUnreadable, .. "The worktree remains" })`; with the fix it passes, and the folder is gone and unlisted. - private#719: `a_program_that_asks_before_its_record_says_running_is_proved_once_it_does` holds a real holder in `preparing` (`HIDE_HOLDER_TEST_HOLD_RUNNING`) and asks the host's answer to a pane's caller, `hide_host::panes::Panes::inspect`. That is the function `Call::PaneInspect` runs; it is not an end-to-end run of a hook's bootstrap. - While held, it answers `pane_starting` after at least `PROOF_START_WAIT` and well under `START_LIMIT`. - A second ask is released only after the node logged that this ask is waiting; it is then proved with the pid and start time the record names. - Each defect fails on its own: host back to `holders.proof` (`pane_not_found` instead of `pane_starting`), and the node's wait taken out (the held ask returns at once). The final head passes the same filtered test. - `cargo clippy --all-targets -D warnings` on hide-core, hided, hide-host, hide-node, hide-node-link and hide-holder is clean, and rustfmt has been applied. - **확인하지 못한 것**: - The full Rust lanes and the Linux and Windows runs are left to CI. Locally, only the named tests ran. - with-hide#2296's full disk and private#719's race were reproduced only in tests (stand-in Git, a held holder), not on a live machine. with-hide#719 on a connected device's node uses the same code but was not run on a device. - with-hide#2297 has no test here, since with-hide#2312 carries its fix. <details><summary>Verification record</summary> - base `f859661a0b79`, head `4bfb912e0499` - hide-core: `an_agent_that_ended_is_shown_ended_by_its_id_name_or_pane`, `every_answer_reads_a_sleeping_agent_asleep_and_running_once_it_wakes`; hided: agent CLI parse test, `a_missing_agent_pane_names_where_to_run_the_command`, `the_committed_contract_is_the_exported_one`: pass - hide-host: `a_removal_git_made_is_removed_when_its_readback_cannot_list_worktrees` pass; fails on the unfixed `worktrees.rs` - hide-holder `a_program_that_asks_before_its_record_says_running_is_proved_once_it_does` at the host boundary: defect (a), host back to `holders.proof`, fails with `left: Err("pane_not_found") right: Err("pane_starting")`; defect (b), node wait removed, fails with `the held start was waited for 225.292µs`; final head, clean tree: PASS - clippy `-D warnings` on hide-holder and hide-node after the test change: clean; `cargo hakari` check: no operations; `cargo fmt --all --check`: clean - clippy `--all-targets -D warnings` on the six changed crates: clean - isolated CLI run: agent journey runtime with a stand-in controller agent, teardown confirmed </details>
Summary
업데이트 뒤 잠든 에이전트를 깨울 때 탭 생성 요청이 거절되는 원인을 고치고 실패 이유를 진단에 남깁니다.
재시작 뒤 깨어난 에이전트에 잠든 표시가 남는 문제도 고칩니다.
Review
hide-core/src/engine/own/mod.rs,hide-node/src/terminal/holder.rs- 요청 발급·교체·실패 표시·정리 순서.hide-core/src/{agent_sleep.rs,runtime/agent_sleep.rs}- 엔진 식별자·상태 번호 비교와 과거 저장 기록 처리.hide-node-link/src/{holders,protocol}.rs- 필수 요청 필드와 protocol 93 호환 경계.Evidence
Verification record
8b82544392178800b23aa9b95f1fe0074189f422; product head:4b48307d08efdba6dd6d66a37cc347c9b8cd7e93; merged base:43e966b46(refactor: centralize account choices and complete profile lifetimes #2313).hide-core/src/runtime/tests/session_archive.rs: one comment and the current engine mark in its fixture. Every behavior assertion is retained. No product, script or contract changed; runtime evidence stays bound to the pinned product head above.scripts/verify-cargo.sh.222638, Pi v1.2.4222907, Grok v1.2.5223132, Pi v1.2.5223355, same-build Grok223607, same-build Pi223846; each 16/16 PASS with cleanup confirmed.224224,224548,224910; Pi v1.2.4225232; same-build Pi225520, Grok225824; each 22/22 PASS with cleanup confirmed. Codex reached awake in 0.218/0.454/0.255/0.216/0.043/0.189 seconds respectively.42625200954, attempt 1: 5,926/5,927 Rust tests passed, two flaky; archive fixture failed both built-in tries. Failed jobs alone were manually rerun exactly once. Attempt 2 again failed the same archive fixture, with 5,926/5,927 passed and one flaky. Both first-failure logs are preserved separately.a_released_sessions_unwritten_keys_keep_the_pane_on_its_holder: renewal close timed out as unsettled, then the built-in retry passed. This is not a clean first pass. No further rerun was issued on that head.42632265665: pending. The final test-only delta needs its short source review; the product source review covers correctness, fragmentation, simplicity, module boundaries, ownership/limits and tests.45ad58a81had green CI but one independent 90-second Codex wake timeout. Later successful runs did not erase or explain it. Its raw new sequence/mark was not observed. Earlier disk-cancelled runs and an unstarted run are kept separate from product failures and passing runs.