fix(mcp): cancel evidence imports before session mutation

Propagate request cancellation through immutable JSON bundle reading and
check it before committing session state. Preserve failed-close ownership.

Fixes #1746

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
This commit is contained in:
Ysopwnable
2026-10-11 15:59:21 +08:00
committed by GitHub
parent 953a0ce5bd
commit e5699d23b1
5 changed files with 235 additions and 12 deletions
+5 -2
View File
@@ -35,11 +35,14 @@ type TextWriteResult<Failure = EvidenceFileError | AnalysisCancelledError> =
/** Read JSON data from a regular file at the caller-supplied path. */
export const readJsonFile = async (
path: string,
signal?: AbortSignal,
): Promise<
Result<unknown, EvidenceFileError | AnalysisResourceConstraintError>
> =>
readJsonFileInput(path, (selected) =>
readJsonInputFile(selected, "read_evidence_file"),
readJsonFileInput(
path,
(selected) => readJsonInputFile(selected, "read_evidence_file", signal),
signal,
);
/** Read selected JSON members through the same regular-file error boundary. */