(bug) A denied gateway tool approval is recorded as cancelled
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
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
- Make an agent with a gateway connection that has a tool set to ask for approval (for example a delete action). Use the
pi_coreharness. - Ask the agent to call that tool. An approval card appears.
- Deny it.
- Read the approval row for the session. Status is
cancelled,resolutionis null. The API log showsPOST /sessions/interactions/cancel-stale(200) and thenPOST /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
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Agenta-AI/agenta
-
[Bug] Jinja2 variables used only inside {% if %} / {% for %} are missing from input_keys, so invoke returns 400Forse già presa @mmabrouk l’ha presa 9 giorni fa. Apertabug frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Agenta-AI/agenta#7669 · 3 commenti · 1 reazione · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Agenta-AI/agenta#7654 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Agenta-AI/agenta#7468 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
(bug) The Stop button disappears for a moment before an approval card showsForse di nuovo libera @rishu685 l’ha presa 20 giorni fa e non c’è nessuna pull request aperta. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Agenta-AI/agenta#7446 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
Agenta-AI/agenta#7441 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Agenta-AI/agenta
Issue simili
-
bug ui-dashboard
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
caelestia-dots/caelestia#534 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area: scripts bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
tdk-landscape/tdk-cli-core#2706 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bobadilla-tech/biasmarket.com#402 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
javvadivijayprasad/sel2pw#28 ·