Skip to content

Enabling hostInjectedCopilotAdapter without a client makes every memory search throw #2318

Closed

Description

@joslat

Turning on the host-injected Copilot memory adapter makes every governed memory search fail, even for plain local entries.

Repro

squad memory write --content "Use Vitest for SDK regression tests" --class LOCAL
squad memory provider --enable-copilot      # same as --enable-host-injected-copilot-adapter
squad memory search --query vitest

The last command prints a stack trace and exits with code 1:

hostInjectedCopilotAdapter is enabled, but no host-injected Copilot memory client was supplied. This is not real provider=copilot persistence.

From an agent, memory.search through squad_state fails the same way. The tool returns a JSON-RPC -32603 error instead of a result, so the agent loses the local hits too. Writes keep working; COPILOT_MEMORY writes are rejected with a reason, which is fine.

Why

LocalMemoryStore.search() calls the adapter without a try/catch once the switch is on (packages/squad-sdk/src/memory/index.ts:912-916). The adapter's requireClient() throws when nobody passed a client (:482-489), and nothing in the shipped CLI or in squad state-mcp passes one. Both build LocalMemoryStore without hostInjectedCopilotAdapterClient. So the switch can be flipped from the CLI, but there's no client behind it anywhere.

Registered providers already handle this the other way. A failing provider search is caught, recorded as a content-free provider-error audit entry, and local results still come back. The same method also returns [] and audits for the defaultProvider: 'copilot' fail-closed case, instead of throwing.

.squad/memory/ isn't git-ignored by squad init, so once someone commits a config.json with the switch on, every clone gets the broken search.

Suggested fix

Treat the adapter like the registered providers in search(). If no client is available, skip it and audit a provider-error. If its search throws, catch it, audit the safe reason (no raw error text), and return the local results.

I have a PR for this.

Activity

  1. added a commit that references this issue on Oct 25, 2026
    cd25f4a
  2. added a commit that references this issue on Oct 26, 2026
    938e56b
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