fix(demo): treat HTTP 202 Accepted as background-store success#239
Open
Fearvox wants to merge 1 commit into
Open
fix(demo): treat HTTP 202 Accepted as background-store success#239Fearvox wants to merge 1 commit into
Fearvox wants to merge 1 commit into
Conversation
SimpleMemoryManager.store() called response.json() on every successful POST. When the EverCore memory API runs background extraction it replies 202 Accepted with no JSON body, so store() fell into the failure path and printed "Storage failed", even though the write was accepted. Add a 202 branch that returns True with a 'processing in background' notice before parsing the body. Closes #93. Adds tests/test_simple_memory_manager.py, an offline regression that mocks httpx.AsyncClient to return 202 and asserts store() returns True (no live stack required). Co-authored-by: 梓宏 <41323770+haifengqiu@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(demo): treat HTTP 202 Accepted as background-store success
Closes #93.
Problem
SimpleMemoryManager.store()(the demo client inmethods/EverCore/demo/utils/simple_memory_manager.py) calledresponse.json()on every non-error POST. When the EverCore memory APIruns extraction in the background it answers
POST /api/v1/memorieswith202 Accepted and an empty body.
response.raise_for_status()passes the202 through (2xx), then
response.json()either raises or yields nostatus,so
store()drops into the failure branch and prints❌ Storage failed: ...— even though the write was accepted. This is exactlythe symptom reported in #93: "Storage failed: Request accepted, processing in
background."
Fix
Add a 202 branch right after
raise_for_status()and beforeresponse.json().On 202 the demo prints a
⏳ Accepted … (Processing in background)notice andreturns
True. No other behavior changes — non-202 success and error paths areuntouched.
Test
Adds
methods/EverCore/tests/test_simple_memory_manager.py, an offlineregression that monkeypatches
httpx.AsyncClientto return a 202 response andasserts
store()returnsTrue. No live EverCore stack, database, or networkis required.
Run it:
Verified locally on this branch:
1 passed(exit 0).1 failed(exit 1) —'_AcceptedResponse' object has no attribute 'json'and the demo prints❌ Storage failed, reproducing Storage failed: Request accepted, processing in background #93. This confirms the test exercises thefix rather than passing vacuously.
Scope
Two files, surgical:
methods/EverCore/demo/utils/simple_memory_manager.py(+10, the 202 branch only)methods/EverCore/tests/test_simple_memory_manager.py(new, offline regression)No production memory-layer code is touched; this is demo-client robustness plus
its regression test.
Credit
The 202-handling approach matches upstream PR
#211
("fix: handle 202 Accepted response in demo store method") by @haifengqiu (梓宏),
credited on the commit via
Co-authored-by.🤖 Generated with Claude Code