Skip to content

fix(cli,memory): persist OPENCODE_DB in v2 service, add magnolia service subcommand, and guard mcp 1.x cancel crash - #37

Merged
taojiang9914 merged 1 commit into
masterfrom
fix/magnolia-service-and-mcp-cancel
Dec 1, 2026
Merged

taojiang9914 merged 1 commit into
masterfrom
fix/magnolia-service-and-mcp-cancel

Conversation

@taojiang9914

Copy link
Copy Markdown
Collaborator

Summary

Makes OpenCode v2 service management and MCP recovery self-contained inside the magnolia wrapper, and prevents compchem-memory from crashing on cancelled tool calls under mcp==1.26.x.

1. magnolia wrapper resilience (opencode_cc_mem/softwares/bin/magnolia)

  • Persist OPENCODE_DB in OpenCode v2 service config (_ensure_v2_service_db): When OPENCODE_DB is not yet saved in OpenCode's service.json, magnolia sets it automatically via opencode service set env OPENCODE_DB <path> (never overwriting an existing custom value). Even a bare opencode service restart or reboot now stays on Magnolia's isolated opencode-v2.db.
  • Detect DB mismatch on launch & in magnolia doctor: Checks any running opencode serve --service process and warns loudly if it is attached to a different DB than OPENCODE_DB, pointing to magnolia service restart.
  • First-class magnolia service [status|restart|start|stop] subcommand: Restarts/manages the OpenCode v2 background daemon with Magnolia's OPENCODE_DB and ~/.config/magnolia/env already loaded — no raw binary paths or env vars needed.
  • Live MCP check in magnolia doctor [project]: Queries opencode mcp list when the v2 service is running, catching a cached failed compchem-memory MCP server and pointing directly to magnolia service restart.

2. compchem-memory cancellation crash guard (compchem_memory/server.py)

  • Works around an upstream mcp==1.26.x bug where RequestResponder.cancel() sets _completed = True and RequestResponder.respond() asserts not self._completed before checking if not self.cancelled: — causing any cancelled synchronous tool call to raise AssertionError: Request already responded to, escape the anyio TaskGroup, and kill the MCP server.
  • Safe no-op on mcp >= 2.0 (fastmcp 4.x), while preserving the AssertionError for genuine non-cancelled duplicate responses.

Verification

  • pytest tests/test_server_cancel_guard.py tests/test_llm_providers.py -q: 82 passed
  • install_and_doctor_test.sh: 21 passed, 0 failed
  • compchem_tools_daemon_test.sh: 17 passed, 0 failed
  • hpc_tunnel_test.sh: 6 passed, 0 failed

…ice subcommand, and guard mcp 1.x cancel crash
@taojiang9914
taojiang9914 merged commit d217a1e into master Dec 1, 2026
2 checks passed
@taojiang9914
taojiang9914 deleted the fix/magnolia-service-and-mcp-cancel branch December 1, 2026 21:16
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.

1 participant