feat(provisioning): add S2.1 pass with failure alert & retry (fixes #47, #48)
CI / ci (push) Canceled after 0s

Idempotent per-gate pass: create the museion Hermes profile only when
missing (exit-1 "already exists" = success), then additively seed the
bundled writing skills from seed-manifest.txt — temp-copy+rename, present
skills never touched, orphaned temps swept, manifest entries validated
kebab-case at the trust boundary.

Failures surface a separate phase-named alert ("couldn't set up the
writing profile" / "couldn't copy the writing skills"), never re-raising
the gate: excerpt behind Technical details (stdout per #43, stderr
fallback), Retry re-runs the whole pass, Not Now defers to the next
launch's silent retry. The card presents only after the gate sheet's
dismissal completes and snapshots its failure so a successful Retry
doesn't blank it mid-animation.

Provisioning writes nothing to the profile config (no mcp_servers entry,
#44) and leaves state.json engine-gate-only. 30/30 tests green.

Co-Authored-By: Cipher <cipher@babylondreams.de>
This commit is contained in:
AlexKuceraandCipher committed 2026-09-05 15:03:01 +02:00
1 parent 67cf3d42e4
commit c0b2cb0b93
19 files changed
+912 -9

No files matched your search

+6 -2
View File
@@ -87,7 +87,7 @@ nonisolated enum EngineProbe {
}
/// Run a process with stdin closed, capture stdout/stderr, kill after `timeout`.
private static func execute(_ arguments: [String], timeout: TimeInterval) -> ProcessOutput {
static func execute(_ arguments: [String], timeout: TimeInterval) -> ProcessOutput {
let path = arguments[0]
guard FileManager.default.isExecutableFile(atPath: path) else { return ProcessOutput(exitCode: -1) }
let process = Process()
@@ -138,7 +138,7 @@ nonisolated enum EngineProbe {
}
/// Captured output of one child process run.
private struct ProcessOutput {
struct ProcessOutput {
let exitCode: Int32
var stdout: String = ""
var stderr: String = ""
@@ -214,6 +214,9 @@ final class EngineGateModel {
var onPass: (@MainActor @Sendable () -> Void)?
private var hasStarted = false
private var running = false
/// The gate's winning binary path — handed to provisioning (#47) so the
/// profile-create spawn uses the exact binary the gate just health-checked.
private(set) var currentBinaryPath: String?
/// Runs the probe loop off the main actor, then updates phase. Guards double-run.
func runCheck(
@@ -231,6 +234,7 @@ final class EngineGateModel {
switch result {
case let .pass(engineVersion, binaryPath):
phase = .pass(engineVersion: engineVersion, binaryPath: binaryPath)
currentBinaryPath = binaryPath
onPass?()
case let .fail(firstProbePath, stderrExcerpt):
phase = .fail(firstProbePath: firstProbePath, stderrExcerpt: stderrExcerpt)