Does onPostToolUse hook additionalContext get injected into sub-agent context?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Documentazione
- Chiarezza
- Da chiarire
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript
- Ambito
- api, developer-experience
Direzione di ricerca
Inizia dai punti di ingresso onPostToolUse hook, task tool e session.send({ mode: "immediate" }) utilizzando le versioni dell'SDK indicate. Riproduci il comportamento controllando nel journal della sessione gli eventi hook.start e hook.end e il contesto ricevuto dal sub-agent. Il lavoro è completato quando l'ambito del contesto, il comportamento di consegna dei messaggi e il metodo consigliato per dirigere l'esecuzione a metà turno sono documentati chiaramente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Context
We're building a qa agent. It has an orchestrator agent that dispatches work to custom sub-agents via the task tool. We use session-level onPostToolUse hooks to enforce guardrails (retry limits on failing tests). The hooks fire correctly during sub-agent execution — we can see hook.start/hook.end events in the session journal, and onPreToolUse denials work as expected inside sub-agents.
What we observe
We have a guardrail that tracks test failures per spec. After 3 failures, we want to tell the sub-agent "stop retrying, mark as fixme, move on." Currently our hook calls session.send({ prompt: text, mode: "immediate" }) separately. The sub-agent ignores this and keeps retrying (7+ attempts observed).
Before max attempts, we return { additionalContext: feedbackText } from the hook (per-attempt guidance like "attempt 2/3, try a different approach"). We haven't been able to confirm whether this feedback actually reaches the sub-agent.
Questions
- Does
{ additionalContext }returned fromonPostToolUseget injected into the active sub-agent's context, or only the parent session? - Does
session.send({ mode: "immediate" })reach a running sub-agent, or does it queue on the parent session? - What is the recommended way to steer a sub-agent mid-turn from a hook?
Environment
@github/copilot-sdk@1.0.6@github/copilot@1.0.70- Custom agents with
tools: null(all tools) - Hooks registered at session creation via
hooks: { onPreToolUse, onPostToolUse }
- Lingua principale
- Java
- Stelle
- 10.5k
- Fork
- 1.5k
- Merge medio
- 1g 9h
- PR unite (30g)
- 131
Guida per i contributori
Apri 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 github/copilot-sdk
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
github/copilot-sdk#2709 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
github/copilot-sdk#2673 ·
-
bug testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
github/copilot-sdk#2628 ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
github/copilot-sdk#2627 · 1 commento ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
github/copilot-sdk#2493 ·
Tutte le issue di github/copilot-sdk
Issue simili
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/flink-agents#1152 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jenkinsci/blueocean-plugin#5417 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
objectionary/eo-graphs#75 ·