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

fix: stop three surfaces from naming a cause they never established (#4694)

[._.]/ Adam Eivy10025b045ce4
diff --git a/client/src/components/system-resources/BuildStampPanel.jsx b/client/src/components/system-resources/BuildStampPanel.jsx
index 632c4cc9e5..afd6cf92f0 100644
--- a/client/src/components/system-resources/BuildStampPanel.jsx
+++ b/client/src/components/system-resources/BuildStampPanel.jsx
@@ -27,6 +27,9 @@ import { timeAgo } from '../../utils/formatters';
*/
export default function BuildStampPanel({ uptimeFormatted }) {
const [build, setBuild] = useState(null);
+ // `null` build covers three different states, and they must not all render as
+ // "no git metadata" — that names a cause the panel has not established.
+ const [load, setLoad] = useState('loading');
// One fetch on mount, not on the page's 15s health poll: the commit a running
// process was started from cannot change without a restart, and a restart
@@ -34,8 +37,8 @@ export default function BuildStampPanel({ uptimeFormatted }) {
useEffect(() => {
let live = true;
api.getSystemBuild({ silent: true })
- .then((data) => { if (live) setBuild(data); })
- .catch(() => {});
+ .then((data) => { if (live) { setBuild(data); setLoad('ready'); } })
+ .catch(() => { if (live) setLoad('error'); });
return () => { live = false; };
}, []);
@@ -85,7 +88,7 @@ export default function BuildStampPanel({ uptimeFormatted }) {
/>
</dl>
- <p className="mt-3 text-xs text-gray-500">{footnote(state, build)}</p>
+ <p className="mt-3 text-xs text-gray-500">{footnote(state, build, load)}</p>
</section>
);
}
@@ -97,7 +100,11 @@ function bundleHint() {
return TRUSTED_BUNDLE_STAMP?.builtAt ? `built ${timeAgo(TRUSTED_BUNDLE_STAMP.builtAt)}` : null;
}
-function footnote(state, build) {
+function footnote(state, build, load) {
+ if (load === 'loading') return 'Checking which build is running…';
+ // An older server has no /api/system/build at all. Saying "no git metadata"
+ // there blames the checkout for a missing endpoint.
+ if (load === 'error') return 'Could not read the server build — it may be running a version without this endpoint.';
if (state === 'mismatch') return null;
if (state === 'unknown') {
return !SERVED_BUILD_ID
diff --git a/client/src/components/system-resources/BuildStampPanel.test.jsx b/client/src/components/system-resources/BuildStampPanel.test.jsx
index 367ae78182..dea509b893 100644
--- a/client/src/components/system-resources/BuildStampPanel.test.jsx
+++ b/client/src/components/system-resources/BuildStampPanel.test.jsx
@@ -1,5 +1,5 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
-import { render, screen, waitFor } from '@testing-library/react';
+import { act, render, screen, waitFor } from '@testing-library/react';
const api = vi.hoisted(() => ({ getSystemBuild: vi.fn() }));
vi.mock('../../services/api', () => api);
@@ -132,7 +132,9 @@ describe('BuildStampPanel', () => {
expect(screen.getByText('at start · up 3h 12m')).toBeInTheDocument();
});
- it('survives a failed build fetch (older server with no such route)', async () => {
+ it('blames the endpoint, not the checkout, when the build fetch fails', async () => {
+ // An older server has no /api/system/build at all. Rendering "no git
+ // metadata" there would name a cause the panel never established.
vi.resetModules();
document.head.innerHTML = '';
api.getSystemBuild.mockRejectedValue(new Error('404'));
@@ -141,5 +143,26 @@ describe('BuildStampPanel', () => {
render(<Panel />);
expect(screen.getByText('Running build')).toBeInTheDocument();
+ await waitFor(() => expect(screen.getByText(/may be running a version without this endpoint/i)).toBeInTheDocument());
+ expect(screen.queryByText(/no git metadata/i)).not.toBeInTheDocument();
+ });
+
+ it('says it is still checking rather than claiming missing git metadata', async () => {
+ // The pre-fetch state is not evidence about the checkout.
+ vi.resetModules();
+ document.head.innerHTML = '';
+ let release;
+ api.getSystemBuild.mockReturnValue(new Promise((resolve) => { release = resolve; }));
+ const Panel = (await import('./BuildStampPanel.jsx')).default;
+
+ render(<Panel />);
+
+ expect(screen.getByText(/checking which build is running/i)).toBeInTheDocument();
+ expect(screen.queryByText(/no git metadata/i)).not.toBeInTheDocument();
+
+ // Settle the pending fetch inside act, or its state update lands after the
+ // test and the suite treats the act warning as a failure.
+ await act(async () => { release(serverBuild()); });
+ expect(screen.getByText('abc1234 · main')).toBeInTheDocument();
});
});
diff --git a/server/routes/systemHealth.js b/server/routes/systemHealth.js
index 0ea98e972f..61e64d2acf 100644
--- a/server/routes/systemHealth.js
+++ b/server/routes/systemHealth.js
@@ -55,8 +55,15 @@ router.get('/processing', asyncHandler(async (req, res) => {
* fetches /health/details from every configured peer and persists the whole
* JSON verbatim as `peer.lastHealth`. Anything added there therefore leaves
* the machine and is written to disk on someone else's install — and a branch
- * name can carry an issue title. Peers do not probe this path, so the stamp
- * stays local by construction rather than by a promise nobody can enforce.
+ * name can carry an issue title. Nothing PortOS does automatically fetches this
+ * path — `probePeer` reads /health/details, /api/apps and /api/instances/
+ * sync-status only — so the stamp never leaves the machine on its own.
+ *
+ * That is the guarantee being made, and the limit of it: the generic
+ * `queryPeer` proxy (routes/instances.js, predates this) lets an authenticated
+ * peer deliberately GET any /api/* path, as it can for every other endpoint on
+ * this server. The point here is that the stamp is not PUSHED into a payload
+ * that federates unprompted.
* See the root CLAUDE.md privacy rules and #4694 ("local-only diagnostic data
* — must not join a sync payload"). `health.test.js` pins both halves.
*/
diff --git a/server/services/bootstrap.js b/server/services/bootstrap.js
index 1a00222aa9..9145e8c283 100644
--- a/server/services/bootstrap.js
+++ b/server/services/bootstrap.js
@@ -644,7 +644,15 @@ const announceListening = ({ io, httpServer, localHttpServer, httpsEnabled, port
console.log(` 🧬 build ${formatBuildIdentity(identity)}`);
} else {
getBuildIdentity()
- .then((late) => console.log(` 🧬 build ${formatBuildIdentity(late)} (probed late)`))
+ .then((late) => {
+ // Only print once there is something true to print. A failed probe
+ // resolves to an all-null tuple, and formatting THAT would claim "no git
+ // metadata" — the wrong reason, permanently, about a checkout that is
+ // fine. Say the probe did not finish instead; the API and the UI report
+ // the real value as soon as a retry succeeds.
+ if (late?.shortCommit) console.log(` 🧬 build ${formatBuildIdentity(late)}`);
+ else console.log(` 🧬 build — git probe did not finish in time; /api/system/build will report it`);
+ })
.catch((err) => console.error(`❌ Build identity probe failed: ${err.message}`));
}
if (!httpsEnabled) {