Skip to content

session.create deadlocks when a SessionFsProvider is bound #2749

Description

@Lukaze

Repo/version: github/copilot-sdk, tag rust/v1.0.14 (e60d903); CLI runtime cli-1.0.84-5.

Behaviour: With a SessionFsProvider bound on the client, session.create never returns. The CLI issues sessionFs.* requests during create; nothing on the client side answers them yet, so the RPC waits forever (RpcSessionFs carries no request timeout).

Cause: start_prepared_create (rust/src/session.rs:1167) sends the session.create RPC (call_with_inline_callback, :1394) before it spawns the event loop (spawn_event_loop, :1419) that dispatches inbound sessionFs.* requests. session.resume spawns its event loop before its RPC (:1636) and does not hang.

Fix shape: Spawn the event loop for the non-cloud create arm before the RPC, as resume does. The inline stash grows from (SessionId, SessionRegistration) to (SessionId, Option<SessionChannels>, RegistrationToken) so the early loop takes the channels while the cancel-safety guard keeps the token. The existing guard cancels shutdown on every early return and the loop exits on shutdown.cancelled(), so no extra abort plumbing is needed.

Regression test: bind a provider, drive create against a scripted CLI that issues sessionFs.stat during create, assert create completes within a bounded timeout. Must time out on current code.

Downstream: a consumer of this crate carries a local patch for this and cannot drop it until it is fixed upstream.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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