pub(crate) async fn handle_quit_self(
__arg0: State<AppState>,
caller: Option<Extension<Caller>>,
__arg2: Json<QuitSelfRequest>,
) -> impl IntoResponseExpand description
POST /api/v1/agent/pane/close — backs the ClosePane MCP tool.
See docs/specs/SPEC_AGENT_PANE_LIFECYCLE_CONTROL_2026_09_10.md.
Identity is always verified first via the same verified_block_id
mechanism UIClick/UIQuery/UIScreenshot use (§5.0 of that spec) —
this both resolves the caller’s OWN pane when req.block_id is absent,
and supplies a real, checked source_agent for the audit log when
req.block_id targets another agent’s pane (fleet tier, §5.1/§5.2): no
ownership check on the TARGET (closing another agent’s stuck pane without
needing its cooperation is this spec’s whole motivation), but the CALLER
is never anonymous the way FleetBulkStop’s existing calls are today.
POST /api/v1/agent/self/quit — the QuitSelf tool
(docs/specs/SPEC_AGENT_SELF_QUIT_2026_09_24.md §6). Always the caller’s
own block (from the signed auth); there is no target. Proceeds only
when the user started the current turn, nothing else got in, and the
quote is theirs (§6.3). The quit then waits for the turn to end (§4.2):
202 now, the tab closes after. Anything else is an external shutdown: 202
pending_user_override, and the user has 15 s to keep the agent (§6.5).