mirror of
https://github.com/morluto/rea.git
synced 2026-11-07 07:16:13 +00:00
fix(artifacts): retain read cleanup ownership through CLI and MCP shutdown
Keep failed stable-read handles and WABT runtime roots under retryable resource scopes. Preserve cancellation causes and primary errors, close the same service instances bound to MCP tools, and consolidate CLI operation/cleanup projection. Validation: fast typecheck and lint, cached runtime build, docs checks, SDK schema validation, focused service and real-file cleanup tests, CLI cleanup regressions, and MCP lifecycle/shutdown workflows. Provider process fixtures simulate engine output; real WABT and Linux EVM execution are not established by this pass.
This commit is contained in:
1 parent
c923fb0dc9
commit
b955b825fc
44 files changed
+1758
-330
No files matched your search
@@ -70,7 +70,13 @@ export class WebModuleTraceService {
|
||||
) {}
|
||||
|
||||
close(): Promise<void> {
|
||||
return this.resolver.close?.() ?? Promise.resolve();
|
||||
return closeOwnedWebResources(
|
||||
[
|
||||
this.artifacts.close?.bind(this.artifacts),
|
||||
this.resolver.close?.bind(this.resolver),
|
||||
],
|
||||
"Web module trace cleanup failed",
|
||||
);
|
||||
}
|
||||
|
||||
async trace(
|
||||
@@ -265,6 +271,21 @@ export class WebModuleTraceService {
|
||||
}
|
||||
}
|
||||
|
||||
const closeOwnedWebResources = async (
|
||||
close: readonly ((() => Promise<void>) | undefined)[],
|
||||
message: string,
|
||||
): Promise<void> => {
|
||||
const results = await Promise.allSettled(
|
||||
close.flatMap((owner) =>
|
||||
owner === undefined ? [] : [Promise.resolve().then(owner)],
|
||||
),
|
||||
);
|
||||
const failures = results.flatMap((result) =>
|
||||
result.status === "rejected" ? [result.reason] : [],
|
||||
);
|
||||
if (failures.length > 0) throw new AggregateError(failures, message);
|
||||
};
|
||||
|
||||
const admitContext = (
|
||||
value: string,
|
||||
path: readonly string[],
|
||||
|
||||
Reference in new issue
Block a user