Repository navigation
test(admission): a cancelled real remember keeps its slot and lands its row in the Cortex store (#728, slice 4) - #943
Conversation
…ts row in the Cortex store (#728, slice 4) Slice 3 drove notifications/cancelled and client disconnect through the MCP SDK client and server with a synthetic handler writing to a plain SQLite file. This slice runs the same two paths with the production registration (tool_registry_memory.register), the real remember handler and the suite's isolated Cortex SQLite store. The only double is a gate on the store's insert_memory_exact: the handler has run its write gate and curation and blocks right before the row is written. Both tests pin that the worker keeps the remember admission slot until it ends, abandoned_work records it completed, and the memory row lands with the sent content after the client stopped listening, with nothing written before. Verified red against a mutant that releases the slot at the cancel (both tests fail: semaphore value 4 for budget 4), green on main five runs in a row. Refs #728 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYsEz45oWvFafZFRXK1
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Review 1 of 3 (ADR-1119): PR #943Five reviews of the diff
Notes, no action before merge
Verdict: approve |
…lands its row in the Cortex store (#728, slice 4)
|
The three notes from review 1 are addressed in fixup b825723:
Local run: 2 passed. ruff 0.17.3 and craftsmanship: OK. CI not yet observed on b825723. Generated by Claude Code |
|
Claude finished @cdeust's task in 1m 50s —— View job Review 2 of 3 (ADR-1119): PR #943
No Blockers. The fixup narrows the teardown race through a Not checked: CI on Verdict: approve |
Review 2 of 3 (ADR-1119): PR #943Review 1 ( What the fixup changes
Notes, no action before merge
Verdict: approve |
…lands its row in the Cortex store (#728, slice 4)
|
Review 2 notes:
Local: 2 passed; ruff 0.17.3 OK. CI not yet observed on a514fcb. Generated by Claude Code |
|
Claude finished @cdeust's task in 1m 30s —— View job Review 3 of 3 (ADR-1119): PR #943
No Blockers. The fixup changes only the module docstring of the test file and rewraps one CHANGELOG line. No test logic or assertion changed. The new wording, "before any store is opened", matches Accepted: the whole PR ( The posted review has 2 Notes, neither needing action before merge. Not checked: CI on Verdict: approve |
Review 3 of 3 (ADR-1119): PR #943Review 2 (
Accepted: the whole PR ( Notes, no action before merge
Verdict: approve |
…pletion (#728, slice 5) (#946) * docs(admission): ADR-1125, a cancelled tool call's worker runs to completion (#728, slice 5) Issue #728 asks to keep work counted "until completion or a documented cooperative cancellation boundary". Slices 1-4 (#885, #903, #902, #936, #943) implement and prove the first: the slot is released by the worker's done callback, the caller awaits through asyncio.shield, abandoned workers are reported in memory_stats.abandoned_workers. Nothing forwards the cancellation into the worker thread, so no cooperative boundary exists. ADR-1125 records those semantics, amends ADR-0329 (the slot belongs to the worker), states what a handler that wants to stop early must specify, and lists the tests that hold each point. Mirror regenerated with wiki_decision_mirror.generate_mirror. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYs8nydviS39BjwT88E * fixup! docs(admission): ADR-1125, a cancelled tool call's worker runs to completion (#728, slice 5) --------- Co-authored-by: Claude <[email protected]>
Summary
Slice 4 of #728, the first remaining slice listed after #936: the same MCP cancel and disconnect scenario, now with a real mutating tool on an isolated Cortex store.
#936 drove
notifications/cancelledand client disconnect through the MCP SDK client and server (Client(mode="legacy"), in-memory transport), but with a synthetic handler writing to a plain SQLite file.tests_py/server/test_mcp_protocol_cancellation_remember.pybuilds the server with the production registration (tool_registry_memory.register), calls the realrememberhandler, and writes to the suite's isolated Cortex SQLite store (tests_py/conftest.pyredirectsCORTEX_MEMORY_DB_PATHbefore any import). The only test double is a gate on the store instance'sinsert_memory_exact. The handler has already run its write gate and curation when it blocks, right before the row is written.Both tests (cancel, disconnect) check four things:
rememberadmission slot until it ends;abandoned_workcounts it while it runs, then records itcompleted;count_memories()["total"]unchanged);Refs #728 (not
Closes: one slice remains, see below).Type of change
Test plan
2 passedeach, about 2.2 s).sem.release()added to theCancelledErrorbranch ofadmission.run_admitted(gives the slot back at the cancel). Both tests fail withassert 4 == (4 - 1). File restored afterwards.tests_py/server,test_admission.py,test_admission_cancellation.py,test_abandoned_work_status.py,test_remember.py: 72 passed.ruff check/ruff format --check(0.17.3, the version inuv.lock) on the new file: OK.scripts/check_craftsmanship.py: OK.pytestsuite not run: the environment was installed withouttorch(its download host is blocked here), so the embedding tests would fail for reasons unrelated to this PR.Audit notes
Coding-standards compliance
_GUARD,_POLL) carry asource:note.Breaking changes
None.
Reviewer checklist
Generated by Claude Code