MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / ignoreClose

Function ignoreClose

packages/hosts/mcp/src/in-memory-session-store.ts:174–194  ·  view source on GitHub ↗
(
  sessionId: string | null,
  handle: string,
  close: (() => Promise<void>) | undefined,
)

Source from the content-addressed store, hash-verified

172 * nothing can see, so name the handle and the session in a warning.
173 */
174const ignoreClose = (
175 sessionId: string | null,
176 handle: string,
177 close: (() => Promise<void>) | undefined,
178): Promise<void> => {
179 if (!close) return Promise.resolve();
180 const warn = (detail: unknown): Effect.Effect<void> =>
181 Effect.sync(() => {
182 console.warn(
183 `[mcp] failed to close ${handle} for session ${sessionId ?? "<uninitialized>"}:`,
184 formatBoundaryError(detail),
185 );
186 });
187 return Effect.runPromise(
188 Effect.tryPromise({ try: close, catch: (cause) => new McpHandleCloseError({ cause }) }).pipe(
189 Effect.catch((error) => warn(error.cause)),
190 // A defect cannot escape either: this runs detached from any request.
191 Effect.catchCause((cause) => warn(Cause.squash(cause))),
192 ),
193 );
194};
195
196// The store's error bodies are INNER responses (no CORS): the serving envelope
197// re-wraps the store `Response` with CORS before it leaves the origin, so the

Callers 3

shutdownEngineFunction · 0.70
disposeFunction · 0.70
openSessionFunction · 0.70

Calls 2

warnFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected