Skip to content

Subagent sessions don't inherit parent SessionFs state, breaking spill-then-delegate flows #1168

@loganrosen

Description

@loganrosen

Subagents launched via the task tool run as sub-sessions with their own session_id. Because every SessionFs RPC carries session_id, and the standard create_session_fs_handler factory binds a fresh SessionFsProvider per session_id, a subagent's SessionFs scope is disjoint from the parent's. The parent's spilled tool outputs are therefore unreachable from the subagent.

This breaks any flow where the parent agent escalates to task after an "Output too large… Saved to: /session-state/temp/X.txt" spill. The subagent's response in our trace:

The file path /session-state/temp/1776981956649-copilot-tool-output-nf0exj.txt does not exist in the current environment. The directory structure you referenced doesn't appear to be available.

This is independent of #1091: even if the spill template stopped referencing tools the consumer disabled, task would still be referenced as a fallback (the spill suggests "tools like grep, head/tail, view, ... or jq"), and task is structurally unable to reach a parent-session file because its sub-session has its own SessionFs scope.

Reproduction

  1. Provide a custom SessionFsProvider via create_session_fs_handler, with a factory that binds per session.session_id (the standard pattern).
  2. Register a custom tool that returns >32KB so it triggers spill.
  3. Prompt the parent agent to invoke that tool, then to delegate (e.g. "use the task tool to summarize the result").
  4. Parent agent calls the tool → spill writes to its {base}/{parent_session_id}/session-state/temp/X.txt. Parent invokes task with the spill path in the prompt. Subagent's SessionFs scope is {base}/{subagent_session_id}/; the file at the parent's path is not visible. Subagent reports the file doesn't exist.

Possible fixes (any one works)

  • Don't reference task in the spill template — it's structurally never a valid read tool for a parent-session file.
  • Share SessionFs scope across all sessions in the same task tree (or at least for paths under session_state_path).
  • Provide a per-task-tree workspace handle distinct from per-session SessionFs.

Related

Versions

Reproduced on github-copilot-sdk 0.3.0 with bundled Copilot CLI 1.0.36-0. Walked the changelogs through CLI 1.0.40-0 (latest pre-release) — no spill-related fixes shipped, so this is current behavior.

Metadata

Metadata

Assignees

No one assigned

    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