Repository navigation
When multiple sessionStart/subagentStart hooks output additionalContext, only the last one is injected into the context #3589
Description
Activity
- changed the title
[-]When multiple sessionStart/subagentStart hooks output `additionalContext`, only the last one is injected into the context[/-][+]When multiple `sessionStart`/`subagentStart` hooks output `additionalContext`, only the last one is injected into the context[/+]on May 30, 2026 - addedarea:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agentsPlugin system, marketplace, hooks, skills, extensions, and custom agentsarea:context-memoryContext window, memory, compaction, checkpoints, and instruction loadingContext window, memory, compaction, checkpoints, and instruction loading
on May 30, 2026 I'm replicating similar behavior. I have a single large session start hook which just grew past 10kB. Claude Desktop is documented to truncate the
additionalContextfor each hook that breaches exactly 10000 bytes (less than the above mentioned 10kB). It stores the full context in a file and shows the model a preview of the beginning, trimmed to 2kB, however it properly handles multipleadditionalContextentries from different hooks.Copilot doesn't do the truncation but does drop all except for the last
additionalContextoutright, meaning my single hook that wants to support both has to output separate shapes for Copilot vs Claude. Ugly.The root cause here has been fixed upstream in copilot-agent-runtime: multiple sessionStart/subagentStart hook �dditionalContext values are now concatenated in execution order instead of last-writer-wins (github/copilot-agent-runtime#17878, merged).
This hasn't shipped in a released Copilot CLI build yet as of this comment (latest release at merge time was 1.0.86 / 1.0.87-0 pre-release, both predating the fix). I'll follow up here once a release containing it is available, with the version number and confirmation that multiple hook contributions are delivered correctly.
@ThomasMichon thank you! Would you be able to share any details about whether the outputs will be processed in parallel and thusly, have no guaranteed order?
This appears to be resolved as of GitHub Copilot CLI v1.0.89. Please update to that release or a newer stable version. We're closing this as completed. If it still happens, please comment with your version and reproduction steps.
Describe the bug
I have multiple sessionStart/subagentStart hooks, and each of them prints
{"additionalContext":"some value"}to stdout. I observed, that only the last emitted value is actually injected into the context. I validated this by simulating this with 2 synthetic hooks that inject different things and then asking the agent about them (or telling it to spawn a sub-agent and ask it). In all cases, only one of the two values is known to the agent.To be clear, the hooks are all called (I validated this by adding an
echo <hook_name> >> /tmp/test.txtto each hook), so the problem is not that only one of them is run. All are run, but only the last output is injected.Affected version
GitHub Copilot CLI 1.0.56.
Steps to reproduce the behavior
sessionStart/subagentStarthooks that each printadditionalContextto stdoutExpected behavior
If multiple hooks return additional context, they should all be concatenated.
Additional context
No response