fix(antigravity): approve the swarm's own Paperclip tools as the CLI names them, and never auto-retry a swarm that ended without a result

Live run6 (2026-11-24): the coordinator's first call was Paperclip's own
get_task_context. CLI 1.5.15 names a client MCP call mcp_<server>_<tool> with
no _meta (recorded payload now in test-fixtures), but the swarm handler only
approved _meta.mcp.server, so it refused the call; the CLI then cancelled its
whole turn on the denial (cli.log: approved=false, then CancelCascadeInvocation).
The turn ended without a result, became native_session_interrupted with the
Runner's raw continuation text, and recovery started two more billed swarms.

- Approve a permission request only for a tool the run's Paperclip bridge
  admits, by the CLI's own tool name (fails closed otherwise); the fake CLI
  replays the recorded request and hands in through paperclip_finish.
- Report a refused Paperclip tool as such; the CLI echoing Paperclip's own
  denial is not 'a helper blocked outside the task folder'.
- A swarm turn without a hand-in fails as ANTIGRAVITY_SWARM_NO_RESULT with a
  plain reason. The server settles any swarm-route failure code as
  antigravity_swarm_unavailable (terminal, no continuation recovery), and run
  selection never starts another swarm automatically after one; the person's
  Retry still does. A lost CLI process still recovers on its own.
- Record whether the CLI's sign-in matches the connection account in the run
  history every time, with the reason when it cannot tell.
- Scope usage-limit evidence by the executed provider mode, so limits from
  swarms started before scopes existed (and their retries) hold only swarms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 committed 2026-11-24 18:17:59 -06:00
1 parent 74454a17f3
commit ea2753c3d7
13 files changed
+395 -27

No files matched your search

@@ -9327,6 +9327,11 @@ function classifyNativeSessionFailure(
if (error instanceof NativeProviderSideEffectPendingError) return NATIVE_PROVIDER_SIDE_EFFECT_PENDING;
if (error instanceof NativeProviderTerminalFailure) {
if (error.providerCode === "approval_required") return "native_provider_approval_required";
// A /swarm turn the swarm route failed by its own closed code (no result,
// helpers timed out, a blocked escape): each automatic attempt is a full,
// billed swarm, so the person decides whether to retry it. Interruptions
// (a lost CLI process) keep their own code and still recover on their own.
if (/^ANTIGRAVITY_SWARM_[A-Z_]+$/.test(error.providerCode)) return ANTIGRAVITY_SWARM_UNAVAILABLE;
// Failed terminals retain their security meaning across the provider facade.
// A stopped process is insufficient evidence to recover an integrity breach.
if (