@loucompanion/forge-bridge 0.1.4-dev.fb770705136a → 0.2.1-dev.17ad6c965e41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +144 -3
- package/dist/bridge/bridge-chat-provider-command.d.ts +19 -0
- package/dist/bridge/bridge-chat-provider-command.js +132 -0
- package/dist/bridge/bridge-chat.types.d.ts +10 -0
- package/dist/bridge/bridge-chat.types.js +16 -1
- package/dist/bridge/bridge-state-file.d.ts +161 -0
- package/dist/bridge/bridge-state-file.js +376 -0
- package/dist/bridge/bridge-state-io.d.ts +11 -0
- package/dist/bridge/bridge-state-io.js +50 -0
- package/dist/bridge/bridge-state-lock.d.ts +11 -0
- package/dist/bridge/bridge-state-lock.js +102 -0
- package/dist/bridge/bridge-state-unpublished.d.ts +17 -0
- package/dist/bridge/bridge-state-unpublished.js +111 -0
- package/dist/bridge/bridge.base.d.ts +9 -0
- package/dist/bridge/bridge.service.d.ts +90 -14
- package/dist/bridge/bridge.service.js +436 -350
- package/dist/bridge/bridge.types.d.ts +21 -0
- package/dist/bridge/in-flight-registry.d.ts +62 -0
- package/dist/bridge/in-flight-registry.js +207 -0
- package/dist/bridge/local-yield-flag.d.ts +6 -0
- package/dist/bridge/local-yield-flag.js +34 -0
- package/dist/bridge/readiness-result-outbox.d.ts +5 -1
- package/dist/bridge/readiness-result-outbox.js +20 -0
- package/dist/bridge/runner-host-capabilities.d.ts +5 -0
- package/dist/bridge/runner-host-capabilities.js +17 -0
- package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
- package/dist/bridge/sandbox-resource-accounting.js +150 -0
- package/dist/bridge/test-postgres-capability.d.ts +14 -0
- package/dist/bridge/test-postgres-capability.js +120 -0
- package/dist/cleanup/cleanup-wip.d.ts +12 -0
- package/dist/cleanup/cleanup-wip.js +66 -0
- package/dist/cleanup/cleanup.service.d.ts +20 -1
- package/dist/cleanup/cleanup.service.js +150 -169
- package/dist/cleanup/cleanup.types.d.ts +6 -0
- package/dist/cleanup/forge-owned-paths.d.ts +9 -0
- package/dist/cleanup/forge-owned-paths.js +53 -0
- package/dist/cleanup/host-runtime-ledger.d.ts +7 -0
- package/dist/cleanup/host-runtime-ledger.js +130 -0
- package/dist/cleanup/managed-branch-sweep.d.ts +27 -0
- package/dist/cleanup/managed-branch-sweep.js +111 -0
- package/dist/cli/cli.help.js +74 -12
- package/dist/cli/cli.service.d.ts +19 -10
- package/dist/cli/cli.service.js +152 -187
- package/dist/cli/idle-status.d.ts +84 -0
- package/dist/cli/idle-status.js +181 -0
- package/dist/cli/local-config.d.ts +6 -0
- package/dist/cli/local-config.js +32 -4
- package/dist/cli/provider-cli-detection.d.ts +10 -0
- package/dist/cli/provider-cli-detection.js +160 -0
- package/dist/runtime/aspnet-runtime-prebuild.d.ts +20 -0
- package/dist/runtime/aspnet-runtime-prebuild.js +184 -18
- package/dist/runtime/attempt-database-broker.d.ts +1 -1
- package/dist/runtime/attempt-node-runtime-launcher.js +9 -0
- package/dist/runtime/attempt-process-supervisor.d.ts +2 -0
- package/dist/runtime/attempt-process-supervisor.js +12 -6
- package/dist/runtime/docker-engine-probe.d.ts +5 -0
- package/dist/runtime/docker-engine-probe.js +7 -0
- package/dist/runtime/dotnet-build-outputs.d.ts +107 -0
- package/dist/runtime/dotnet-build-outputs.js +402 -0
- package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
- package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
- package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
- package/dist/runtime/ephemeral-test-postgres.js +303 -0
- package/dist/runtime/host-facts.d.ts +2 -1
- package/dist/runtime/host-load-admission.d.ts +67 -0
- package/dist/runtime/host-load-admission.js +99 -0
- package/dist/runtime/host-load-child-environment.d.ts +27 -0
- package/dist/runtime/host-load-child-environment.js +76 -0
- package/dist/runtime/host-load-forge-cgroups.d.ts +49 -0
- package/dist/runtime/host-load-forge-cgroups.js +140 -0
- package/dist/runtime/host-load-governor-config.d.ts +52 -0
- package/dist/runtime/host-load-governor-config.js +83 -0
- package/dist/runtime/host-load-governor.d.ts +186 -0
- package/dist/runtime/host-load-governor.js +632 -0
- package/dist/runtime/host-load-ledger-lock.d.ts +69 -0
- package/dist/runtime/host-load-ledger-lock.js +187 -0
- package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
- package/dist/runtime/host-load-runtime-settings.js +80 -0
- package/dist/runtime/host-load-sampler.d.ts +75 -2
- package/dist/runtime/host-load-sampler.js +142 -8
- package/dist/runtime/host-load-step-class.d.ts +70 -0
- package/dist/runtime/host-load-step-class.js +161 -0
- package/dist/runtime/host-load-step-reaper.d.ts +27 -0
- package/dist/runtime/host-load-step-reaper.js +95 -0
- package/dist/runtime/host-load-step-run.d.ts +73 -0
- package/dist/runtime/host-load-step-run.js +102 -0
- package/dist/runtime/host-load-test-slot.d.ts +43 -0
- package/dist/runtime/host-load-test-slot.js +81 -0
- package/dist/runtime/host-load-token-ledger.d.ts +200 -0
- package/dist/runtime/host-load-token-ledger.js +453 -0
- package/dist/runtime/host-load-windows-cpu.d.ts +34 -0
- package/dist/runtime/host-load-windows-cpu.js +85 -0
- package/dist/runtime/host-pressure-stall.d.ts +21 -1
- package/dist/runtime/host-pressure-stall.js +48 -1
- package/dist/runtime/host-runtime-contract.d.ts +15 -0
- package/dist/runtime/host-runtime-contract.js +33 -2
- package/dist/runtime/host-runtime-lease.d.ts +77 -5
- package/dist/runtime/host-runtime-lease.js +311 -165
- package/dist/runtime/host-runtime-ledger-recovery.d.ts +20 -0
- package/dist/runtime/host-runtime-ledger-recovery.js +134 -0
- package/dist/runtime/host-runtime-promotion.d.ts +23 -0
- package/dist/runtime/host-runtime-promotion.js +48 -0
- package/dist/runtime/host-runtime-requirements-check.d.ts +17 -0
- package/dist/runtime/host-runtime-requirements-check.js +29 -0
- package/dist/runtime/host-runtime-requirements.d.ts +36 -0
- package/dist/runtime/host-runtime-requirements.js +117 -0
- package/dist/runtime/managed-command-teardown.js +5 -16
- package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
- package/dist/runtime/native-test-postgres-fallback.js +60 -8
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +7 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +13 -1
- package/dist/runtime/runner-settings.d.ts +104 -0
- package/dist/runtime/runner-settings.js +236 -0
- package/dist/runtime/supervised-runtime-build-guard.d.ts +45 -0
- package/dist/runtime/supervised-runtime-build-guard.js +112 -0
- package/dist/sandbox/host-capacity-broker.d.ts +115 -0
- package/dist/sandbox/host-capacity-broker.js +336 -0
- package/dist/sandbox/managed-branch.d.ts +13 -0
- package/dist/sandbox/managed-branch.js +90 -0
- package/dist/sandbox/provider-auth/codex.js +11 -11
- package/dist/sandbox/runtime.d.ts +10 -1
- package/dist/sandbox/runtime.js +47 -8
- package/dist/sandbox/sandbox-cgroups.d.ts +14 -0
- package/dist/sandbox/sandbox-cgroups.js +42 -0
- package/dist/session/architect-waits.d.ts +2 -0
- package/dist/session/architect-waits.js +138 -0
- package/dist/session/managed-attempt-tools.d.ts +2 -7
- package/dist/session/managed-attempt-tools.js +207 -121
- package/dist/session/managed-build-coordinator.d.ts +16 -0
- package/dist/session/managed-build-coordinator.js +10 -0
- package/dist/session/managed-build-receipt.d.ts +5 -0
- package/dist/session/managed-build-receipt.js +8 -3
- package/dist/session/managed-command-host-load.d.ts +47 -0
- package/dist/session/managed-command-host-load.js +83 -0
- package/dist/session/mcp-argument-coercion.d.ts +23 -0
- package/dist/session/mcp-argument-coercion.js +121 -0
- package/dist/session/phase-completion.artifacts.d.ts +7 -0
- package/dist/session/phase-completion.artifacts.js +96 -26
- package/dist/session/phase-completion.command-validation.d.ts +7 -0
- package/dist/session/phase-completion.command-validation.js +77 -0
- package/dist/session/phase-completion.d.ts +12 -0
- package/dist/session/phase-completion.helpers.js +13 -12
- package/dist/session/phase-completion.js +5 -0
- package/dist/session/phase-completion.mcp-args.d.ts +9 -0
- package/dist/session/phase-completion.mcp-args.js +156 -0
- package/dist/session/phase-completion.prompts.js +6 -1
- package/dist/session/phase-completion.runtime.d.ts +5 -11
- package/dist/session/phase-completion.runtime.js +91 -215
- package/dist/session/phase-completion.schema-parts.d.ts +19 -0
- package/dist/session/phase-completion.schema-parts.js +188 -0
- package/dist/session/phase-completion.schemas.d.ts +3 -3
- package/dist/session/phase-completion.schemas.js +208 -231
- package/dist/session/phase-completion.validation.d.ts +2 -3
- package/dist/session/phase-completion.validation.js +49 -93
- package/dist/session/pre-publication-host-load.d.ts +27 -0
- package/dist/session/pre-publication-host-load.js +111 -0
- package/dist/session/pre-publication-native-postgres.d.ts +30 -0
- package/dist/session/pre-publication-native-postgres.js +111 -0
- package/dist/session/pre-publication-pass.d.ts +61 -0
- package/dist/session/pre-publication-pass.js +148 -0
- package/dist/session/pre-publication-process.d.ts +3 -0
- package/dist/session/pre-publication-process.js +31 -19
- package/dist/session/pre-publication-step-execution.d.ts +12 -0
- package/dist/session/pre-publication-step-execution.js +50 -0
- package/dist/session/pre-publication-validation.d.ts +37 -21
- package/dist/session/pre-publication-validation.js +221 -182
- package/dist/session/provider-cli/claude-background-work.d.ts +67 -0
- package/dist/session/provider-cli/claude-background-work.js +181 -0
- package/dist/session/provider-cli/host-build-lock.d.ts +18 -0
- package/dist/session/provider-cli/host-build-lock.js +30 -0
- package/dist/session/provider-cli/pre-publication-repair.d.ts +56 -0
- package/dist/session/provider-cli/pre-publication-repair.js +276 -0
- package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
- package/dist/session/provider-cli/provider-cli.child-environment.js +75 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.d.ts +3 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.js +37 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +15 -36
- package/dist/session/provider-cli/provider-cli.process.js +41 -432
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +5 -0
- package/dist/session/provider-cli/provider-cli.prompts.js +72 -32
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +8 -0
- package/dist/session/provider-cli/provider-cli.runtime.js +29 -1
- package/dist/session/provider-cli/provider-cli.service.d.ts +7 -1
- package/dist/session/provider-cli/provider-cli.service.js +98 -173
- package/dist/session/provider-cli/provider-cli.types.d.ts +30 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.d.ts +10 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.js +151 -0
- package/dist/session/provider-cli/provider-cli.windows-launch.d.ts +23 -0
- package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -0
- package/dist/session/provider-cli/provider-in-flight-work.d.ts +4 -0
- package/dist/session/provider-cli/provider-in-flight-work.js +45 -0
- package/dist/session/provider-cli/provider-output-pipes.d.ts +30 -0
- package/dist/session/provider-cli/provider-output-pipes.js +67 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
- package/dist/session/provider-cli/provider-output-state.js +6 -0
- package/dist/session/provider-cli/provider-user-config-isolation.d.ts +69 -0
- package/dist/session/provider-cli/provider-user-config-isolation.js +164 -0
- package/dist/session/qa-sidecar-validation.d.ts +6 -0
- package/dist/session/qa-sidecar-validation.js +28 -0
- package/dist/session/sandbox-host-capacity-gate.d.ts +51 -0
- package/dist/session/sandbox-host-capacity-gate.js +257 -0
- package/dist/session/session-redaction.js +31 -181
- package/dist/session/session.base.d.ts +9 -1
- package/dist/session/session.service.d.ts +11 -2
- package/dist/session/session.service.js +189 -69
- package/dist/session/session.types.d.ts +3 -0
- package/dist/session/session.types.js +5 -5
- package/dist/session/sidecar-json-shape.d.ts +31 -0
- package/dist/session/sidecar-json-shape.js +217 -0
- package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
- package/dist/session/workspace-runtime-fingerprint.js +138 -0
- package/dist/shared/fs/file-identity.d.ts +10 -0
- package/dist/shared/fs/file-identity.js +15 -0
- package/dist/shared/fs/replace-file.d.ts +7 -0
- package/dist/shared/fs/replace-file.js +33 -0
- package/dist/shared/process/host-process-recovery.d.ts +14 -3
- package/dist/shared/process/host-process-recovery.js +23 -3
- package/dist/shared/process/host-process-supervisor.d.ts +14 -1
- package/dist/shared/process/host-process-supervisor.js +67 -15
- package/dist/shared/process/process-tree.d.ts +52 -0
- package/dist/shared/process/process-tree.js +144 -0
- package/dist/shared/process/process.d.ts +67 -0
- package/dist/shared/process/process.js +213 -11
- package/dist/shared/process/windows-app-execution-alias.d.ts +19 -0
- package/dist/shared/process/windows-app-execution-alias.js +45 -0
- package/dist/shared/process/windows-launch.d.ts +18 -0
- package/dist/shared/process/windows-launch.js +68 -0
- package/dist/shared/provider-capabilities.js +14 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/dependency-warmer.d.ts +25 -0
- package/dist/worktree/dependency-warmer.js +46 -10
- package/dist/worktree/orphan-relink.d.ts +19 -0
- package/dist/worktree/orphan-relink.js +106 -0
- package/dist/worktree/wip-git.d.ts +33 -0
- package/dist/worktree/wip-git.js +122 -0
- package/dist/worktree/wip-refs.d.ts +62 -0
- package/dist/worktree/wip-refs.js +119 -0
- package/dist/worktree/wip-restore.d.ts +38 -0
- package/dist/worktree/wip-restore.js +190 -0
- package/dist/worktree/wip-snapshot.d.ts +50 -0
- package/dist/worktree/wip-snapshot.js +268 -0
- package/dist/worktree/worktree-inputs.d.ts +8 -0
- package/dist/worktree/worktree-inputs.js +134 -0
- package/dist/worktree/worktree-origin-sync.d.ts +34 -0
- package/dist/worktree/worktree-origin-sync.js +127 -0
- package/dist/worktree/worktree-wip-events.d.ts +18 -0
- package/dist/worktree/worktree-wip-events.js +98 -0
- package/dist/worktree/worktree-wip.d.ts +50 -0
- package/dist/worktree/worktree-wip.js +185 -0
- package/dist/worktree/worktree.base.d.ts +7 -1
- package/dist/worktree/worktree.service.d.ts +36 -5
- package/dist/worktree/worktree.service.js +124 -155
- package/dist/worktree/worktree.types.d.ts +38 -0
- package/package.json +2 -2
|
@@ -7,31 +7,33 @@ import { assertHostAttemptRootIdentity, retainHostDiagnostics } from "./host-dia
|
|
|
7
7
|
import { assertHostExecutionRoot, compactHostAttemptId } from "./host-execution-root.js";
|
|
8
8
|
import { PreparedRuntimeReadiness } from "./prepared-runtime-readiness.js";
|
|
9
9
|
import { preparedRuntimeIdentity } from "./prepared-runtime-identity.js";
|
|
10
|
+
import { ForgeFailureError } from "../session/session.types.js";
|
|
10
11
|
import { resolveExistingDirectoryPath } from "../shared/path/path.js";
|
|
11
12
|
import { formatBytes } from "../shared/format/format-bytes.js";
|
|
12
|
-
import { redactText } from "../shared/redaction/redaction.js";
|
|
13
13
|
import { StreamingProviderProcessRunner, } from "../session/provider-cli/provider-cli.process.js";
|
|
14
14
|
import { createRuntimeIsolationLease, renewRuntimeIsolationLease, transitionRuntimeIsolationLease, validRuntimeIsolationLease, withRuntimeIsolationResources, } from "./runtime-isolation-lease.js";
|
|
15
|
-
import { hostPortEnvironment, loadHostRuntimeContract, } from "./host-runtime-contract.js";
|
|
15
|
+
import { hostPortEnvironment, loadHostRuntimeContract, newAttemptApiMasterKey, withAttemptApiMasterKey, } from "./host-runtime-contract.js";
|
|
16
16
|
import { HostPortBroker, } from "./host-port-broker.js";
|
|
17
17
|
import { NodeHostRuntimeAdapter, } from "./node-host-runtime-adapter.js";
|
|
18
18
|
import { AttemptProcessSupervisorRegistry } from "./attempt-process-supervisor-registry.js";
|
|
19
|
-
import { terminateAttemptManagedCommands } from "./managed-command-teardown.js";
|
|
20
19
|
import { attemptDatabaseCapabilityEnvironment, attemptDatabaseCapabilitySecrets, } from "./attempt-database-broker.js";
|
|
21
20
|
import { AttemptNodeRuntimeLauncher } from "./attempt-node-runtime-launcher.js";
|
|
22
21
|
import { HostListenerInspector } from "./host-listener-inspector.js";
|
|
23
22
|
import { RecoveryStabilizedMemory, buildMemoryAdmissionDiagnostics, resolveAdaptiveMemoryReserveBytes, } from "./memory-capacity.js";
|
|
24
23
|
import { PlaywrightHostRuntimeAdapter } from "./playwright-host-runtime-adapter.js";
|
|
25
|
-
import { HostParallelPromotionStore, configuredLaunchPortNames, hostRuntimeContractFingerprint, hostRuntimeParallelEligible, } from "./host-runtime-promotion.js";
|
|
24
|
+
import { HostParallelPromotionStore, configuredLaunchPortNames, hostRuntimeContractFingerprint, hostRuntimeParallelEligible, readmitHostRuntimeContract, } from "./host-runtime-promotion.js";
|
|
26
25
|
import { ExactHostProcessRecovery, } from "../shared/process/host-process-recovery.js";
|
|
27
26
|
import { resetGeneratedOutputs } from "./generated-output-reset.js";
|
|
28
27
|
import { assertCanonicalDirectory, createCanonicalDirectory } from "./attempt-private-directory.js";
|
|
29
|
-
import {
|
|
30
|
-
import { readPinnedSourceDirectory } from "./pinned-source-directory.js";
|
|
28
|
+
import { logHostRuntimeStatus, recoverPersistedHostProcesses, replaceHostRuntimeLedgerFile, retryDegradedHostRelease, } from "./host-runtime-ledger-recovery.js";
|
|
31
29
|
import { architectMinimumWorkspaceEstimateBytes } from "./workspace-resource-estimator.js";
|
|
32
|
-
import { createAspNetRuntimePrebuildPlan, ensureAspNetRuntimePrebuilt, resolveWorktreeCommitSha, } from "./aspnet-runtime-prebuild.js";
|
|
30
|
+
import { createAspNetRuntimePrebuildPlan, ensureAspNetRuntimePrebuilt, executeAspNetRuntimeBuild, resolveWorktreeCommitSha, supervisedRuntimeLaunchArguments, } from "./aspnet-runtime-prebuild.js";
|
|
31
|
+
import { HostLoadGovernor } from "./host-load-governor.js";
|
|
32
|
+
import { hostLoadChildEnvironment } from "./host-load-child-environment.js";
|
|
33
|
+
import { aspNetPrebuildStepClass } from "./host-load-step-class.js";
|
|
34
|
+
import { attachSupervisedStepProcess, runHostGovernedStep } from "./host-load-step-run.js";
|
|
35
|
+
import { HostLoadSampler } from "./host-load-sampler.js";
|
|
33
36
|
const hostCapacityWaiterScanLimit = 64;
|
|
34
|
-
const maximumProcessRecoveryMetadataBytes = 1024 * 1024;
|
|
35
37
|
export class HostRuntimeLeaseManager {
|
|
36
38
|
stateRoot;
|
|
37
39
|
processSupervisors;
|
|
@@ -61,10 +63,18 @@ export class HostRuntimeLeaseManager {
|
|
|
61
63
|
workspaceAvailableBytes = Number.MAX_SAFE_INTEGER;
|
|
62
64
|
portBroker;
|
|
63
65
|
nodeAdapter;
|
|
66
|
+
/** Rebuilt by applyCapacityLimits (decision 0014); every admission reads the current one. */
|
|
64
67
|
capacityConfiguration;
|
|
65
68
|
memoryAvailability;
|
|
66
69
|
executionRoot;
|
|
67
|
-
|
|
70
|
+
/** Host-wide admission for heavy steps (decisions 0013, 0018): the host test slot, and the budget when on. */
|
|
71
|
+
hostLoadGovernor;
|
|
72
|
+
requirementsCheck = null;
|
|
73
|
+
/** Installs the decision 0013 accept-time requirements recheck for host attempts. */
|
|
74
|
+
setRequirementsCheck(check) {
|
|
75
|
+
this.requirementsCheck = check;
|
|
76
|
+
}
|
|
77
|
+
constructor(stateRoot, portBroker = new HostPortBroker(), nodeAdapter, processSupervisors = new AttemptProcessSupervisorRegistry(), processRunner = new StreamingProviderProcessRunner(), listenerInspector = new HostListenerInspector(), promotionStore = new HostParallelPromotionStore(stateRoot), playwrightAdapter = new PlaywrightHostRuntimeAdapter(), processRecovery = new ExactHostProcessRecovery(), capacityResourceSample, executionRoot, databaseBroker = null, hostLoad = null) {
|
|
68
78
|
this.stateRoot = stateRoot;
|
|
69
79
|
this.processSupervisors = processSupervisors;
|
|
70
80
|
this.processRunner = processRunner;
|
|
@@ -74,6 +84,7 @@ export class HostRuntimeLeaseManager {
|
|
|
74
84
|
this.processRecovery = processRecovery;
|
|
75
85
|
this.capacityResourceSample = capacityResourceSample;
|
|
76
86
|
this.databaseBroker = databaseBroker;
|
|
87
|
+
this.hostLoadGovernor = new HostLoadGovernor({ stateRoot, load: hostLoad ?? new HostLoadSampler() });
|
|
77
88
|
this.executionRoot = path.resolve(executionRoot ?? stateRoot);
|
|
78
89
|
if (executionRoot !== undefined)
|
|
79
90
|
assertHostExecutionRoot(this.executionRoot);
|
|
@@ -83,7 +94,40 @@ export class HostRuntimeLeaseManager {
|
|
|
83
94
|
this.capacityConfiguration = loadHostCapacityConfiguration(capacityResourceSample);
|
|
84
95
|
this.memoryAvailability = new RecoveryStabilizedMemory(this.capacityConfiguration.memoryRecoverySamples, this.capacityConfiguration.memoryRecoverySampleIntervalMs);
|
|
85
96
|
}
|
|
97
|
+
/** Today's defaults for the limits the server can push, before any env bound (decision 0014). */
|
|
98
|
+
capacityLimitDefaults() {
|
|
99
|
+
return {
|
|
100
|
+
maxConcurrentAttempts: this.capacityConfiguration.defaultHardMaxAttempts,
|
|
101
|
+
memoryReserveBytes: this.capacityConfiguration.adaptiveHostReserveBytes,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Decision 0014: the bridge's effective max attempts and memory reserve. They
|
|
106
|
+
* apply from the next attempt admission; admitted attempts keep their
|
|
107
|
+
* reservations and are never preempted, even when the new limit is lower than
|
|
108
|
+
* what already runs. The idle reserve follows the reserve as at startup.
|
|
109
|
+
*/
|
|
110
|
+
applyCapacityLimits(limits) {
|
|
111
|
+
const current = this.capacityConfiguration;
|
|
112
|
+
const hardMaxAttempts = Math.max(1, Math.min(32, Math.floor(limits.maxConcurrentAttempts)));
|
|
113
|
+
const hostReserveBytes = Math.max(512 * 1024 ** 2, Math.floor(limits.memoryReserveBytes));
|
|
114
|
+
if (hardMaxAttempts === current.hardMaxAttempts && hostReserveBytes === current.hostReserveBytes)
|
|
115
|
+
return;
|
|
116
|
+
this.capacityConfiguration = {
|
|
117
|
+
...current,
|
|
118
|
+
hardMaxAttempts,
|
|
119
|
+
hostReserveBytes,
|
|
120
|
+
idleHostReserveBytes: idleHostReserveBytesFor(hostReserveBytes, current),
|
|
121
|
+
};
|
|
122
|
+
// A raised limit may admit queued attempts now rather than at their next recheck.
|
|
123
|
+
this.drainAdmissionWaiters();
|
|
124
|
+
}
|
|
125
|
+
hostLoadChildEnvironment() {
|
|
126
|
+
return this.hostLoadGovernor.enabled ? hostLoadChildEnvironment(this.stateRoot) : {};
|
|
127
|
+
}
|
|
86
128
|
async reap(options) {
|
|
129
|
+
// Heavy-step tokens whose owner died or whose lease lapsed are returned first.
|
|
130
|
+
await this.hostLoadGovernor.reclaim().catch(() => undefined);
|
|
87
131
|
await this.refreshKnownPromotions();
|
|
88
132
|
const recoveredAttempts = [];
|
|
89
133
|
const report = {
|
|
@@ -115,19 +159,16 @@ export class HostRuntimeLeaseManager {
|
|
|
115
159
|
}
|
|
116
160
|
const active = this.active.get(lease.dispatchAttemptId);
|
|
117
161
|
if (active) {
|
|
162
|
+
// A live lease is never released here, however long past its expiry; a degraded one
|
|
163
|
+
// is retried under its own fence until teardown proves its process tree stopped.
|
|
118
164
|
if (active.lease.state !== "degraded")
|
|
119
165
|
continue;
|
|
120
166
|
report.examined += 1;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
else
|
|
126
|
-
report.degraded += 1;
|
|
127
|
-
}
|
|
128
|
-
catch {
|
|
167
|
+
const released = await retryDegradedHostRelease(active.lease, () => this.release(lease.dispatchAttemptId, lease.fencingToken), options.log ?? logHostRuntimeStatus);
|
|
168
|
+
if (released)
|
|
169
|
+
report.reaped += 1;
|
|
170
|
+
else
|
|
129
171
|
report.degraded += 1;
|
|
130
|
-
}
|
|
131
172
|
continue;
|
|
132
173
|
}
|
|
133
174
|
const staleInstance = lease.runnerInstanceId !== options.runnerInstanceId;
|
|
@@ -142,18 +183,16 @@ export class HostRuntimeLeaseManager {
|
|
|
142
183
|
if (!attemptRootIdentity) {
|
|
143
184
|
throw new Error("host_runtime_reaper_invalid: original attempt-root identity is unavailable.");
|
|
144
185
|
}
|
|
145
|
-
outcomes = await this.
|
|
186
|
+
outcomes = await recoverPersistedHostProcesses(lease, attemptRoot, this.attemptRoot(lease.dispatchAttemptId), attemptRootIdentity, this.processRecovery);
|
|
146
187
|
}
|
|
147
188
|
catch {
|
|
148
|
-
await this.markLedgerDegraded(ledger);
|
|
149
|
-
report.degraded += 1;
|
|
189
|
+
await this.markLedgerDegraded(ledger, report);
|
|
150
190
|
continue;
|
|
151
191
|
}
|
|
152
192
|
report.processesTerminated += outcomes.filter(outcome => outcome === "terminated").length;
|
|
153
193
|
report.reusedPidsProtected += outcomes.filter(outcome => outcome === "pid_reused").length;
|
|
154
194
|
if (outcomes.includes("unverifiable")) {
|
|
155
|
-
await this.markLedgerDegraded(ledger);
|
|
156
|
-
report.degraded += 1;
|
|
195
|
+
await this.markLedgerDegraded(ledger, report);
|
|
157
196
|
continue;
|
|
158
197
|
}
|
|
159
198
|
// The runtime has already been released. Keep the over-budget original
|
|
@@ -200,14 +239,18 @@ export class HostRuntimeLeaseManager {
|
|
|
200
239
|
report.reaped += 1;
|
|
201
240
|
}
|
|
202
241
|
catch {
|
|
203
|
-
await this.markLedgerDegraded(ledger);
|
|
204
|
-
report.degraded += 1;
|
|
242
|
+
await this.markLedgerDegraded(ledger, report);
|
|
205
243
|
}
|
|
206
244
|
}
|
|
207
245
|
// Databases issued to attempts that ended without a clean release (a Bridge crash, or a
|
|
208
246
|
// drop that met a lingering session) are removed once no live lease holds them.
|
|
209
247
|
// A degraded lease may still own running processes after a restart, so its database is kept.
|
|
210
248
|
await this.databaseBroker?.reapOrphans(id => this.active.has(id) || this.degraded.has(id)).catch(() => undefined);
|
|
249
|
+
// Heavy-step tokens of a dead owner with no recorded process tree (an attempt that
|
|
250
|
+
// ended with a crashed bridge or MCP server) are returned once no live lease holds
|
|
251
|
+
// their attempt; a degraded lease may still own the running step, so its tokens stay.
|
|
252
|
+
await this.hostLoadGovernor.releaseOrphaned(token => !token.dispatchAttemptId
|
|
253
|
+
|| (!this.active.has(token.dispatchAttemptId) && !this.degraded.has(token.dispatchAttemptId))).catch(() => undefined);
|
|
211
254
|
return report;
|
|
212
255
|
}
|
|
213
256
|
snapshot() {
|
|
@@ -925,6 +968,15 @@ export class HostRuntimeLeaseManager {
|
|
|
925
968
|
let attemptRootIdentity = null;
|
|
926
969
|
try {
|
|
927
970
|
const runtimeContract = await loadHostRuntimeContract(normalizedWorktreePath);
|
|
971
|
+
// Decision 0013 accept-time recheck. Readiness probes are exempt: they are how the
|
|
972
|
+
// API learns the requirements in the first place.
|
|
973
|
+
const unmetRequirements = dispatch.workItem.kind === "runtime_readiness"
|
|
974
|
+
? []
|
|
975
|
+
: this.requirementsCheck?.(runtimeContract.contract.requires) ?? [];
|
|
976
|
+
if (unmetRequirements.length > 0) {
|
|
977
|
+
// Typed, so the API receives the retryable code and re-places the work (not bridge.execution_failed).
|
|
978
|
+
throw new ForgeFailureError("placement_requirements_unmet", `placement_requirements_unmet: this host does not meet the project's requirements: ${unmetRequirements.join("; ")}.`);
|
|
979
|
+
}
|
|
928
980
|
if (runtimeContract.contract.runtime.hostConcurrency === "disabled") {
|
|
929
981
|
throw new Error("host_runtime_disabled: project runtime configuration requires Docker execution.");
|
|
930
982
|
}
|
|
@@ -1089,6 +1141,8 @@ export class HostRuntimeLeaseManager {
|
|
|
1089
1141
|
parallelPromotionEligible: hostRuntimeParallelEligible(runtimeContract) && dispatch.cycleRun.phase !== "prepared_readiness",
|
|
1090
1142
|
processSupervisor,
|
|
1091
1143
|
adapterCleanups: [],
|
|
1144
|
+
adapterCleanupsByPort: new Map(),
|
|
1145
|
+
restartingConfiguredProject: false,
|
|
1092
1146
|
pendingAdapterLaunches: new Map(),
|
|
1093
1147
|
runtimeResourcesReleased: false,
|
|
1094
1148
|
releasing: false,
|
|
@@ -1151,6 +1205,15 @@ export class HostRuntimeLeaseManager {
|
|
|
1151
1205
|
await this.writeLedger(renewed);
|
|
1152
1206
|
}
|
|
1153
1207
|
async startConfiguredProject(dispatchAttemptId, fencingToken, signal, onProjectCheckpoint) {
|
|
1208
|
+
return await this.launchConfiguredProject(dispatchAttemptId, fencingToken, signal, onProjectCheckpoint, true);
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Launches the configured project. Only the first launch, from the admitted commit's clean
|
|
1212
|
+
* source, may record parallel-safety proof: a restart serves the workspace after the provider
|
|
1213
|
+
* edited it, and a proof observed there would be stored under the admitted commit and could
|
|
1214
|
+
* move this or a later attempt at that commit into shared admission for source it never ran.
|
|
1215
|
+
*/
|
|
1216
|
+
async launchConfiguredProject(dispatchAttemptId, fencingToken, signal, onProjectCheckpoint, promote) {
|
|
1154
1217
|
const active = this.active.get(dispatchAttemptId);
|
|
1155
1218
|
if (!active || active.lease.fencingToken !== fencingToken || active.lease.state !== "active" || active.releasing) {
|
|
1156
1219
|
throw new Error("host_runtime_project_unavailable: an active matching host runtime lease is required.");
|
|
@@ -1202,8 +1265,9 @@ export class HostRuntimeLeaseManager {
|
|
|
1202
1265
|
data: { database: active.databaseCapability.databaseName },
|
|
1203
1266
|
});
|
|
1204
1267
|
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1268
|
+
const apiMasterKey = attemptApiMasterKey(active);
|
|
1269
|
+
// Runtime output is persisted to attempt logs; the database login and master key it may print are redacted.
|
|
1270
|
+
const capabilitySecrets = [...attemptDatabaseCapabilitySecrets(active.databaseCapability?.connectionString), apiMasterKey];
|
|
1207
1271
|
const launcher = new AttemptNodeRuntimeLauncher(active.processSupervisor, owner, logDirectory, this.listenerInspector, capabilitySecrets);
|
|
1208
1272
|
for (const configuredPort of configuredPorts) {
|
|
1209
1273
|
const workingDirectory = await containedWorkingDirectory(active.lease.worktreePath, configuredPort.launch.workingDirectory);
|
|
@@ -1213,7 +1277,7 @@ export class HostRuntimeLeaseManager {
|
|
|
1213
1277
|
};
|
|
1214
1278
|
const prebuild = createAspNetRuntimePrebuildPlan({
|
|
1215
1279
|
command: configuredPort.launch.command,
|
|
1216
|
-
args: configuredPort
|
|
1280
|
+
args: supervisedRuntimeLaunchArguments(configuredPort),
|
|
1217
1281
|
cwd: workingDirectory,
|
|
1218
1282
|
worktreePath: active.lease.worktreePath,
|
|
1219
1283
|
environment: buildEnvironment,
|
|
@@ -1224,9 +1288,31 @@ export class HostRuntimeLeaseManager {
|
|
|
1224
1288
|
await onProjectCheckpoint?.({
|
|
1225
1289
|
code: "host_runtime_build_started",
|
|
1226
1290
|
message: `Preparing the ASP.NET runtime for commit ${active.inputCommitSha.slice(0, 12)} before binding its assigned port.`,
|
|
1227
|
-
data: { input_commit_sha: active.inputCommitSha, project_path: prebuild.projectPath },
|
|
1291
|
+
data: { input_commit_sha: active.inputCommitSha, project_path: prebuild.projectPath, output_directory: prebuild.outputDirectory },
|
|
1228
1292
|
});
|
|
1229
|
-
|
|
1293
|
+
let hostLoadWaitMs = null;
|
|
1294
|
+
const build = await ensureAspNetRuntimePrebuilt(prebuild,
|
|
1295
|
+
// Only a real build (not a verified cache hit) takes a host load token.
|
|
1296
|
+
async (plan, buildSignal) => await runHostGovernedStep(this.hostLoadGovernor, {
|
|
1297
|
+
classification: aspNetPrebuildStepClass,
|
|
1298
|
+
label: prebuild.projectPath,
|
|
1299
|
+
dispatchAttemptId,
|
|
1300
|
+
priority: this.admissions.get(dispatchAttemptId)?.priority ?? "foreground",
|
|
1301
|
+
signal: buildSignal,
|
|
1302
|
+
onWaiting: async (decision) => await onProjectCheckpoint?.({
|
|
1303
|
+
code: "host_runtime_build_waiting_for_host_capacity",
|
|
1304
|
+
message: `The ASP.NET runtime build is waiting for host capacity: ${decision.detail}`,
|
|
1305
|
+
data: { status: "waiting_for_host_capacity", step_class: aspNetPrebuildStepClass.stepClass, reason: decision.reason },
|
|
1306
|
+
}),
|
|
1307
|
+
}, async (waitMs, control) => {
|
|
1308
|
+
hostLoadWaitMs = waitMs;
|
|
1309
|
+
// A reclaimed token stops the build: its capacity is no longer reserved. So does a
|
|
1310
|
+
// build whose process tree cannot be recorded on its token (a reclaim could not stop it).
|
|
1311
|
+
const unrecorded = new AbortController();
|
|
1312
|
+
const stepSignal = anySignal(buildSignal, control.fenced, unrecorded.signal);
|
|
1313
|
+
return await executeAspNetRuntimeBuild(active.processSupervisor, logDirectory, plan, stepSignal, capabilitySecrets, async (metadataPath) => await attachSupervisedStepProcess(control, metadataPath)
|
|
1314
|
+
.catch((error) => { unrecorded.abort(error); }));
|
|
1315
|
+
}), signal);
|
|
1230
1316
|
await onProjectCheckpoint?.({
|
|
1231
1317
|
code: build.cacheHit ? "host_runtime_build_cached" : "host_runtime_build_completed",
|
|
1232
1318
|
message: build.cacheHit
|
|
@@ -1236,19 +1322,18 @@ export class HostRuntimeLeaseManager {
|
|
|
1236
1322
|
input_commit_sha: active.inputCommitSha,
|
|
1237
1323
|
build_fingerprint: build.fingerprint,
|
|
1238
1324
|
receipt_path: build.receiptPath,
|
|
1325
|
+
...(hostLoadWaitMs === null ? {} : { host_load_wait_ms: hostLoadWaitMs }),
|
|
1239
1326
|
},
|
|
1240
1327
|
});
|
|
1241
1328
|
}
|
|
1242
1329
|
await this.launchNodeRuntime(dispatchAttemptId, fencingToken, configuredPort.name, {
|
|
1243
1330
|
command: configuredPort.launch.command,
|
|
1244
|
-
args: configuredPort
|
|
1331
|
+
args: supervisedRuntimeLaunchArguments(configuredPort),
|
|
1245
1332
|
cwd: workingDirectory,
|
|
1246
|
-
environment:
|
|
1247
|
-
...buildEnvironment,
|
|
1248
|
-
},
|
|
1333
|
+
environment: withAttemptApiMasterKey(configuredPort, buildEnvironment, apiMasterKey),
|
|
1249
1334
|
}, launcher, signal);
|
|
1250
1335
|
}
|
|
1251
|
-
const promotedLease = await this.promoteVerifiedRuntime(active, active.lease);
|
|
1336
|
+
const promotedLease = promote ? await this.promoteVerifiedRuntime(active, active.lease) : active.lease;
|
|
1252
1337
|
const runtimeEnvironment = hostRuntimeEnvironment(active.sessionId, promotedLease, active.runtimeContract, active.executionClass, active.databaseCapability);
|
|
1253
1338
|
const playwright = active.runtimeContract.contract.runtime.playwright;
|
|
1254
1339
|
if (!playwright) {
|
|
@@ -1287,6 +1372,94 @@ export class HostRuntimeLeaseManager {
|
|
|
1287
1372
|
executionClass: active.executionClass,
|
|
1288
1373
|
};
|
|
1289
1374
|
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Relaunches the configured project so it serves the current workspace. Every
|
|
1377
|
+
* configured process stops (the API port changes, so the dev server's proxy target
|
|
1378
|
+
* must change with it), its port reservation is released and dropped from the
|
|
1379
|
+
* persisted lease, and the regular start path runs again, including the ASP.NET
|
|
1380
|
+
* prebuild, whose receipt rebuilds only when the sources changed.
|
|
1381
|
+
*/
|
|
1382
|
+
async restartConfiguredProject(dispatchAttemptId, fencingToken, signal, onProjectCheckpoint) {
|
|
1383
|
+
const active = this.active.get(dispatchAttemptId);
|
|
1384
|
+
if (!active || active.lease.fencingToken !== fencingToken || active.lease.state !== "active" || active.releasing) {
|
|
1385
|
+
throw new Error("host_runtime_project_unavailable: an active matching host runtime lease is required.");
|
|
1386
|
+
}
|
|
1387
|
+
if (signal?.aborted)
|
|
1388
|
+
throw new Error(String(signal.reason ?? "Host runtime restart was cancelled."));
|
|
1389
|
+
if (active.restartingConfiguredProject) {
|
|
1390
|
+
throw new Error("host_runtime_project_conflict: a configured project restart is already in progress.");
|
|
1391
|
+
}
|
|
1392
|
+
active.restartingConfiguredProject = true;
|
|
1393
|
+
// Release cancels the whole restart through this controller and waits for it to settle.
|
|
1394
|
+
const controller = linkedAbortController(signal);
|
|
1395
|
+
const promise = this.runConfiguredProjectRestart(active, dispatchAttemptId, fencingToken, controller.signal, onProjectCheckpoint);
|
|
1396
|
+
const restart = { controller, promise };
|
|
1397
|
+
active.configuredProjectRestart = restart;
|
|
1398
|
+
try {
|
|
1399
|
+
return await promise;
|
|
1400
|
+
}
|
|
1401
|
+
finally {
|
|
1402
|
+
// The controller is not aborted on settle: adapters this restart launched keep it as their
|
|
1403
|
+
// parent signal for as long as they run, exactly as they would keep the caller's signal.
|
|
1404
|
+
if (active.configuredProjectRestart === restart)
|
|
1405
|
+
active.configuredProjectRestart = null;
|
|
1406
|
+
active.restartingConfiguredProject = false;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
async runConfiguredProjectRestart(active, dispatchAttemptId, fencingToken, signal, onProjectCheckpoint) {
|
|
1410
|
+
// The relaunch keeps the admission granted at start. A workspace contract that changed only its
|
|
1411
|
+
// launch environment is adopted; any other change throws host_runtime_contract_changed.
|
|
1412
|
+
const readmitted = readmitHostRuntimeContract(active, await loadHostRuntimeContract(active.lease.worktreePath));
|
|
1413
|
+
active.runtimeContract = readmitted.runtimeContract;
|
|
1414
|
+
active.runtimeContractFingerprint = readmitted.runtimeContractFingerprint;
|
|
1415
|
+
if (readmitted.changed) {
|
|
1416
|
+
await onProjectCheckpoint?.({ code: "host_runtime_contract_readmitted", message: "The workspace's runtime contract changed only its launch environment; the restart runs it under the admission granted at start." });
|
|
1417
|
+
}
|
|
1418
|
+
const portNames = active.executionClass === "analysis_only" ? [] : configuredLaunchPortNames(active.runtimeContract);
|
|
1419
|
+
const pendingPort = portNames.find(name => active.pendingAdapterLaunches.has(name));
|
|
1420
|
+
if (pendingPort) {
|
|
1421
|
+
throw new Error(`host_runtime_project_conflict: configured port '${pendingPort}' is still launching.`);
|
|
1422
|
+
}
|
|
1423
|
+
const temporaryDirectory = active.lease.resources.paths.find(entry => entry.role === "temporary")?.path;
|
|
1424
|
+
if (active.runtimeContract.contract.runtime.playwright && temporaryDirectory) {
|
|
1425
|
+
// The generated Playwright config targets the stack being stopped. If the restart fails, no
|
|
1426
|
+
// config may be left pointing at ports another attempt can now be assigned.
|
|
1427
|
+
await this.playwrightAdapter.discardOverlay(temporaryDirectory);
|
|
1428
|
+
}
|
|
1429
|
+
await this.stopConfiguredProject(active, portNames);
|
|
1430
|
+
// Keeps whatever admission the attempt holds; see launchConfiguredProject.
|
|
1431
|
+
const restarted = await this.launchConfiguredProject(dispatchAttemptId, fencingToken, signal, onProjectCheckpoint, false);
|
|
1432
|
+
if (active.releasing) {
|
|
1433
|
+
throw new Error("host_runtime_project_unavailable: the host runtime lease was released during restart.");
|
|
1434
|
+
}
|
|
1435
|
+
return restarted;
|
|
1436
|
+
}
|
|
1437
|
+
/** Stops configured project processes in reverse launch order and releases their ports. */
|
|
1438
|
+
async stopConfiguredProject(active, portNames) {
|
|
1439
|
+
const launched = active.lease.resources.ports
|
|
1440
|
+
.map(port => port.name)
|
|
1441
|
+
.filter(name => portNames.includes(name))
|
|
1442
|
+
.reverse();
|
|
1443
|
+
for (const name of launched) {
|
|
1444
|
+
if (active.releasing) {
|
|
1445
|
+
throw new Error("host_runtime_project_unavailable: the host runtime lease was released during restart.");
|
|
1446
|
+
}
|
|
1447
|
+
const cleanup = active.adapterCleanupsByPort.get(name);
|
|
1448
|
+
if (!cleanup) {
|
|
1449
|
+
throw new Error(`host_runtime_project_restart_unavailable: configured port '${name}' has no supervised process to stop.`);
|
|
1450
|
+
}
|
|
1451
|
+
// A failed stop keeps the cleanup and the port record for the fenced release retry.
|
|
1452
|
+
await cleanup();
|
|
1453
|
+
removeCleanup(active.adapterCleanups, cleanup);
|
|
1454
|
+
active.adapterCleanupsByPort.delete(name);
|
|
1455
|
+
const runtimeLease = withRuntimeIsolationResources(active.lease, {
|
|
1456
|
+
...active.lease.resources,
|
|
1457
|
+
ports: active.lease.resources.ports.filter(port => port.name !== name),
|
|
1458
|
+
});
|
|
1459
|
+
await this.writeLedger(runtimeLease);
|
|
1460
|
+
active.lease = runtimeLease;
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1290
1463
|
providerProcessRunner(dispatchAttemptId, fencingToken) {
|
|
1291
1464
|
const active = this.active.get(dispatchAttemptId);
|
|
1292
1465
|
if (!active || active.lease.fencingToken !== fencingToken || active.releasing)
|
|
@@ -1374,6 +1547,7 @@ export class HostRuntimeLeaseManager {
|
|
|
1374
1547
|
unlinkAbortController(controller, signal);
|
|
1375
1548
|
};
|
|
1376
1549
|
active.adapterCleanups.push(cleanup);
|
|
1550
|
+
active.adapterCleanupsByPort.set(portName, cleanup);
|
|
1377
1551
|
try {
|
|
1378
1552
|
if (active.releasing)
|
|
1379
1553
|
throw new Error("host_runtime_adapter_cancelled: host runtime release started during launch.");
|
|
@@ -1396,6 +1570,8 @@ export class HostRuntimeLeaseManager {
|
|
|
1396
1570
|
try {
|
|
1397
1571
|
await cleanup();
|
|
1398
1572
|
removeCleanup(active.adapterCleanups, cleanup);
|
|
1573
|
+
if (active.adapterCleanupsByPort.get(portName) === cleanup)
|
|
1574
|
+
active.adapterCleanupsByPort.delete(portName);
|
|
1399
1575
|
}
|
|
1400
1576
|
catch {
|
|
1401
1577
|
// Preserve the cleanup and broker claim for the fenced release retry.
|
|
@@ -1420,6 +1596,9 @@ export class HostRuntimeLeaseManager {
|
|
|
1420
1596
|
if (!preservePreparation)
|
|
1421
1597
|
this.pendingRenewals.delete(dispatchAttemptId);
|
|
1422
1598
|
if (!active) {
|
|
1599
|
+
// Queued steps are cancelled and running ones stopped; each returns its own
|
|
1600
|
+
// token once its processes are gone (never before, or capacity is reused early).
|
|
1601
|
+
this.hostLoadGovernor.stopAttempt(dispatchAttemptId);
|
|
1423
1602
|
this.cancelAdmissionWaiters(dispatchAttemptId, fencingToken, "Managed host admission was released before acquisition.");
|
|
1424
1603
|
this.releaseSingletonKeys(dispatchAttemptId, fencingToken);
|
|
1425
1604
|
this.releaseParallelProjects(dispatchAttemptId, fencingToken);
|
|
@@ -1429,18 +1608,42 @@ export class HostRuntimeLeaseManager {
|
|
|
1429
1608
|
if (active.lease.fencingToken !== fencingToken)
|
|
1430
1609
|
return null;
|
|
1431
1610
|
active.releasing = true;
|
|
1611
|
+
// Attempt teardown cancels the attempt's queued heavy steps and stops its running
|
|
1612
|
+
// ones. Each running step (an ASP.NET prebuild, an install, a validation step)
|
|
1613
|
+
// returns its own token only after its processes have exited, so the capacity is
|
|
1614
|
+
// not reused while, say, a build is still being terminated.
|
|
1615
|
+
this.hostLoadGovernor.stopAttempt(dispatchAttemptId);
|
|
1432
1616
|
for (const pending of active.pendingAdapterLaunches.values()) {
|
|
1433
1617
|
pending.controller.abort("Host runtime release cancelled the pending adapter launch.");
|
|
1434
1618
|
}
|
|
1435
1619
|
await Promise.allSettled([...active.pendingAdapterLaunches.values()].map(pending => pending.promise));
|
|
1620
|
+
const restart = active.configuredProjectRestart;
|
|
1621
|
+
if (restart) {
|
|
1622
|
+
restart.controller.abort("Host runtime release cancelled the configured project restart.");
|
|
1623
|
+
await restart.promise.catch(() => undefined);
|
|
1624
|
+
}
|
|
1436
1625
|
await active.databaseProvision?.catch(() => undefined);
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1626
|
+
// The releasing write is part of the fenced teardown: when it fails (Windows can refuse
|
|
1627
|
+
// to replace a ledger another handle is reading), the lease must end degraded so
|
|
1628
|
+
// maintenance retries it, never left nonterminal in memory where nothing retries it.
|
|
1629
|
+
let releasing = active.lease;
|
|
1440
1630
|
try {
|
|
1631
|
+
releasing = transitionRuntimeIsolationLease(active.lease, "releasing");
|
|
1632
|
+
active.lease = releasing;
|
|
1633
|
+
await this.writeLedger(releasing);
|
|
1441
1634
|
if (!active.runtimeResourcesReleased) {
|
|
1442
1635
|
await active.processSupervisor.stopAll(fencingToken, "Host runtime lease released.");
|
|
1636
|
+
// The attempt's MCP servers and process trees are stopped now; tokens they held
|
|
1637
|
+
// belong to dead owners and go back to the host budget at once, including any
|
|
1638
|
+
// without a recorded process tree (their steps were inside the stopped trees).
|
|
1639
|
+
await this.hostLoadGovernor.reclaim().catch(() => undefined);
|
|
1640
|
+
await this.hostLoadGovernor.releaseOrphaned(token => token.dispatchAttemptId === dispatchAttemptId)
|
|
1641
|
+
.catch(() => undefined);
|
|
1642
|
+
// This bridge's own steps whose trees only stopAll could prove gone (a supervised
|
|
1643
|
+
// validation step whose termination failed earlier) return their tokens now.
|
|
1644
|
+
await this.hostLoadGovernor.releaseRetainedAfterTeardown(dispatchAttemptId).catch(() => undefined);
|
|
1443
1645
|
await releaseAdapterResources(active.adapterCleanups);
|
|
1646
|
+
active.adapterCleanupsByPort.clear();
|
|
1444
1647
|
if (active.databaseCapability && this.databaseBroker) {
|
|
1445
1648
|
// A database the broker cannot drop now is reaped later; it must not hold host capacity.
|
|
1446
1649
|
await this.databaseBroker.release(dispatchAttemptId, fencingToken).catch(() => "retained");
|
|
@@ -1483,13 +1686,12 @@ export class HostRuntimeLeaseManager {
|
|
|
1483
1686
|
if (!evidenceRetainedAtAttemptRoot) {
|
|
1484
1687
|
await fs.rm(this.ledgerPath(dispatchAttemptId), { force: true });
|
|
1485
1688
|
}
|
|
1486
|
-
releasing = released;
|
|
1487
1689
|
this.active.delete(dispatchAttemptId);
|
|
1488
1690
|
this.processSupervisors.unregister(dispatchAttemptId, fencingToken);
|
|
1489
1691
|
this.releaseSingletonKeys(dispatchAttemptId, fencingToken);
|
|
1490
1692
|
this.releaseParallelProjects(dispatchAttemptId, fencingToken);
|
|
1491
1693
|
this.deleteAdmission(dispatchAttemptId, fencingToken);
|
|
1492
|
-
return
|
|
1694
|
+
return released;
|
|
1493
1695
|
}
|
|
1494
1696
|
catch (error) {
|
|
1495
1697
|
const degraded = transitionRuntimeIsolationLease(releasing, "degraded");
|
|
@@ -1524,66 +1726,12 @@ export class HostRuntimeLeaseManager {
|
|
|
1524
1726
|
}
|
|
1525
1727
|
return ledgers;
|
|
1526
1728
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
const expectedAttemptRoot = path.resolve(this.attemptRoot(lease.dispatchAttemptId));
|
|
1530
|
-
if (path.resolve(attemptRoot) !== expectedAttemptRoot) {
|
|
1531
|
-
throw new Error("host_runtime_reaper_invalid: attempt path is outside the fenced attempt root.");
|
|
1532
|
-
}
|
|
1533
|
-
await assertHostAttemptRootIdentity(attemptRoot, attemptRootIdentity);
|
|
1534
|
-
const rootEntries = await readPinnedSourceDirectory(attemptRoot, attemptRootIdentity);
|
|
1535
|
-
const logsEntry = rootEntries.find(entry => entry.name === "logs");
|
|
1536
|
-
if (!logsEntry)
|
|
1537
|
-
return [];
|
|
1538
|
-
if (logsEntry.kind !== "directory") {
|
|
1539
|
-
throw new Error("host_runtime_reaper_invalid: process ownership log path is not an ordinary directory.");
|
|
1540
|
-
}
|
|
1541
|
-
const outcomes = [];
|
|
1542
|
-
const failures = [];
|
|
1543
|
-
try {
|
|
1544
|
-
const entries = await readPinnedSourceDirectory(logsRoot, logsEntry.identity);
|
|
1545
|
-
for (const entry of entries) {
|
|
1546
|
-
if (entry.kind !== "file" || !/^process-supervisor\.[a-z][a-z0-9_-]{0,31}\.\d+\.json$/u.test(entry.name))
|
|
1547
|
-
continue;
|
|
1548
|
-
const metadataPath = path.join(logsRoot, entry.name);
|
|
1549
|
-
const value = JSON.parse((await readCanonicalSourceFile(metadataPath, maximumProcessRecoveryMetadataBytes, entry.identity)).toString("utf8"));
|
|
1550
|
-
if (!validHostProcessSupervisorMetadata(value, lease)) {
|
|
1551
|
-
throw new Error("host_runtime_reaper_invalid: process ownership metadata did not match the runtime lease.");
|
|
1552
|
-
}
|
|
1553
|
-
outcomes.push(await this.processRecovery.recover(value));
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
catch (error) {
|
|
1557
|
-
failures.push(error);
|
|
1558
|
-
}
|
|
1559
|
-
// Managed commands run in their own process groups and record their ownership apart
|
|
1560
|
-
// from the attempt's supervised children. They are recovered even when recovering a
|
|
1561
|
-
// supervised child failed, and both failures are reported together.
|
|
1562
|
-
try {
|
|
1563
|
-
const managed = await terminateAttemptManagedCommands({
|
|
1564
|
-
logDirectory: logsRoot,
|
|
1565
|
-
dispatchAttemptId: lease.dispatchAttemptId,
|
|
1566
|
-
runtimeLeaseId: lease.executionLeaseId,
|
|
1567
|
-
pinnedLogDirectory: logsEntry.identity,
|
|
1568
|
-
}, { reason: "attempt_teardown" });
|
|
1569
|
-
for (const command of managed) {
|
|
1570
|
-
if (command.outcome === "terminated" || command.outcome === "pid_reused")
|
|
1571
|
-
outcomes.push(command.outcome);
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
catch (error) {
|
|
1575
|
-
failures.push(error);
|
|
1576
|
-
}
|
|
1577
|
-
if (failures.length === 1)
|
|
1578
|
-
throw failures[0];
|
|
1579
|
-
if (failures.length > 1)
|
|
1580
|
-
throw new AggregateError(failures, "host_runtime_reaper_recovery_failed");
|
|
1581
|
-
return outcomes;
|
|
1582
|
-
}
|
|
1583
|
-
async markLedgerDegraded(ledger) {
|
|
1729
|
+
/** Degrades and counts a ledger whose runtime may still be live. A retained released ledger owns no slot, so it is neither changed nor counted. */
|
|
1730
|
+
async markLedgerDegraded(ledger, report) {
|
|
1584
1731
|
const lease = ledger.runtimeLease;
|
|
1585
1732
|
if (lease.state === "released")
|
|
1586
1733
|
return;
|
|
1734
|
+
report.degraded += 1;
|
|
1587
1735
|
const degraded = transitionHostLeaseForCleanup(lease, "degraded");
|
|
1588
1736
|
const repoId = ledger.repoId ?? repoIdFromProjectSingletonKeys(lease.resources.singletonKeys);
|
|
1589
1737
|
this.rememberDegraded(degraded, repoId);
|
|
@@ -1652,7 +1800,7 @@ export class HostRuntimeLeaseManager {
|
|
|
1652
1800
|
finally {
|
|
1653
1801
|
await handle.close();
|
|
1654
1802
|
}
|
|
1655
|
-
await
|
|
1803
|
+
await replaceHostRuntimeLedgerFile(temporary, target);
|
|
1656
1804
|
}
|
|
1657
1805
|
catch (error) {
|
|
1658
1806
|
await fs.rm(temporary, { force: true }).catch(() => undefined);
|
|
@@ -2140,44 +2288,36 @@ function hostRuntimeEnvironment(sessionId, lease, runtimeContract, executionClas
|
|
|
2140
2288
|
environment.FORGE_BASE_URL = resolvedBaseUrls[0];
|
|
2141
2289
|
return environment;
|
|
2142
2290
|
}
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
const
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
return
|
|
2170
|
-
exitCode: result.exitCode,
|
|
2171
|
-
stdoutTail: appendRuntimeBuildTail(stdoutTail, redactText(result.stdout, exactSecrets)),
|
|
2172
|
-
stderrTail: appendRuntimeBuildTail(stderrTail, redactText(result.stderr, exactSecrets)),
|
|
2173
|
-
stdoutLogPath,
|
|
2174
|
-
stderrLogPath,
|
|
2175
|
-
};
|
|
2291
|
+
/**
|
|
2292
|
+
* Every environment key `hostRuntimeEnvironment` and the Playwright overlay derive from the
|
|
2293
|
+
* configured project's assigned ports. They name a live stack, so they are withheld while the
|
|
2294
|
+
* stack is down: after its ports are released another attempt may be assigned them.
|
|
2295
|
+
*/
|
|
2296
|
+
export function hostRuntimeStackEnvironmentKeys(runtimeContract) {
|
|
2297
|
+
const keys = new Set([
|
|
2298
|
+
"FORGE_E2E_API_URL",
|
|
2299
|
+
"FORGE_E2E_WEB_URL",
|
|
2300
|
+
"FORGE_BASE_URL",
|
|
2301
|
+
"FORGE_PLAYWRIGHT_BASE_URL",
|
|
2302
|
+
// The generated Playwright config embeds the base URL.
|
|
2303
|
+
"FORGE_PLAYWRIGHT_CONFIG",
|
|
2304
|
+
]);
|
|
2305
|
+
for (const port of runtimeContract.contract.runtime.ports) {
|
|
2306
|
+
const normalizedName = port.name.toUpperCase().replaceAll(/[^A-Z0-9]/gu, "_");
|
|
2307
|
+
keys.add(port.env);
|
|
2308
|
+
if (port.baseUrlEnv)
|
|
2309
|
+
keys.add(port.baseUrlEnv);
|
|
2310
|
+
keys.add(`FORGE_${normalizedName}_PORT`);
|
|
2311
|
+
keys.add(`FORGE_${normalizedName}_URL`);
|
|
2312
|
+
}
|
|
2313
|
+
return [...keys];
|
|
2314
|
+
}
|
|
2315
|
+
/** The attempt's API master key: issued on first use, then the same for every relaunch of the attempt. */
|
|
2316
|
+
function attemptApiMasterKey(active) {
|
|
2317
|
+
return active.apiMasterKey ??= newAttemptApiMasterKey();
|
|
2176
2318
|
}
|
|
2177
|
-
function
|
|
2178
|
-
|
|
2179
|
-
return current;
|
|
2180
|
-
return `${current}${current ? "\n" : ""}${value}`.slice(-4_000);
|
|
2319
|
+
function anySignal(...signals) {
|
|
2320
|
+
return AbortSignal.any(signals.filter((signal) => signal !== undefined));
|
|
2181
2321
|
}
|
|
2182
2322
|
function effectiveHostConcurrency(lease, runtimeContract, executionClass = "managed_runtime") {
|
|
2183
2323
|
if (executionClass === "analysis_only") {
|
|
@@ -2207,7 +2347,7 @@ function runtimeExecutionClass(dispatch) {
|
|
|
2207
2347
|
? "analysis_only"
|
|
2208
2348
|
: "managed_runtime";
|
|
2209
2349
|
}
|
|
2210
|
-
function runtimeAdmissionPriority(dispatch) {
|
|
2350
|
+
export function runtimeAdmissionPriority(dispatch) {
|
|
2211
2351
|
return dispatch.execution.lane.trim().toLowerCase() === "runtime_readiness"
|
|
2212
2352
|
|| dispatch.cycleRun.phase.trim().toLowerCase() === "readiness_probe"
|
|
2213
2353
|
? "background"
|
|
@@ -2279,6 +2419,18 @@ function configuredInteger(name, fallback, minimum, maximum) {
|
|
|
2279
2419
|
const parsed = Number.parseInt(process.env[name] ?? "", 10);
|
|
2280
2420
|
return Number.isFinite(parsed) ? Math.max(minimum, Math.min(maximum, parsed)) : fallback;
|
|
2281
2421
|
}
|
|
2422
|
+
/**
|
|
2423
|
+
* Today's max attempts and adaptive memory reserve for this host, before
|
|
2424
|
+
* FORGE_HOST_MAX_CONCURRENT_ATTEMPTS and FORGE_HOST_MEMORY_RESERVE_BYTES
|
|
2425
|
+
* (decision 0014 treats those as bounds on the server's values).
|
|
2426
|
+
*/
|
|
2427
|
+
export function hostCapacityLimitDefaults(capacityResourceSample) {
|
|
2428
|
+
const configuration = loadHostCapacityConfiguration(capacityResourceSample);
|
|
2429
|
+
return {
|
|
2430
|
+
maxConcurrentAttempts: configuration.defaultHardMaxAttempts,
|
|
2431
|
+
memoryReserveBytes: configuration.adaptiveHostReserveBytes,
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2282
2434
|
function loadHostCapacityConfiguration(capacityResourceSample) {
|
|
2283
2435
|
const sampledCpuCount = capacityResourceSample
|
|
2284
2436
|
? Math.max(1, Math.floor(capacityResourceSample.totalCpuMillis / 1_000))
|
|
@@ -2286,23 +2438,41 @@ function loadHostCapacityConfiguration(capacityResourceSample) {
|
|
|
2286
2438
|
const totalMemoryBytes = capacityResourceSample?.totalMemoryBytes ?? os.totalmem();
|
|
2287
2439
|
const reserveFloorBytes = configuredInteger("FORGE_HOST_MEMORY_RESERVE_FLOOR_BYTES", 1024 ** 3, 512 * 1024 ** 2, 128 * 1024 ** 3);
|
|
2288
2440
|
const reserveCeilingBytes = configuredInteger("FORGE_HOST_MEMORY_RESERVE_CEILING_BYTES", 4 * 1024 ** 3, reserveFloorBytes, 128 * 1024 ** 3);
|
|
2289
|
-
const
|
|
2290
|
-
explicitBytes: configuredOptionalInteger("FORGE_HOST_MEMORY_RESERVE_BYTES", 512 * 1024 ** 2, 128 * 1024 ** 3),
|
|
2441
|
+
const adaptiveOptions = {
|
|
2291
2442
|
floorBytes: reserveFloorBytes,
|
|
2292
2443
|
ceilingBytes: reserveCeilingBytes,
|
|
2293
2444
|
percent: configuredNumber("FORGE_HOST_MEMORY_RESERVE_PERCENT", 12.5, 1, 50),
|
|
2445
|
+
};
|
|
2446
|
+
const hostReserveBytes = resolveAdaptiveMemoryReserveBytes(totalMemoryBytes, {
|
|
2447
|
+
...adaptiveOptions,
|
|
2448
|
+
explicitBytes: configuredOptionalInteger("FORGE_HOST_MEMORY_RESERVE_BYTES", 512 * 1024 ** 2, 128 * 1024 ** 3),
|
|
2294
2449
|
});
|
|
2295
|
-
const
|
|
2450
|
+
const defaultHardMaxAttempts = Math.max(1, Math.min(8, Math.floor(sampledCpuCount / 2)));
|
|
2451
|
+
const idleReserveOverride = Number.parseInt(process.env.FORGE_HOST_IDLE_MEMORY_RESERVE_BYTES ?? "", 10);
|
|
2452
|
+
const idleReserveOverrideBytes = Number.isFinite(idleReserveOverride) ? idleReserveOverride : null;
|
|
2296
2453
|
return {
|
|
2297
|
-
hardMaxAttempts: configuredInteger("FORGE_HOST_MAX_CONCURRENT_ATTEMPTS",
|
|
2454
|
+
hardMaxAttempts: configuredInteger("FORGE_HOST_MAX_CONCURRENT_ATTEMPTS", defaultHardMaxAttempts, 1, 32),
|
|
2298
2455
|
hostReserveBytes,
|
|
2299
|
-
idleHostReserveBytes:
|
|
2456
|
+
idleHostReserveBytes: idleHostReserveBytesFor(hostReserveBytes, { reserveFloorBytes, idleReserveOverrideBytes }),
|
|
2457
|
+
defaultHardMaxAttempts,
|
|
2458
|
+
adaptiveHostReserveBytes: resolveAdaptiveMemoryReserveBytes(totalMemoryBytes, adaptiveOptions),
|
|
2459
|
+
reserveFloorBytes,
|
|
2460
|
+
idleReserveOverrideBytes,
|
|
2300
2461
|
cpuReserveMillis: configuredInteger("FORGE_HOST_CPU_RESERVE_MILLIS", 1000, 0, 32_000),
|
|
2301
2462
|
workspaceReserveBytes: configuredInteger("FORGE_HOST_WORKSPACE_RESERVE_BYTES", 10 * 1024 ** 3, 1024 ** 3, Number.MAX_SAFE_INTEGER),
|
|
2302
2463
|
memoryRecoverySamples: configuredInteger("FORGE_HOST_MEMORY_RECOVERY_SAMPLES", 2, 1, 10),
|
|
2303
2464
|
memoryRecoverySampleIntervalMs: configuredInteger("FORGE_HOST_MEMORY_RECOVERY_SAMPLE_INTERVAL_MS", 1_000, 100, 30_000),
|
|
2304
2465
|
};
|
|
2305
2466
|
}
|
|
2467
|
+
/**
|
|
2468
|
+
* The reserve kept while no attempt holds capacity: FORGE_HOST_IDLE_MEMORY_RESERVE_BYTES
|
|
2469
|
+
* clamped to [512 MiB, reserve], else min(reserve, reserve floor). Never above the reserve.
|
|
2470
|
+
*/
|
|
2471
|
+
function idleHostReserveBytesFor(hostReserveBytes, configuration) {
|
|
2472
|
+
const fallback = Math.min(hostReserveBytes, configuration.reserveFloorBytes);
|
|
2473
|
+
const override = configuration.idleReserveOverrideBytes;
|
|
2474
|
+
return override === null ? fallback : Math.max(512 * 1024 ** 2, Math.min(hostReserveBytes, override));
|
|
2475
|
+
}
|
|
2306
2476
|
function configuredOptionalInteger(name, minimum, maximum) {
|
|
2307
2477
|
const raw = process.env[name];
|
|
2308
2478
|
if (raw === undefined || raw.trim().length === 0)
|
|
@@ -2455,30 +2625,6 @@ function deserializeHostAttemptRootIdentity(identity) {
|
|
|
2455
2625
|
? { dev: BigInt(identity.dev), ino: BigInt(identity.ino) }
|
|
2456
2626
|
: null;
|
|
2457
2627
|
}
|
|
2458
|
-
function validHostProcessSupervisorMetadata(value, lease) {
|
|
2459
|
-
if (typeof value !== "object" || value === null)
|
|
2460
|
-
return false;
|
|
2461
|
-
const metadata = value;
|
|
2462
|
-
return metadata.schemaVersion === 1
|
|
2463
|
-
&& /^host-[0-9a-f]{32}$/u.test(metadata.supervisorId)
|
|
2464
|
-
&& (metadata.strategy === "windows_job_object" || metadata.strategy === "unix_process_group")
|
|
2465
|
-
&& Number.isSafeInteger(metadata.rootPid)
|
|
2466
|
-
&& metadata.rootPid > 0
|
|
2467
|
-
&& Number.isFinite(Date.parse(metadata.rootCreatedAt))
|
|
2468
|
-
&& (metadata.rootIdentity == null
|
|
2469
|
-
|| (typeof metadata.rootIdentity === "string" && metadata.rootIdentity.length <= 256))
|
|
2470
|
-
&& /^[0-9a-f]{64}$/u.test(metadata.commandDigest)
|
|
2471
|
-
&& containedMetadataWorktreePath(lease.worktreePath, metadata.worktreePath)
|
|
2472
|
-
&& metadata.runtimeLeaseId === lease.executionLeaseId
|
|
2473
|
-
&& metadata.dispatchAttemptId === lease.dispatchAttemptId
|
|
2474
|
-
&& metadata.fencingToken === lease.fencingToken
|
|
2475
|
-
&& Number.isSafeInteger(metadata.bridgePid)
|
|
2476
|
-
&& metadata.bridgePid > 0;
|
|
2477
|
-
}
|
|
2478
|
-
function containedMetadataWorktreePath(worktreePath, metadataWorktreePath) {
|
|
2479
|
-
const relative = path.relative(path.resolve(worktreePath), path.resolve(metadataWorktreePath));
|
|
2480
|
-
return relative === "" || (!relative.startsWith("..") && !path.isAbsolute(relative));
|
|
2481
|
-
}
|
|
2482
2628
|
function transitionHostLeaseForCleanup(lease, state) {
|
|
2483
2629
|
if (lease.state === state || lease.state === "released")
|
|
2484
2630
|
return lease;
|