Skip to content

Conversation

@JCHETAN26
Copy link

Found a high-priority concurrency issue while reviewing the worker implementation.

1. Critical Fix: Global State Isolation

  • Issue: The app instance was defined globally. In Cloudflare Workers, global scope persists between requests. This meant all concurrent users were appending routes to the same shared Hono instance, causing memory leaks and potential cross-user route pollution.
  • Fix: Moved const app = new Hono() inside the createSuperMemory factory function to ensure a fresh, isolated router for every request.

2. New Feature: Memory Deletion

  • Added deleteFromSupermemory tool to allow removing memories by ID.
  • This completes the CRUD cycle (previously only Add/Search existed).

3. Reliability Improvements

  • Added try/catch blocks around all Supermemory SDK calls to prevent unhandled worker exceptions and return meaningful 500 errors to the client.

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