Skip to content

onSessionStart hook: additionalContext return value silently ignored #2142

@shsolomo

Description

@shsolomo

Bug

The Copilot SDK documents additionalContext as a valid return field from onSessionStart hooks (docs). However, the Copilot CLI v1.0.8 ignores the return value entirely.

Evidence

In the CLI's bundled source, the sessionStart hook invocation is fire-and-forget — no variable assignment, so the result (including additionalContext) is discarded. Compare with userPromptSubmitted which captures modifiedPrompt, and postToolUse which captures modifiedResult.

Repro

  1. Create an extension with onSessionStart returning { additionalContext: 'test' }
  2. Start a session and ask the agent if it sees 'test' in its context
  3. Agent says NO

Impact

Extensions wanting to inject boot-time context (knowledge graphs, project metadata, etc.) cannot use the documented additionalContext mechanism. Workaround: cache context in onSessionStart, inject via onUserPromptSubmitted modifiedPrompt.

Environment

  • CLI: v1.0.8
  • OS: Windows 11

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions