Skip to content

Answer a policy-refused memory sync with 400 and its reason, not 503 - #709

Merged
davidmckayv merged 3 commits into
CopilotKit:mainfrom
Chebaleomkar:fix/memory-sync-refusal
Oct 2, 2026
Merged

davidmckayv merged 3 commits into
CopilotKit:mainfrom
Chebaleomkar:fix/memory-sync-refusal

Conversation

@Chebaleomkar

Copy link
Copy Markdown
Contributor

What this changes

sync() in server/src/memory/ingestion.ts treats a PluginRefusedError as a refusal to show the person: it saves the message as the source's syncError and rethrows. The memory routes' onError only mapped MemoryNotFoundError and MemoryRefusedError, so the refusal fell through to 503 "Memory is unavailable. Try again." and was logged as memory-route-error.

It now maps to 400 with the refusal's message, as plugins/routes.ts does for the same error.

Where it runs

Server: POST /api/memory/sources/:id/sync, and POST /api/memory/sources, whose first sync takes the same path.

Boundary and audit

None. The refusal is decided and recorded as before; only the status code and body change.

Changelog

Entry under Unreleased.

Proof

New test in server/tests/memory.test.ts. It fails on main (expected 400, received 503) and passes with the fix (8/8). Server tsc and Biome format and lint are clean.

sync() saves a PluginRefusedError's message on the source and rethrows,
but the memory routes' onError only mapped the memory errors, so the
refusal reached the person as "Memory is unavailable. Try again."
@davidmckayv
davidmckayv merged commit 67ac879 into CopilotKit:main Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants