Skip to content

fix: answer agent and workspace commands with what happened - #2322

Merged
yansfil merged 4 commits into
mainfrom
fix/agent-cli-answers
Nov 9, 2026
Merged

yansfil merged 4 commits into
mainfrom
fix/agent-cli-answers

Conversation

@yansfil

@yansfil yansfil commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2299
Closes #2303
Closes #2296
Closes with-hide/hide-private#719
Related: #2312 (carries the fix for #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

  • 판단해 주세요: hide agent list prints every agent that ever ran (758 KB here) #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.
  • hide agent spawn is sometimes refused with pane_request_refused, and the same command then works #2297 is not fixed here: its cause is the same as fix: share pane requests when waking after an update #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. fix: share pane requests when waking after an update #2312 owns the fix and closes hide agent spawn is sometimes refused with pane_request_refused, and the same command then works #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

Verification record
  • 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

hide agent show took only an id, so a name, a pane or an id without its
agent- prefix fell through to agent_unavailable with the generic advice to
retry the same intent. It now takes a name or a pane as a letter names its
recipient, answers the live registration or else the last that ended there
as ended, and a key that names nothing says how agents are named instead of
asking for a retry. hide agent list --live leaves out ended registrations;
a plain list answers as before.

Closes #2299
Closes #2303
Once Git reported the worktree removed, a readback of git worktree list that
failed (as on a nearly full disk) was answered worktree_remove_stopped with a
worktree said to remain, though the folder was gone. The folder on disk now
decides when the list cannot be read.

Closes #2296
A pane's program runs before its holder writes that it does, so a program
that calls hide at once was refused pane_not_found. The pane caller's proof
now waits for a start under way, at most PROOF_START_WAIT (500 ms, under the
shortest hook budget), and answers a pane still starting pane_starting.

Closes with-hide/hide-private#719
The test asked the node's holders directly, so it passed with the host's
wait taken out. It now asks the host's answer to a pane's caller (the path
Call::PaneInspect takes) over a held holder: a held start is answered
pane_starting after PROOF_START_WAIT, and a start released once the node
logged that the ask waits is proved by the program its record names. The
node logs pane.proof.start_wait when a proof waits, and the test hold
gives up after 30 s.
@yansfil
yansfil added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit b6655db Nov 9, 2026
43 checks passed
@yansfil
yansfil deleted the fix/agent-cli-answers branch November 9, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant