Skip to content

[Bug][personal-assistant]: /memory/{user_id} always 502s - list_memories() requests limit=1000, server caps search at 500 #474

Open
smaramwbc/statewave-personal-assistant
#3

Description

@jy7lsna

Affected Component

statewave-personal-assistant — app/services/statewave.py

Bug Description

list_memories() asks the server for 1000 memories, but the Statewave search endpoint caps limit at 500.

  • app/services/statewave.py:26 — _SEARCH_LIMIT = 1000
  • app/services/statewave.py:130 — self._sdk.search_memories(subject_id, limit=_SEARCH_LIMIT)
  • statewave/server/api/memories.py:663 — limit: int = Query(20, ge=1, le=500)

So every call is rejected with a 422 before it searches anything. The SDK raises, _wrap() turns it into StatewaveError, and GET /memory/{user_id} (app/api/routes.py:103-114) returns 502 for every user — the "inspect compiled memory" endpoint never works against a real server.

The route tests don't catch it because they override get_statewave with a mock.

Expected Behavior

GET /memory/{user_id} returns the subject's memories.

Suggested fix

Set _SEARCH_LIMIT = 500, with a comment naming the server cap so it doesn't drift again.

Steps to Reproduce

  1. Run Statewave locally and seed a user (python -m scripts.seed).
  2. curl localhost:8000/memory/<user_id> → 502, detail contains a 422 from Statewave.
  3. Or directly: curl "localhost:8100/v1/memories/search?subject_id=x&limit=1000" → 422.

Environment

main @ e89f33b; Statewave server main.

Severity

Medium for the demo — one of its three endpoints is always broken. One-line fix.

Activity

  1. nawaaaaaAaar commented on Oct 5, 2026

    @nawaaaaaAaar
    Contributor

    The fix belongs in statewave-personal-assistant, not this core repository. I am preparing the 500-result cap there, with a regression checking the actual SDK request parameter and the local CI commands. AI-assisted work prepared through Perplexity Computer; live server/warehouse access is not required for the transport contract tests.

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions