mirror of
https://github.com/morluto/rea.git
synced 2026-11-04 05:46:17 +00:00
refactor(admission): own inspector, web, and CLI state per host (#8058)
* refactor(admission): own inspector, web, and CLI state per host Replace the process-global inspector, web-bundle, guidance, and JavaScript counters with objects a host passes in, so independent instances do not share admission or cleanup. * fix(admission): keep worker and file cleanup on the host Web-bundle and JavaScript workers retry only their host registry, and each Inspector admission authorizes and closes its own file scope. Browser providers can share one web-bundle admission. * test(inspector): gate one admission's file cleanup The isolation test delayed the first ArtifactResourceScope.retryCleanup call, so a second call on a shared ElectronFileScope still finished. Hold first.files.retryCleanup until the other admission's close finishes, then release and join before restoring the method. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
1 parent
b663c79552
commit
395b598383
21 files changed
+782
-269
No files matched your search
@@ -47,6 +47,8 @@ import {
|
||||
import {
|
||||
OwnedWorkerRuntime,
|
||||
OwnedWorkerRuntimeCleanupError,
|
||||
WorkerCleanupRegistry,
|
||||
processWorkerCleanup,
|
||||
} from "../../process/OwnedWorkerRuntime.js";
|
||||
import { prepareProcessOwnershipInspection } from "../../process/ProcessOwnershipObservation.js";
|
||||
import {
|
||||
@@ -168,14 +170,19 @@ export class JavaScriptAnalysisWorker {
|
||||
}
|
||||
};
|
||||
|
||||
readonly #workerCleanup: WorkerCleanupRegistry;
|
||||
|
||||
constructor(
|
||||
readonly limits: JavaScriptSourceAnalysisLimits = DEFAULTS,
|
||||
readonly launcher: typeof spawnOwnedProviderProcess = spawnOwnedProviderProcess,
|
||||
sourceCount?: number,
|
||||
workerCleanup: WorkerCleanupRegistry = processWorkerCleanup,
|
||||
) {
|
||||
this.#workerCleanup = workerCleanup;
|
||||
this.#runtime = new OwnedWorkerRuntime({
|
||||
rootPrefix: "rea-javascript-analysis-",
|
||||
launcher,
|
||||
cleanupRegistry: workerCleanup,
|
||||
supervisorOptions: {
|
||||
captureStdout: false,
|
||||
maxDiagnosticBytes: 256 * 1024,
|
||||
@@ -301,7 +308,7 @@ export class JavaScriptAnalysisWorker {
|
||||
);
|
||||
// Host ownership preparation is outside the parser execution deadline.
|
||||
await prepareProcessOwnershipInspection(signal);
|
||||
await OwnedWorkerRuntime.retryPending();
|
||||
await this.#workerCleanup.retry();
|
||||
deadline = new ProviderStartupDeadline(this.limits.timeoutMs, signal);
|
||||
this.#deadline = deadline;
|
||||
await this.#start(deadline);
|
||||
|
||||
Reference in new issue
Block a user