Skip to content

Closing automation-launched agent panes should not wait on the unseen-result confirmation #742

Description

@onevcat

Why

Panes that Prowl launched for another agent — a prompted Profile launch (prowl create pane … --profile … --prompt -), a re-dispatch target (#733 / #741), and soon a workflow role (docs-ai 063 launch / close: steps) — hold results that were written for the coordinating agent, not for a person. When that agent finishes, the pane shows done, and closing it now triggers the close-confirmation sheet ("active agent work or an unseen agent result", TerminalCloseProtectionReason.agentActive in TerminalCloseConfirmationPolicy). In an automated flow nobody is there to answer the sheet: prowl close --pane <id> from the coordinator returns ok: false and the pane lingers until a human clicks. The B1 review loop hit this on every round (a Pi reviewer split closed after its dispatch receipt was already read).

prowl close --force skips the policy today, but it also skips the protection that is wanted — a working agent, a human-launched pane with a result nobody read — and it asks the caller to know which case it is in.

Proposed behavior

  • Treat the result as seen when the pane's dispatch has a terminal receipt (succeeded / failed / abandoned): the coordinator already consumed it through agents wait --dispatch. Closing such a pane (prowl close without --force, the workflow close: step, the app's own close) does not prompt while the agent is idle/done.
  • Keep the confirmation for working and blocked agents, for long-running commands, and for panes whose agent was not launched or re-dispatched by Prowl (a human may still want to read the screen).
  • Alternatively for the workflow runner: default to not closing automation panes at all (the spec already says Cancel never closes panes) and make close: explicit opt-in — but the CLI recipe still needs the first point so prowl close behaves in scripts.

The alert itself is under-informative

Independently of the automation rule, the sheet a person does see says only "This will close N pane(s) in “” with active agent work or an unseen agent result." (TerminalCloseConfirmationPolicy.informativeMessage). That is not enough to decide: it should name which tab (title and tN handle) and which agent is running or holds the unseen result — runtime/Profile name plus its state (working / blocked / done), and for a dispatched pane whether a receipt exists. With several splits and background tabs, "1 pane with active agent work" cannot be mapped to anything on screen.

Non-goals

  • Changing the protection for human-launched panes or the long-running-command threshold.
  • Closing panes automatically after a dispatch completes.

Acceptance

  • After agents wait --dispatch <id> returns a terminal receipt, prowl close --pane <pane> (no --force) closes the pane without a sheet; the same pane while working still prompts.
  • A re-dispatched pane (CLI: dispatch a new task into an existing agent pane (re-dispatch) #733) whose latest record is terminal behaves the same; one with a pending record still prompts.
  • docs/components/cli.md (prowl close) and the close contract describe the rule; the policy tests cover both branches.
  • The confirmation sheet lists every protected pane with its tab (title, tN) and agent (name, state, receipt state when dispatched), so a person can tell what they are about to close.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions