Relaunch missing dev-watch process
This commit is contained in:
parent
d13784328f
commit
de15909e7b
5 changed files with 68 additions and 2 deletions
|
|
@ -75,6 +75,9 @@ The watcher polls source files, waits for writes to settle, builds into a new
|
|||
slot, and only replaces the running Aquarium after the new build succeeds. If a
|
||||
build fails, the previous good process keeps running and that same broken source
|
||||
fingerprint is not retried until files change again.
|
||||
It also watches the recorded script-owned process. If the visible window is
|
||||
closed or the recorded process dies, the watcher relaunches from a fresh slot on
|
||||
the next poll instead of sitting there with its hands folded like this is fine.
|
||||
|
||||
Shader edits do not restart the process. The dev reload runner passes the
|
||||
source `Aquarium.hlsl` path into the live app, and the renderer polls that file,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ $watchLogPath = Join-Path $repoRoot "artifacts\dev-reload\watch.log"
|
|||
$liveSlotRoot = Join-Path $repoRoot "artifacts\dev-reload\live-slots"
|
||||
$liveReloadPointerPath = Join-Path $repoRoot "artifacts\dev-reload\live-current.txt"
|
||||
$shaderPath = Join-Path $repoRoot "src\Aquarium.Engine\Render\Shaders\Aquarium.hlsl"
|
||||
$visibleStatePath = Join-Path $repoRoot "artifacts\dev-reload\state.clixml"
|
||||
$headlessStatePath = Join-Path $repoRoot "artifacts\dev-reload\headless-state.clixml"
|
||||
$ownedProcessStatePath = if ($Headless) { $headlessStatePath } else { $visibleStatePath }
|
||||
|
||||
New-Item -ItemType Directory -Force -Path (Split-Path $watchLogPath) | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path $liveSlotRoot | Out-Null
|
||||
|
|
@ -30,6 +33,7 @@ function Write-WatchLog([string]$message) {
|
|||
function Get-SourceFiles {
|
||||
$roots = @(
|
||||
(Join-Path $repoRoot "src"),
|
||||
(Join-Path $repoRoot "scripts"),
|
||||
(Join-Path $repoRoot "Aquarium.Engine.slnx"),
|
||||
(Join-Path $repoRoot "global.json")
|
||||
)
|
||||
|
|
@ -51,7 +55,7 @@ function Get-SourceFiles {
|
|||
$_.FullName -notmatch "\\obj\\" -and
|
||||
$_.FullName -notmatch "\\artifacts\\" -and
|
||||
(
|
||||
$_.Extension -in @(".cs", ".csproj", ".json", ".slnx") -or
|
||||
$_.Extension -in @(".cs", ".csproj", ".json", ".slnx", ".ps1") -or
|
||||
$_.FullName -like (Join-Path $repoRoot "src\Aquarium.Engine\Assets\*")
|
||||
)
|
||||
}
|
||||
|
|
@ -189,6 +193,43 @@ function Invoke-Reload {
|
|||
}
|
||||
}
|
||||
|
||||
function Test-OwnedProcessRunning {
|
||||
if ($NoInitialLaunch) {
|
||||
return $true
|
||||
}
|
||||
|
||||
if (-not (Test-Path $ownedProcessStatePath)) {
|
||||
return $false
|
||||
}
|
||||
|
||||
try {
|
||||
$state = Import-Clixml -Path $ownedProcessStatePath
|
||||
if (-not $state.pid -or -not $state.slot) {
|
||||
return $false
|
||||
}
|
||||
|
||||
$process = Get-Process -Id ([int]$state.pid) -ErrorAction SilentlyContinue
|
||||
if (-not $process) {
|
||||
return $false
|
||||
}
|
||||
|
||||
$recordedPath = [string]$state.slot
|
||||
$commandLine = $null
|
||||
try {
|
||||
$commandLine = (Get-CimInstance Win32_Process -Filter "ProcessId = $($process.Id)").CommandLine
|
||||
}
|
||||
catch {
|
||||
$commandLine = $null
|
||||
}
|
||||
|
||||
return [bool]($commandLine -and $commandLine -like "*$recordedPath*")
|
||||
}
|
||||
catch {
|
||||
Write-WatchLog "Could not inspect script-owned process state; will relaunch. $($_.Exception.Message)"
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-LiveReload {
|
||||
param([string]$reason)
|
||||
|
||||
|
|
@ -232,6 +273,23 @@ do {
|
|||
Start-Sleep -Milliseconds $IntervalMilliseconds
|
||||
$currentFingerprint = Wait-StableFingerprints
|
||||
|
||||
if (-not (Test-OwnedProcessRunning)) {
|
||||
try {
|
||||
Invoke-Reload "script-owned process is not running"
|
||||
$lastGoodFingerprint = Wait-StableFingerprints
|
||||
$lastFailedFingerprint = $null
|
||||
$currentFingerprint = $lastGoodFingerprint
|
||||
}
|
||||
catch {
|
||||
$lastFailedFingerprint = $currentFingerprint.all
|
||||
Write-WatchLog "Relaunch failed; watcher remains alive. $($_.Exception.Message)"
|
||||
}
|
||||
|
||||
if ($Once) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if ($currentFingerprint.all -eq $lastGoodFingerprint.all -or $currentFingerprint.all -eq $lastFailedFingerprint) {
|
||||
if ($Once) {
|
||||
break
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@
|
|||
{"area":"renderer/taa","lesson":"TAA Gate 3D fixes travel validation under camera motion. Previous history travel must be compared to the reprojected previous-world position's distance from the previous camera, not to current-frame travel; otherwise stable history is falsely rejected whenever camera motion changes ray distance.","files":["docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
|
||||
{"area":"renderer/taa","lesson":"TAA Gate 3E fixes stochastic Grid accumulation. Opaque-surface neighborhood clamping and current-frame color-delta rejection collapse Grid history on dither-miss frames because the current sample looks like background; Grid history now bypasses those color checks and validates through field, travel, normal, coverage, reactive, and age terms.","files":["docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
|
||||
{"area":"renderer/debug","lesson":"Temporal debugging must be visible in the running window, not hidden behind relaunch-only command flags. F1 cycles render debug modes and 0-4 select final, raw current scene, reprojected history, history age, and history weight, making it possible to prove whether the presented frame is resolved and whether history is alive.","files":["docs/tsr-inspired-taa-spec.md","docs/hlsl-renderer.md","src/Aquarium.Engine/AquariumHost.cs","src/Aquarium.Engine.Contracts/Input/InputState.cs","src/Aquarium.Engine/Platform/Win32Window.cs","src/Aquarium.Engine/Render/D3D11Renderer.cs","src/Aquarium.Engine/Render/DirectWriteOverlay.cs","src/Aquarium.Engine/Render/Shaders/Aquarium.hlsl","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-reload.ps1 -Headless -RetainSlots 4"],"ts":"2026-05-08"}
|
||||
{"area":"dev-loop/reload","lesson":"dev-watch must not only classify source changes; it must also verify the recorded script-owned process is alive. If the visible/headless PID recorded by dev-reload is gone or no longer belongs to the recorded slot, the watcher relaunches from a fresh slot. The watch fingerprint also includes scripts/*.ps1 so script changes match the documented restart-owned contract.","files":["scripts/dev-watch.ps1","README.md","state/memory.json","state/scratch.md"],"verification":["dotnet build Aquarium.Engine.slnx",".\\scripts\\dev-watch.ps1 -Headless -Once -IntervalMilliseconds 10 -DebounceMilliseconds 10 -RetainSlots 4"],"ts":"2026-05-08"}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
"state_and_reload": [
|
||||
"CultCache is the client memory organ. Runtime state, camera, renderer knobs, body state, UI state, and future Epiphany connection state should be typed Cult documents.",
|
||||
"The current live document is epiphany.aquarium.live_state, stored through CultLib MessagePack backing. Direct runs can use --cache or AQUARIUM_CULTCACHE_PATH.",
|
||||
"dev-reload builds disposable apphost slots so a running window does not lock normal build output. dev-watch hot reloads shaders and live runtime DLLs while preserving the last good process. Host/core/content changes, including src/Aquarium.Engine/Assets, must rebuild and restart the apphost on demand.",
|
||||
"dev-reload builds disposable apphost slots so a running window does not lock normal build output. dev-watch hot reloads shaders and live runtime DLLs while preserving the last good process. Host/core/content changes, scripts, and src/Aquarium.Engine/Assets must rebuild and restart the apphost on demand. dev-watch must also relaunch if its recorded script-owned process is no longer running.",
|
||||
"Shader reload failure must keep the previous good shader objects bound. Live-runtime reload failure must keep the previous runtime alive. Rehydrate from CultCache before claiming reload survival."
|
||||
],
|
||||
"salvage_without_baggage": [
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ prototype integrated along the camera ray before surface composition.
|
|||
- Dev watcher fix: restart fingerprint now includes `src/Aquarium.Engine/Assets`
|
||||
so runtime content changes trigger apphost rebuild/restart instead of relying
|
||||
on shader or live assembly reload.
|
||||
- Dev watcher heartbeat fix: watcher now checks the recorded script-owned PID
|
||||
from the visible/headless dev-reload state and relaunches if that process is
|
||||
gone. It also fingerprints `scripts/*.ps1` so script changes are treated as
|
||||
restart-owned source changes.
|
||||
- Temporal pass: added clean-room TSR-inspired Gate 1. Scene renders into
|
||||
HDR/travel texture, resolve pass reprojects by current/previous camera basis,
|
||||
clamps history to current 3x3 neighborhood, rejects by travel delta, writes
|
||||
|
|
|
|||
Loading…
Reference in a new issue