Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Does onPostToolUse hook additionalContext get injected into sub-agent context?

未关闭
#1,971 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
文档
描述清晰度
需要澄清
活跃度
冷清
技术栈
javascript

调研方向

使用列出的 SDK 版本,从 onPostToolUse hook、task tool 和 session.send({ mode: "immediate" }) 入口点开始。在检查会话日志中的 hook.start 和 hook.end 事件以及子代理收到的上下文的同时,复现该行为。上下文范围、消息传递行为以及推荐的回合中途引导方法都得到清晰记录,即表示完成。

由索引模型根据 Issue 内容生成。

描述

question

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

  1. Does { additionalContext } returned from onPostToolUse get injected into the active sub-agent's context, or only the parent session?
  2. Does session.send({ mode: "immediate" }) reach a running sub-agent, or does it queue on the parent session?
  3. 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 }
主要语言
Java
星标
10.5k
派生
1.5k
平均合并
1 天 9 小时
30 天内合并 PR
129

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/copilot-sdk 的其他 Issue

查看 github/copilot-sdk 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。