Skip to content

host.publishSession fails with "published session metadata conflicts with its catalog identity" when workspace.yaml cwd diverges from AHP catalog working_directory #5656

Backlog

Description

@haroldrandom

Environment

  • Copilot CLI version: 1.0.119
  • OS: Windows (OS build 26300)

Describe the bug

Enabling remote access (/remote on / AHP session publication) on a resumed session repeatedly fails with:

UI error:

AHP on did not complete: Error: Request host.publishSession failed with message: session publication failed

Process / AHP logs:

[WARNING] [rust:copilotd_hosting::attached] application catalog write failed {"error":"invalid params: published session metadata conflicts with its catalog identity","operation":"publication"}
[WARNING] [rust:copilot_sdk::jsonrpc] JsonRpcClient::send_request JSON-RPC request finished {"elapsed_ms":"0","method":"host.publishSession","request_id":6,"status":"failed","code":-32603,"error":"Request host.publishSession failed with message: session publication failed"}

Root cause

For the affected sessions, the working directory recorded in the local session metadata diverged from the AHP host catalog:

  • ~/.copilot/session-state/<session-id>/workspace.yaml: cwd: C:\Users\<user>\repo\<project>
  • ~/.copilot/ahp/<host-id>/sessions/<session-id>.json: "working_directory": "\\\\?\\C:\\Users\\<user>"

Whenever the session was resumed and /remote on (triggering host.publishSession) was invoked, the catalog write rejected the publication with invalid params: published session metadata conflicts with its catalog identity.

Additionally, if the AHP JSON file was edited while a copilot.exe process was still running, the host overwrote the JSON file on exit with the stale in-memory working_directory, causing the error to persist across restarts.

Steps to reproduce

  1. Have a session whose AHP catalog record (~/.copilot/ahp/<host-id>/sessions/<session-id>.json) stores working_directory as directory A (e.g. \\?\C:\Users\<user>), while ~/.copilot/session-state/<session-id>/workspace.yaml has cwd pointing to directory B (e.g. C:\Users\<user>\repo\<project>), e.g. after switching directories on a session already registered in AHP.
  2. Resume that session in Copilot CLI.
  3. Run /remote on.
  4. Observe host.publishSession failing immediately with published session metadata conflicts with its catalog identity.

Expected behavior

  • Changing a session's working directory (e.g. via /cd or /cwd) should keep the AHP catalog's working_directory in sync, or host.publishSession should cleanly reconcile/update the catalog entry instead of failing permanently with -32603.
  • Surface a clearer error message indicating which metadata field conflicted.

Verified workaround

  1. Exit all copilot.exe processes completely (so the running host does not overwrite the catalog JSON on exit).
  2. Update "working_directory" in ~/.copilot/ahp/<host-id>/sessions/<session-id>.json to match cwd in workspace.yaml (with the \\?\ prefix on Windows, e.g. \\?\C:\Users\<user>\repo\<project>).
  3. Restart Copilot CLI, resume the session, and run /remote on — publication succeeds and no further catalog identity errors occur.

Additional observation

Sessions created via the SDK/remote side (client_name: sdk) also store verbatim Windows extended-length paths (cwd: \\?\C:\Users\<user>) in workspace.yaml (rendered literally as \\?\C:\Users\<user> instead of ~ in the session picker) and have an ahp-session:/<uuid> URI different from session_id. Normalizing \\?\ prefixes during path comparison may also help prevent future identity mismatches on Windows.

Activity

  1. added
    area:platform-windows
    area:sessions
    on Dec 3, 2026
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

    area:platform-windowsarea:sessions

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions