Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: use ref for pre-update version, emit STEP via stdout in PowerShell

Adam Eivy22d757466431
diff --git a/client/src/components/apps/tabs/UpdateTab.jsx b/client/src/components/apps/tabs/UpdateTab.jsx
index aed8113a63..964f14c545 100644
--- a/client/src/components/apps/tabs/UpdateTab.jsx
+++ b/client/src/components/apps/tabs/UpdateTab.jsx
@@ -35,6 +35,7 @@ export default function UpdateTab() {
const [polling, setPolling] = useState(false);
const pollRef = useRef(null);
const targetVersionRef = useRef(null);
+ const preUpdateVersionRef = useRef(null);
const fetchStatus = useCallback(async () => {
const data = await api.getUpdateStatus().catch(() => null);
@@ -114,7 +115,7 @@ export default function UpdateTab() {
// Accept either an exact target match or any version different from
// the pre-update version (git pull may land on a newer version than
// the release tag that triggered the update)
- const preUpdateVersion = status?.currentVersion;
+ const preUpdateVersion = preUpdateVersionRef.current;
if (ok?.version && (ok.version === targetVersionRef.current || (preUpdateVersion && ok.version !== preUpdateVersion))) {
clearInterval(pollRef.current);
setPolling(false);
@@ -148,6 +149,7 @@ export default function UpdateTab() {
if (status?.latestRelease?.version) {
targetVersionRef.current = status.latestRelease.version;
}
+ preUpdateVersionRef.current = status?.currentVersion || null;
setUpdating(true);
setSteps([]);
setUpdateError(null);
diff --git a/update.ps1 b/update.ps1
index a8d5f29158..60d1763ffb 100644
--- a/update.ps1
+++ b/update.ps1
@@ -33,10 +33,27 @@ function Write-SafeHost {
}
}
+# Safe stdout helper for machine-readable output consumed by the parent process.
+# Uses [Console]::Out.WriteLine so STEP markers reach stdout even when Write-Host
+# is redirected to the information stream.
+function Write-SafeStdout {
+ param([string]$Text)
+ try {
+ [Console]::Out.WriteLine($Text)
+ } catch {
+ if ($_.Exception -is [System.IO.IOException] -or
+ $_.Exception.InnerException -is [System.IO.IOException] -or
+ $_.Exception.ToString() -like "*The pipe has been ended*") {
+ return
+ }
+ throw
+ }
+}
+
# Step output helper (parsed by updateExecutor for UI progress)
function Step {
param([string]$Name, [string]$Status, [string]$Message)
- Write-SafeHost "STEP:${Name}:${Status}:${Message}"
+ Write-SafeStdout "STEP:${Name}:${Status}:${Message}"
}
# Run an external command, routing stdout/stderr to the log file so