fix: bound automation cleanup and bind apply visibility

This commit is contained in:
codex
2026-08-04 16:35:42 +03:00
parent e2c360e9f2
commit 1fecaad47c
+4 -3
View File
@@ -186,7 +186,7 @@ internal static class PilotCli
// It must never mint an Apply permit or start an Apply process. // It must never mint an Apply permit or start an Apply process.
if (options.Diagnostic) return Success; if (options.Diagnostic) return Success;
var permitPath = Path.Combine(options.EvidenceRoot, "apply-permit.json"); var permitPath = Path.Combine(options.EvidenceRoot, "apply-permit.json");
await File.WriteAllTextAsync(permitPath, JsonSerializer.Serialize(new ApplyPermit(true, options.FixtureMarker, preview.SelectedCandidateHash, preview.PlanIdRun1, "Visible", options.AnnotationTemplateDwg))); await File.WriteAllTextAsync(permitPath, JsonSerializer.Serialize(new ApplyPermit(true, options.FixtureMarker, preview.SelectedCandidateHash, preview.PlanIdRun1, "М25 DN15-32", options.AnnotationTemplateDwg)));
var applyConfigPath = Path.Combine(options.EvidenceRoot, "automation-apply.config.json"); var applyConfigPath = Path.Combine(options.EvidenceRoot, "automation-apply.config.json");
var applyEvidence = Path.Combine(options.EvidenceRoot, "apply-result.json"); var applyEvidence = Path.Combine(options.EvidenceRoot, "apply-result.json");
await File.WriteAllTextAsync(applyConfigPath, JsonSerializer.Serialize(new { phase = "Apply", orthoDrawingPath = options.OrthoDrawing, modelDrawingPath = options.ModelDrawing, annotationTemplateDwgPath = options.AnnotationTemplateDwg, evidencePath = applyEvidence, fixtureMarkerPath = options.FixtureMarker, entryAssemblySha256 = entryHash, automationTranscriptPath = Path.Combine(options.EvidenceRoot, "apply-transcript.log"), diagnostic = false })); await File.WriteAllTextAsync(applyConfigPath, JsonSerializer.Serialize(new { phase = "Apply", orthoDrawingPath = options.OrthoDrawing, modelDrawingPath = options.ModelDrawing, annotationTemplateDwgPath = options.AnnotationTemplateDwg, evidencePath = applyEvidence, fixtureMarkerPath = options.FixtureMarker, entryAssemblySha256 = entryHash, automationTranscriptPath = Path.Combine(options.EvidenceRoot, "apply-transcript.log"), diagnostic = false }));
@@ -229,13 +229,14 @@ internal static class PilotCli
// terminal evidence is durable. Killing an active AutoCAD // terminal evidence is durable. Killing an active AutoCAD
// command before that boundary would turn ForceAfterEvidence // command before that boundary would turn ForceAfterEvidence
// into an unsafe general process killer. // into an unsafe general process killer.
var evidenceTimeout = Task.Delay(TimeSpan.FromSeconds(Math.Clamp(config.GracefulExitTimeoutSeconds, 1, 120)));
while (!exit.IsCompleted && !HasCompletedEvidence(evidencePath)) while (!exit.IsCompleted && !HasCompletedEvidence(evidencePath))
await Task.Delay(TimeSpan.FromSeconds(1)); if (await Task.WhenAny(exit, evidenceTimeout) == evidenceTimeout) break;
if (exit.IsCompleted) gracefulExit = true; if (exit.IsCompleted) gracefulExit = true;
else else
{ {
var timeout = Task.Delay(TimeSpan.FromSeconds(Math.Clamp(config.GracefulExitTimeoutSeconds, 1, 120))); var timeout = Task.Delay(TimeSpan.FromSeconds(Math.Clamp(config.GracefulExitTimeoutSeconds, 1, 120)));
if (await Task.WhenAny(exit, timeout) == exit) gracefulExit = true; if (HasCompletedEvidence(evidencePath) && await Task.WhenAny(exit, timeout) == exit) gracefulExit = true;
else else
{ {
using var process = Process.GetProcessById(execution.ProcessId.Value); using var process = Process.GetProcessById(execution.ProcessId.Value);