Skip to content

create_session drops the kickoff prompt for new worktree sessions (session created but never starts) #4153

Description

@tclem

Summary

create_session (the agent tool that provisions a new worktree session with a kickoff.prompt) completes worktree initialization but then silently drops the kickoff: it never spawns the session CLI or dispatches the initial prompt. The session record is persisted (so it shows in the sidebar and get_session returns it), but it sits inert with no CLI process and no turn 0 until something else instantiates it (a send_session_message, or the user opening it in the UI).

From the caller's perspective the session "was created but isn't doing anything."

Impact

Programmatic/agent-driven session creation with an auto-start prompt is unreliable for worktree sessions. A parent agent that spawns a child worktree session to run a task will see the child never start, with no error surfaced back to the tool call.

Evidence (from ~/.copilot/logs/github-app.<pid>.log)

The create_session tool call ran under an external_tool_handler span (request_id=3c1b4564-…). Its full lifecycle in the log:

17:06:16.79  external_tool_handler … initialize_worktree{workspace_id=16ee9915-…}: worktree init progress step="syncing"
17:06:18.45  worktree_sync{base_branch=dev}: git fetch completed
17:06:20.96  worktree_create: create worktree completed branch="tclem-potential-telegram"
17:06:21.00  init: worktree init progress step="ready" Workspace is ready
17:06:21.01  init: workspace initialized successfully workspace_id=16ee9915-…
17:06:21.15  keep_awake: Session became idle (parent session)

…and then nothing for that request. No creating new session, no CLI session created, no kickoff-prompt dispatch, no Session became busy.

Contrast with the parent session's kickoff flow (workspace_branch_kickoff_create_session) earlier in the same log, which is the correct/complete sequence:

branch kickoff: creating session
cli_pool: spawned new CLI process for pool
session::core: CLI session created cli_session_id=…
keep_awake: Session became busy   <-- prompt is now running

The child create_session path performs the worktree half but never reaches the "create CLI session + send kickoff prompt" half.

Confirmation of the lazy/late instantiation:

  • First CLI process for the worktree cwd was only spawned at 17:29:57 via workspace_post_complete_warm_cli (pool warm-up triggered by the UI subscribing to the workspace — not the kickoff).
  • The actual CLI session (cce2c45b-…) for the worktree wasn't created until 17:30:34, under a different handler — this coincided with a manual send_session_message into the session, which is what finally forced it to run.

So the ~23-minute gap between "session created" and "session actually runs" was entirely because the kickoff never fired; an unrelated message resurrected it.

Expected

When create_session is called with kickoff.prompt, after worktree init succeeds it should proceed to create the session CLI and dispatch the kickoff prompt (matching the workspace_branch_kickoff_create_session flow), so the session starts on its own. If any step fails, the failure should be surfaced back to the tool caller rather than leaving an inert session.

Notes / possibly related

During CLI warm-up and session creation the same log repeatedly emits:

WARN github_app::session::manager::state: failed to fetch models from session CLI for tool descriptions
     context="CLI warm-up" error=invalid type: boolean `true`, expected string or map
WARN github_app::platform::paths: failed to parse /Users/tclem/.copilot/config.json for skillDirectories:
     expected value at line 1 column 1

These look like config/model-list deserialization issues (a boolean where a string/map is expected). Unclear whether related to the dropped kickoff, but flagging in case the kickoff path bails on one of these without logging an error.

Environment

  • App: GitHub Copilot app version 0.1.0 (pkg @github/copilot 1.0.61), darwin-arm64
  • Session type: worktree (branch workspace), base branch dev
  • Repro context: parent session called create_session with kickoff.prompt + mode: autopilot; child worktree session was created but never started until a follow-up message was sent.

Repro (approximate)

  1. From an agent session, call create_session for a project, providing kickoff.prompt and a new worktree.
  2. Observe the session appears in the sidebar but never takes turn 0 (zero diff, updated_at == created_at, no CLI process).
  3. Send any message to the session (or open it in the UI) → it finally spins up a CLI and runs.

  Generated via Copilot (Claude Opus 4.8) on behalf of @tclem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions