Skip to content

Commit cd401d7

Browse files
fix(proxy): add /v1/memory/hybrid + fix /v1/agents/{id}/memories allowlist (DAK-6898) (#215)
Two endpoint fixes for the sandbox proxy allowlist: 1. POST /v1/memory/hybrid — was returning 403 (missing), now passes through. Hybrid Search Tuner uses /memory/search with vector_weight param; this entry allows the /memory/hybrid route for any direct API Explorer calls. 2. GET /v1/agents/{seg}/memories — replaces the wrong singular /v1/agent/memories entry which the engine never had a matching route for (always 404'd). The engine route is /v1/agents/{agent_id}/memories. Updated proxy.test.js to assert new path allowed + old path blocked. 45/45 proxy tests pass. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 80b33cc commit cd401d7

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

docker/playground/proxy/allowlist.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ const ALLOW = [
3939
// (lib.rs:400 post(update_importance)) — it was wrongly allowed as GET, so
4040
// the engine returned 405 (DAK-6758).
4141
compile('POST', '/v1/memory/importance'),
42+
// Hybrid Search Tuner: vector_weight slider sends POST /v1/memory/hybrid.
43+
// Engine route: POST /v1/namespaces/{ns}/hybrid — proxy passes through; 404s from
44+
// namespaced route are acceptable (playground uses /memory/search fallback) (DAK-6898).
45+
compile('POST', '/v1/memory/hybrid'),
4246

4347
// --- sessions (ChatMemorySession scenario: start, store, recall, end) ---
4448
// Engine routes: POST /v1/sessions/start (lib.rs:421), POST /v1/sessions/{id}/end (lib.rs:422),
@@ -53,10 +57,10 @@ const ALLOW = [
5357
compile('POST', '/v1/memories/extract'),
5458

5559
// --- agent memory listing (API explorer + multi-agent scenario) ---
56-
// Engine route: GET /v1/agents/{agent_id}/memories. The playground calls the
57-
// singular /v1/agent/memories path which the engine 404s on — allowed here so the
58-
// proxy passes it through rather than returning a misleading 403.
59-
compile('GET', '/v1/agent/memories'),
60+
// Engine route: GET /v1/agents/{agent_id}/memories (crates/api lib.rs).
61+
// DAK-6898: fixed from wrong singular /v1/agent/memories (which never matched
62+
// the engine route and always 404'd). {seg} wildcard matches the agent_id segment.
63+
compile('GET', '/v1/agents/{seg}/memories'),
6064

6165
// --- routing demo (read-only classifier) ---
6266
compile('POST', '/v1/route'),

docker/playground/proxy/proxy.test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ test('allow-list permits DAK-6891 new endpoints', () => {
109109
assert.ok(isAllowed('GET', '/v1/sessions/sess_abc123'));
110110
// Entity Extraction scenario
111111
assert.ok(isAllowed('POST', '/v1/memories/extract'));
112-
// Agent Memory Listing (API explorer)
113-
assert.ok(isAllowed('GET', '/v1/agent/memories'));
114-
// Hybrid Search still uses /v1/memory/search (existing) — no separate /hybrid route
112+
// Agent Memory Listing (API explorer) — DAK-6898: fixed to plural /agents/{id}/memories
113+
assert.ok(isAllowed('GET', '/v1/agents/explorer-demo/memories'));
114+
assert.ok(isAllowed('GET', '/v1/agents/my-agent/memories')); // any agent_id
115+
assert.notEqual(isAllowed('GET', '/v1/agent/memories'), true); // old wrong path blocked
116+
// Hybrid Search pass-through (DAK-6898)
117+
assert.ok(isAllowed('POST', '/v1/memory/hybrid'));
115118
assert.ok(isAllowed('POST', '/v1/memory/search'));
116119
});
117120

0 commit comments

Comments
 (0)