mirror of
https://github.com/morluto/rea.git
synced 2026-11-11 01:13:39 +00:00
* fix(mcp): report selection after failed target opens * fix(mcp): retain resource root selection in open failures * test(session): assert selection during cleanup failures * test(mcp): delay failed open response across target switch * test(session): distinguish no selection from pending cleanup * test(session): assert selections during cleanup and cancellation * test(mcp): join the failed-open gate before restoring its spy The snapshot-switch gate waited only on its acknowledgement, so a request that settled early hung until the runner timeout, and a later assertion failure restored the spy while that request was still in flight. Race the acknowledgement and join the launched open in finally before mockRestore. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
24 lines
662 B
TypeScript
24 lines
662 B
TypeScript
import type { Result } from "../domain/result.js";
|
|
import type { Logger } from "pino";
|
|
|
|
/** Log one MCP tool's duration and status without recording caller input. */
|
|
export const logToolExecution = async <
|
|
Outcome extends Result<unknown, unknown>,
|
|
>(
|
|
logger: Logger,
|
|
tool: string,
|
|
execute: () => Promise<Outcome>,
|
|
): Promise<Outcome> => {
|
|
const startedAt = performance.now();
|
|
const result = await execute();
|
|
logger[result.ok ? "info" : "warn"](
|
|
{
|
|
tool,
|
|
durationMs: Math.round((performance.now() - startedAt) * 100) / 100,
|
|
status: result.ok ? "ok" : "error",
|
|
},
|
|
"MCP tool execution completed",
|
|
);
|
|
return result;
|
|
};
|