fix(io): retain cleanup ownership and honor cancellation

Keep failed JSON read handles in the existing server resource scope and fail admission until cleanup succeeds. Thread cancellation through every process CLI input read and replace timer-driven cancellation checks with a shared first-read gate.

Classify authenticated standalone Evidence as wrong-kind input while preserving tampered-record integrity failures and actionable messages across ledger, CLI, and MCP consumers. Record unrelated CS_RESTRICT process neighbors as unverified without weakening related-process ownership checks. Update stale ADB fixtures for the actual shell protocol.

Validated focused CLI, MCP, filesystem, ownership, and error projection tests; static, docs, and duplication gates pass. The host-level CS_RESTRICT load reproduction was not run. Refs #2050, #2035, #2064.
This commit is contained in:
morluto
2026-10-12 14:12:44 +08:00
parent e4532b5376
commit d8c76b6296
32 changed files with 1007 additions and 318 deletions
+6 -4
View File
@@ -95,7 +95,8 @@ const withRegularFileOwned = async <Value>(
cause.cleanupCause,
);
if (options.resources === undefined) throw failure;
await retryRegularFileCleanup(failure, options.resources);
const retry = await retryRegularFileCleanup(failure, options.resources);
if (retry.cleanup !== undefined) throw failure;
throw cause.cause;
}
const owner = new OwnedFileHandle(handle);
@@ -128,9 +129,10 @@ const withRegularFileOwned = async <Value>(
cleanupCause,
);
if (options.resources === undefined) throw failure;
const cleanup = await retryRegularFileCleanup(failure, options.resources);
if (cleanup.outcome.kind === "failed") throw cleanup.outcome.cause;
return cleanup.outcome.value;
const retry = await retryRegularFileCleanup(failure, options.resources);
if (retry.cleanup !== undefined) throw failure;
if (retry.outcome.kind === "failed") throw retry.outcome.cause;
return retry.outcome.value;
}
if (outcome.kind === "failed") throw outcome.cause;
return outcome.value;