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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review: use sessionsRef for exit handler, exit-code based push detection, semantic schema name
Adam Eivy9c76fda86691
diff --git a/client/src/pages/Shell.jsx b/client/src/pages/Shell.jsxindex 4ec7901e0f..841366c431 100644--- a/client/src/pages/Shell.jsx+++ b/client/src/pages/Shell.jsx@@ -53,6 +53,7 @@ export default function Shell() {const [appFolders, setAppFolders] = useState([]);const [folderDropdownOpen, setFolderDropdownOpen] = useState(false);const dropdownRef = useRef(null);+ const sessionsRef = useRef([]);// Read query params once on mount for initial session optionsuseEffect(() => {@@ -278,6 +279,7 @@ export default function Shell() {};const handleSessions = (sessionList) => {+ sessionsRef.current = sessionList;setSessions(sessionList);// On first load, auto-attach to existing session or create newif (!hasInitializedRef.current) {@@ -338,13 +340,10 @@ export default function Shell() {termInstanceRef.current.writeln(`\r\n\x1b[33m[Shell exited with code ${code}]\x1b[0m`);}// Auto-attach to next available session if any remain- setSessions(prev => {- const remaining = prev.filter(s => s.sessionId !== sid);- if (remaining.length > 0) {- setTimeout(() => attachToSession(remaining[remaining.length - 1].sessionId), 100);- }- return prev; // actual list update comes from server broadcast- });+ const remaining = sessionsRef.current.filter(s => s.sessionId !== sid);+ if (remaining.length > 0) {+ setTimeout(() => attachToSession(remaining[remaining.length - 1].sessionId), 100);+ }}};diff --git a/server/lib/socketValidation.js b/server/lib/socketValidation.jsindex cd0c9e24f7..c492c754cb 100644--- a/server/lib/socketValidation.js+++ b/server/lib/socketValidation.js@@ -40,11 +40,14 @@ export const shellResizeSchema = z.object({rows: z.number().int().positive().max(500)});-// shell:stop — session ID-export const shellStopSchema = z.object({+// Shared session ID schema for shell operations+export const shellSessionIdSchema = z.object({sessionId: z.string().min(1, 'sessionId is required')});+// shell:stop — session ID+export const shellStopSchema = shellSessionIdSchema;+// app:update — app ID for pull/install/restart cycleexport const appUpdateSchema = z.object({appId: z.string().min(1, 'appId is required')diff --git a/server/services/git.js b/server/services/git.jsindex 66350f3173..fc681c28eb 100644--- a/server/services/git.js+++ b/server/services/git.js@@ -34,7 +34,7 @@ function execGit(args, cwd, options = {}) {if (code !== 0 && !options.ignoreExitCode) {reject(new Error(stderr || `git exited with code ${code}`));} else {- resolve({ stdout, stderr });+ resolve({ stdout, stderr, exitCode: code });}});@@ -330,7 +330,7 @@ export async function pushAll(dir) {for (const branch of pushable) {const r = await execGit(['push', 'origin', branch.name], dir, { ignoreExitCode: true });const output = (r.stdout || '') + (r.stderr || '');- const ok = !output.includes('rejected') && !output.includes('fatal') && !output.includes('error:');+ const ok = r.exitCode === 0;results[branch.name] = { success: ok, output: output.trim() };if (!ok) failed++;}diff --git a/server/services/socket.js b/server/services/socket.jsindex ff0856c36f..d1430bc805 100644--- a/server/services/socket.js+++ b/server/services/socket.js@@ -25,6 +25,7 @@ import {errorRecoverSchema,shellInputSchema,shellResizeSchema,+ shellSessionIdSchema,shellStopSchema,appUpdateSchema,appStandardizeSchema@@ -385,7 +386,7 @@ export function initSocket(io) {});socket.on('shell:attach', (rawData) => {- const validated = validateSocketData(shellStopSchema, rawData, socket, 'shell:attach');+ const validated = validateSocketData(shellSessionIdSchema, rawData, socket, 'shell:attach');if (!validated) return;const result = shellService.attachSession(validated.sessionId, socket);if (result) {