Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

(bug) A denied gateway tool approval is recorded as cancelled

Aperta
#7,287 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

Start with services/runner/src/server.ts, focusing on inBandAnswerTokens and the stale-interaction sweep; then read responder.ts and the nearby staleInteractionExemptTokens tests. Reproduce with a cold request containing an in-band deny and no parked gates, and verify the answered token is exempted from cancellation. Also update the comment in services/runner/src/engines/sandbox_agent/run-turn.ts:1040; done means the approval resolves as denied rather than cancelled.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug report services

When I deny a gateway tool call in an agent (for example a write or delete action set to "ask"), the write does not run. That is correct. But the approval row in the audit history ends as cancelled with no resolution, not resolved with denied. The inbox shows "abandoned" for a decision I made.

Reproduction

  1. Make an agent with a gateway connection that has a tool set to ask for approval (for example a delete action). Use the pi_core harness.
  2. Ask the agent to call that tool. An approval card appears.
  3. Deny it.
  4. Read the approval row for the session. Status is cancelled, resolution is null. The API log shows POST /sessions/interactions/cancel-stale (200) and then POST /sessions/interactions/transition (404) for the same row.

Built-in approvals (Bash, Terminal) deny correctly and end resolved.

Seen in v0.121.7 QA. It also exists in v0.121.6: the same code runs there with an explicit ask policy. It is not a regression.

Cause

A gateway approval has no ACP permission id, so the turn is not parked (services/runner/src/engines/sandbox_agent/gateway-gate.ts:133, onNonParkablePause). The deny reply starts a cold turn. inBandAnswerTokens only reads the keepalive pool's parkedApprovals, so with nothing parked it returns undefined (services/runner/src/server.ts:508-518). The turn-start sweep then cancels every pending gate, including the one the user just answered (server.ts:976-982). At turn end settleInBandInteractions tries to resolve the row (run-turn.ts:1102) and gets a 404 because the row is already terminal.

The block itself holds: the deny comes from the in-band answer in the request, not from the row. The same sweep likely files a cold-path approve as cancelled too (not tested). It affects any non-parkable relay gate, not only pi_core.

Proposed fix

In inBandAnswerTokens, when nothing is parked, still exempt the tokens the request answers:

if (!parked || parked.size === 0) {
  const tokens = extractInBandApprovalAnswers(request).map((a) => a.token);
  return tokens.length ? tokens : undefined;
}

extractInBandApprovalAnswers is exported from responder.ts. Add a unit test next to the staleInteractionExemptTokens tests: a cold request with one in-band deny and no parked gates returns that token. Also fix the comment at services/runner/src/engines/sandbox_agent/run-turn.ts:1040, which says the in-band answer is always exempted at sweep time. That is true only for a parked gate.

Related: #6315 (a cancelled card the UI still shows as actionable).

Lingua principale
TypeScript
Stelle
4.8k
Fork
690
Merge medio
21h 29m
PR unite (30g)
434

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Agenta-AI/agenta

Tutte le issue di Agenta-AI/agenta

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.