Skip to content

fix(tools): isolate OpenAI middleware clients - #1502

Open
abhinav7x94 wants to merge 1 commit into
supermemoryai:mainfrom
abhinav7x94:fix/tools-isolate-openai-wrappers
Open

fix(tools): isolate OpenAI middleware clients#1502
abhinav7x94 wants to merge 1 commit into
supermemoryai:mainfrom
abhinav7x94:fix/tools-isolate-openai-wrappers

Conversation

@abhinav7x94

Copy link
Copy Markdown

Summary

  • return a descriptor-preserving OpenAI middleware facade instead of mutating the supplied client
  • canonicalize facades across rewraps, duplicate module copies, and HMR so tenant middleware never stacks
  • preserve original resource receivers and forward OpenAI RequestOptions
  • add offline Chat, Responses, persistence, frozen-client, prototype, and duplicate-module regressions

withSupermemory previously overwrote create methods on the shared client. Wrapping the same client for tenant A and then tenant B caused a B request to retrieve and inject both tenants' memories and, with automatic persistence, write the conversation to both tenant threads.

Validation

  • focused isolation suite — 5/5
  • full tools suite — 95 passed, 30 skipped; only two pre-existing suite-load failures (missing live API key and bad legacy import)
  • production tsdown build — passed
  • Biome and diff check — passed
  • changed files type-clean; package typecheck remains baseline-red and has one fewer error than main
  • two independent reviews — ship

Duplicate audit covered all 99 open PRs. #1244, #1286, #1465, and #1489 touch the middleware for unrelated work; none solve client mutation/isolation. #1453 touches a distant README hunk.

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