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: codex network errors, paused recovery, missed UI surfaces, updater SHA, release rerun, mediaModels UX, snapshot bootstrap docs
Adam Eivy584f0b750f56
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 97381d2d18..d714d42260 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -117,6 +117,16 @@ jobs:git fetch origin maingit checkout main+ # After switching to main: re-check whether the pattern file is+ # actually present. A prior workflow run that archived but failed+ # before pushing back to release leaves the file present on the+ # release branch (initial check) but absent on main (already moved).+ # Skip cleanly in that case.+ if [ ! -f "$PATTERN_FILE" ]; then+ echo "Changelog already archived on main — nothing to do"+ exit 0+ fi+git mv "$PATTERN_FILE" "$VERSIONED_FILE"sed -i.bak "s/v${MAJOR_MINOR}\.x/v${CURRENT_VERSION}/g; s/${MAJOR_MINOR}\.x/${CURRENT_VERSION}/g; s/YYYY-MM-DD/$(date +%Y-%m-%d)/g" "$VERSIONED_FILE"rm "${VERSIONED_FILE}.bak"diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsxindex 1b76027e84..b330e8d890 100644--- a/client/src/components/cos/tabs/ScheduleTab.jsx+++ b/client/src/components/cos/tabs/ScheduleTab.jsx@@ -195,7 +195,7 @@ function PipelineStageConfig({ taskType, config, providers, onUpdate, updating,<div className="space-y-3">{stages.map((stage, i) => {const stageProvider = providers?.find(p => p.id === stage.providerId);- const stageModels = stageProvider?.models || [];+ const stageModels = filterSelectableModels(stageProvider?.models);return (<div key={i} className="bg-port-card border border-port-border rounded-lg p-3"><div className="flex items-center gap-2 mb-3">diff --git a/client/src/components/digital-twin/PersonalityMap.jsx b/client/src/components/digital-twin/PersonalityMap.jsxindex 68762f69b8..49b3d397e6 100644--- a/client/src/components/digital-twin/PersonalityMap.jsx+++ b/client/src/components/digital-twin/PersonalityMap.jsx@@ -2,6 +2,7 @@ import { useState } from 'react';import { Brain, RefreshCw, AlertCircle } from 'lucide-react';import * as api from '../../services/api';import toast from '../ui/Toast';+import { filterSelectableModels } from '../../utils/providers';const BIG_FIVE_LABELS = {O: { name: 'Openness', low: 'Practical', high: 'Curious' },@@ -122,7 +123,7 @@ export default function PersonalityMap({ traits, confidence, providers, onAnalyzclassName="px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm min-w-[200px]">{providers?.map(p => (- (p.models || [p.defaultModel]).filter(Boolean).map(model => (+ (filterSelectableModels(p.models).length > 0 ? filterSelectableModels(p.models) : [p.defaultModel]).filter(Boolean).map(model => (<option key={`${p.id}:${model}`} value={`${p.id}:${model}`}>{p.name} - {model}</option>diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsxindex dee9d147ea..ddaebbd3dc 100644--- a/client/src/pages/AIProviders.jsx+++ b/client/src/pages/AIProviders.jsx@@ -2,6 +2,7 @@ import { useState, useEffect, useCallback } from 'react';import toast from '../components/ui/Toast';import * as api from '../services/api';import socket from '../services/socket';+import { filterSelectableModels } from '../utils/providers';export default function AIProviders() {const [providers, setProviders] = useState([]);@@ -260,8 +261,8 @@ export default function AIProviders() {{provider.type === 'api' && (<p>Endpoint: <code className="text-gray-300">{provider.endpoint}</code></p>)}- {provider.models?.length > 0 && (- <p>Models: {provider.models.slice(0, 3).join(', ')}{provider.models.length > 3 ? ` +${provider.models.length - 3}` : ''}</p>+ {filterSelectableModels(provider.models).length > 0 && (+ <p>Models: {filterSelectableModels(provider.models).slice(0, 3).join(', ')}{filterSelectableModels(provider.models).length > 3 ? ` +${filterSelectableModels(provider.models).length - 3}` : ''}</p>)}{provider.envVars && Object.keys(provider.envVars).length > 0 && (<div className="mt-0.5">diff --git a/client/src/pages/MediaModels.jsx b/client/src/pages/MediaModels.jsxindex aa0dc40c44..fb179acb66 100644--- a/client/src/pages/MediaModels.jsx+++ b/client/src/pages/MediaModels.jsx@@ -8,18 +8,20 @@*/import { useState, useEffect, useCallback } from 'react';-import { Trash2, Image as ImageIcon, Film } from 'lucide-react';+import { AlertTriangle, Trash2, Image as ImageIcon, Film } from 'lucide-react';import toast from '../components/ui/Toast';import { listCachedModels, deleteCachedModel, deleteLora } from '../services/api';export default function MediaModels() {const [data, setData] = useState({ models: [], loras: [], hubDir: '', diskUsage: {} });const [busy, setBusy] = useState(null);+ const [error, setError] = useState(null);const refresh = useCallback(() => {+ setError(null);listCachedModels().then(setData)- .catch(() => setData({ models: [], loras: [], hubDir: '', diskUsage: {} }));+ .catch(err => setError(err?.message || 'Failed to load media models'));}, []);useEffect(() => { refresh(); }, [refresh]);@@ -46,6 +48,18 @@ export default function MediaModels() {.finally(() => setBusy(null));};+ if (error) {+ return (+ <div className="p-6 text-center">+ <AlertTriangle size={32} className="mx-auto text-port-warning mb-3" />+ <p className="text-gray-400 mb-3">Couldn't load media models: {error}</p>+ <button type="button" onClick={refresh} className="px-4 py-2 bg-port-card border border-port-border rounded-lg text-white hover:bg-port-bg">+ Retry+ </button>+ </div>+ );+ }+return (<div className="space-y-6"><div className="grid grid-cols-2 md:grid-cols-4 gap-3">diff --git a/client/src/pages/RunnerPage.jsx b/client/src/pages/RunnerPage.jsxindex 17401b7514..e2390e2005 100644--- a/client/src/pages/RunnerPage.jsx+++ b/client/src/pages/RunnerPage.jsx@@ -6,6 +6,7 @@ import * as api from '../services/api';import socket from '../services/socket';import { processScreenshotUploads } from '../utils/fileUpload';import BrailleSpinner from '../components/BrailleSpinner';+import { filterSelectableModels } from '../utils/providers';export function RunnerPage() {const location = useLocation();@@ -363,13 +364,13 @@ ${prompt.trim()}`;</select>{/* Model */}- {currentProvider?.models?.length > 0 && (+ {filterSelectableModels(currentProvider?.models).length > 0 && (<selectvalue={selectedModel}onChange={(e) => setSelectedModel(e.target.value)}className="px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm">- {currentProvider.models.map(m => (+ {filterSelectableModels(currentProvider.models).map(m => (<option key={m} value={m}>{m}</option>))}</select>diff --git a/server/lib/codexCliOutput.js b/server/lib/codexCliOutput.jsindex 66a6992f25..3f9d756057 100644--- a/server/lib/codexCliOutput.js+++ b/server/lib/codexCliOutput.js@@ -1,6 +1,10 @@const STARTUP_FIELD_RE = /^(workdir|model|provider|approval|sandbox|reasoning effort|reasoning summaries|session id):/i;const RUNTIME_SIGNAL_RE = /^(ERROR:|exec\s+)/i;const ERROR_SIGNAL_RE = /\b(invalid_request_error|not logged in|api key|unauthorized|forbidden|rate.?limit|quota exceeded|model .*not supported|billing|subscription)\b/i;+// Network and system error patterns that agentErrorAnalysis.js classifies but+// ERROR_SIGNAL_RE doesn't cover. These are safe to match post-prompt-boundary+// because they're OS-level tokens unlikely to appear in normal prompt text.+const NETWORK_SIGNAL_RE = /\b(ECONNREFUSED|ETIMEDOUT|ENOENT|EACCES|EPIPE|ENETUNREACH|connection (?:refused|reset)|socket hang up|network (?:error|unreachable)|connect (?:timed out|timeout))\b/i;function shouldDropCodexLine(trimmed) {if (!trimmed) return true;@@ -57,7 +61,7 @@ export function createCodexStderrFormatter(userPrompt = '') {// failures (e.g. "not logged in", "unauthorized") become the// first-emitted runtime line even without an ERROR: prefix.const isRuntimeSignal = RUNTIME_SIGNAL_RE.test(trimmed)- || (crossedPromptBoundary && ERROR_SIGNAL_RE.test(trimmed));+ || (crossedPromptBoundary && (ERROR_SIGNAL_RE.test(trimmed) || NETWORK_SIGNAL_RE.test(trimmed)));if (suppressCommandOutput && !isRuntimeSignal) return null;if (!sawRuntimeOutput && !isRuntimeSignal) return null;if (isRuntimeSignal) sawRuntimeOutput = true;diff --git a/server/lib/codexCliOutput.test.js b/server/lib/codexCliOutput.test.jsindex 700d8eb18e..ad04fedb62 100644--- a/server/lib/codexCliOutput.test.js+++ b/server/lib/codexCliOutput.test.js@@ -164,4 +164,91 @@ not logged inexpect(lines).toEqual(['not logged in']);});++ it('emits ECONNREFUSED errors — matches both RUNTIME_SIGNAL_RE (Error:) and NETWORK_SIGNAL_RE', () => {+ const formatter = createCodexStderrFormatter();++ const lines = formatter.processChunk(`Reading prompt from stdin...+OpenAI Codex v0.125.0 (research preview)+--------+workdir: /repo+model: gpt-4o+provider: openai+approval: never+sandbox: workspace-write+session id: abc+--------+user+Some normal prompt.+Error: ECONNREFUSED 127.0.0.1:11434+`);++ expect(lines).toEqual(['Error: ECONNREFUSED 127.0.0.1:11434']);+ });++ it('emits plain "socket hang up" via NETWORK_SIGNAL_RE after prompt boundary', () => {+ const formatter = createCodexStderrFormatter();++ const lines = formatter.processChunk(`Reading prompt from stdin...+OpenAI Codex v0.125.0 (research preview)+--------+workdir: /repo+model: gpt-4o+provider: openai+approval: never+sandbox: workspace-write+session id: abc+--------+user+Some normal prompt.+socket hang up+`);++ expect(lines).toEqual(['socket hang up']);+ });++ it('emits plain "connect timeout" via NETWORK_SIGNAL_RE after prompt boundary', () => {+ const formatter = createCodexStderrFormatter();++ const lines = formatter.processChunk(`Reading prompt from stdin...+OpenAI Codex v0.125.0 (research preview)+--------+workdir: /repo+model: gpt-4o+provider: openai+approval: never+sandbox: workspace-write+session id: abc+--------+user+Some normal prompt.+connect timeout after 30s+`);++ expect(lines).toEqual(['connect timeout after 30s']);+ });++ it('still drops "connection refused" that appears in user-prompt zone (promptLineSet filter)', () => {+ // A prompt containing "connection refused" must NOT leak — the promptLineSet.has check+ // fires before ERROR_SIGNAL_RE / NETWORK_SIGNAL_RE, so exact-match prompt lines are+ // dropped regardless of network keyword content.+ const userPrompt = 'Why does the server say connection refused on port 8080?';+ const formatter = createCodexStderrFormatter(userPrompt);++ const lines = formatter.processChunk(`Reading prompt from stdin...+OpenAI Codex v0.125.0 (research preview)+--------+workdir: /repo+model: gpt-4o+provider: openai+approval: never+sandbox: workspace-write+session id: abc+--------+user+Why does the server say connection refused on port 8080?+`);++ expect(lines).toEqual([]);+ });});diff --git a/server/lib/mediaModels.js b/server/lib/mediaModels.jsindex 9b4c26be1f..e34d858325 100644--- a/server/lib/mediaModels.js+++ b/server/lib/mediaModels.js@@ -202,9 +202,18 @@ const backfillRuntime = (list) => {// Build the initial shippedIds set for one platform on first encounter// (no _shippedDefaults field yet).//-// When the user has an array for this platform we treat the union of their ids-// and the default ids as "already shipped" — this preserves any deletions they-// made before _shippedDefaults was introduced, without re-adding removed entries.+// Pre-snapshot bootstrap: existing installs without _shippedDefaults can't+// distinguish "user explicitly removed this built-in" from "this built-in+// is new in this release". We choose to UNION the user's current ids with+// the current default ids, treating both as "already shipped". That preserves+// any deletions the user made before this feature existed, at the cost of new+// built-in models in this release also being marked as shipped — so they won't+// appear on this install until the user edits data/media-models.json directly.+//+// Trade-off favors data preservation over feature visibility: a user who curated+// their model list won't have it silently re-populated. Users who want the new+// built-ins can delete media-models.json and restart to re-seed from scratch,+// or add the entries manually.//// When the platform key is absent from their registry (e.g. the whole `video`// section is missing), we return an empty set so the defaults are treated asdiff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.jsindex fe0bb0579e..785edaee39 100644--- a/server/services/autonomousJobs.js+++ b/server/services/autonomousJobs.js@@ -504,7 +504,13 @@ async function syncSkillTemplatesFromSample() {await writeFile(shippedPath, sampleContent)console.log(`🔄 Updated unmodified skill template: ${file}`)} else {- // Case d: user has customized the file — leave it alone+ // Case d: for installs upgrading from a pre-.shipped release, any existing+ // skill file that doesn't match the current sample lands here. In reality+ // the file might just be the previous shipped version — we can't tell without+ // history. We choose preservation: the user's file (whether intentional+ // customization or a stale shipped copy) stays in place. Users who want the+ // new template can delete the file and restart so the seeder re-creates it+ // from data.sample/.console.log(`ℹ️ Preserving user-modified skill template: ${file}`)}}@@ -671,9 +677,17 @@ function applyAdditiveFields(existing, defaultJob) {const snapshot = existing._shippedDefaults[field]if (snapshot === undefined) {- // Pre-snapshot job: bootstrap snapshot to the current shipped default.- // Value is preserved (we can't distinguish user-edit from old shipped value).- // On the NEXT release the snapshot will exist and comparisons will work correctly.+ // Pre-snapshot bootstrap: this job predates the _shippedDefaults mechanism,+ // so we have no way to distinguish "user customized this field" from "user+ // matches the previous shipped default". We bootstrap _shippedDefaults to+ // the CURRENT shipped value as a one-shot transition: existing installs hold+ // whatever value they had until the user explicitly edits the field via the UI+ // (which preserves customization) or until a future release ships a new default+ // — at which point the snapshot comparison works normally.+ //+ // Trade-off: existing installs may hold older defaults indefinitely. Users who+ // want fresh shipped defaults can edit + revert the field via the UI, or delete+ // the job entirely so the next merge re-seeds it from scratch.existing._shippedDefaults[field] = defaultJob[field]changed = truecontinuediff --git a/server/services/creativeDirector/recovery.js b/server/services/creativeDirector/recovery.jsindex 5ba7b32c54..e2df830a36 100644--- a/server/services/creativeDirector/recovery.js+++ b/server/services/creativeDirector/recovery.js@@ -80,11 +80,19 @@ export async function recoverInFlightProjects() {const scenes = project.treatment?.scenes || [];const stuck = scenes.filter((s) => STUCK_SCENE_STATUSES.has(s.status));for (const scene of stuck) {+ // Paused projects with a completed render (renderedJobId set) retain their+ // `evaluating` status so completionHook's resume path can re-fire the+ // evaluator against the existing clip instead of forcing a full re-render.+ // Resetting these to `pending` would discard the already-rendered video.+ if (project.status === 'paused' && scene.renderedJobId) continue;await updateScene(project.id, scene.sceneId, { status: 'pending' }).catch((e) => console.log(`⚠️ CD recovery: reset scene ${scene.sceneId} of ${project.id} failed: ${e.message}`));}- if (stuck.length) {- console.log(`🔄 CD recovery: ${project.id} reset ${stuck.length} stuck scene(s) to pending`);+ const resetCount = stuck.filter(+ (s) => !(project.status === 'paused' && s.renderedJobId),+ ).length;+ if (resetCount) {+ console.log(`🔄 CD recovery: ${project.id} reset ${resetCount} stuck scene(s) to pending`);}// Reap stale `running` agent-run rows AND retire the underlying CoS// task. The agent task behind each run died with the previous process,diff --git a/server/services/creativeDirector/recovery.test.js b/server/services/creativeDirector/recovery.test.jsindex 41bb0e83c4..276676faea 100644--- a/server/services/creativeDirector/recovery.test.js+++ b/server/services/creativeDirector/recovery.test.js@@ -291,6 +291,67 @@ describe('recoverInFlightProjects', () => {expect(mockAdvance).toHaveBeenCalledWith('cd-1');});+ it('preserves evaluating+renderedJobId scenes for paused projects (resume path reuses existing clip)', async () => {+ // Regression: recovery used to reset ALL evaluating scenes to `pending`,+ // including paused ones with a valid renderedJobId. That discarded the+ // already-rendered clip and forced a full re-render on Resume, even though+ // completionHook's orphaned-evaluating path can reuse the existing video.+ mockListProjects.mockResolvedValue([+ {+ id: 'cd-paused',+ status: 'paused',+ treatment: {+ scenes: [+ { sceneId: 's1', status: 'evaluating', renderedJobId: 'abc-123-def-456-ghi-789-jkl-000' },+ ],+ },+ runs: [],+ },+ ]);+ await recoverInFlightProjects();+ // Scene must NOT be reset — the renderedJobId is present and the project is paused.+ expect(mockUpdateScene).not.toHaveBeenCalled();+ });++ it('still resets evaluating scenes for paused projects when there is no renderedJobId', async () => {+ // A paused scene without a renderedJobId has no render to resume from —+ // resetting to `pending` is correct so a full re-render happens on Resume.+ mockListProjects.mockResolvedValue([+ {+ id: 'cd-paused',+ status: 'paused',+ treatment: {+ scenes: [+ { sceneId: 's1', status: 'evaluating' }, // no renderedJobId+ ],+ },+ runs: [],+ },+ ]);+ await recoverInFlightProjects();+ expect(mockUpdateScene).toHaveBeenCalledWith('cd-paused', 's1', { status: 'pending' });+ });++ it('resets evaluating scenes for active (non-paused) projects regardless of renderedJobId', async () => {+ // Active projects need their in-flight listeners re-attached — even if a+ // render finished, the evaluate task died with the server and the whole+ // scene should restart from the render step.+ mockListProjects.mockResolvedValue([+ {+ id: 'cd-rendering',+ status: 'rendering',+ treatment: {+ scenes: [+ { sceneId: 's1', status: 'evaluating', renderedJobId: 'abc-123-def-456-ghi-789-jkl-000' },+ ],+ },+ runs: [],+ },+ ]);+ await recoverInFlightProjects();+ expect(mockUpdateScene).toHaveBeenCalledWith('cd-rendering', 's1', { status: 'pending' });+ });+it('handles multiple projects independently', async () => {mockListProjects.mockResolvedValue([{diff --git a/update.ps1 b/update.ps1index 7fcb9f2c0d..fa235b0647 100644--- a/update.ps1+++ b/update.ps1@@ -106,6 +106,7 @@ Step "git-pull" "running" "Pulling latest changes..."$headRef = git symbolic-ref -q HEAD 2>$null$currentBranch = if ($headRef) { $headRef -replace "refs/heads/", "" } else { "" }$stashedForBranch = ""+$stashedForCommit = ""if ($currentBranch -ne "main") {$hasChanges = $falsegit diff --quiet 2>$null@@ -122,7 +123,12 @@ if ($currentBranch -ne "main") {$branchLabel = if ($currentBranch) { $currentBranch } else { "detached HEAD" }Write-SafeHost "⚠️ Stashing local changes from '$branchLabel' so checkout can proceed" -ForegroundColor YellowInvoke-Logged git stash push -u -m "portos-update-$([int][double]::Parse((Get-Date -UFormat %s)))"- if ($LASTEXITCODE -eq 0) { $stashedForBranch = $branchLabel }+ if ($LASTEXITCODE -eq 0) {+ $stashedForBranch = $branchLabel+ # Capture the original commit SHA so detached-HEAD users can return+ # to the exact tree their stash was taken from.+ $stashedForCommit = git rev-parse HEAD+ }}if (-not $currentBranch) {$detachedCommit = git rev-parse --short HEAD@@ -273,6 +279,10 @@ Write-SafeHost ""if ($stashedForBranch) {Write-SafeHost "ℹ️ Your local changes from '$stashedForBranch' were stashed for the update." -ForegroundColor Cyan- Write-SafeHost " To restore them: git checkout '$stashedForBranch'; git stash pop" -ForegroundColor Cyan+ if ($stashedForBranch -eq "detached HEAD") {+ Write-SafeHost " To restore them: git checkout $stashedForCommit; git stash pop" -ForegroundColor Cyan+ } else {+ Write-SafeHost " To restore them: git checkout '$stashedForBranch'; git stash pop" -ForegroundColor Cyan+ }Write-SafeHost " The stash entry is at the top of 'git stash list'." -ForegroundColor Cyan}diff --git a/update.sh b/update.shindex ca8c3dc59e..46866a409f 100755--- a/update.sh+++ b/update.sh@@ -70,11 +70,15 @@ safe_install() {step "git-pull" "running" "Pulling latest changes..."current_branch=$(git symbolic-ref -q --short HEAD 2>/dev/null || echo "")stashed_for_branch=""+stashed_for_commit=""if [ "$current_branch" != "main" ]; thenif ! git diff --quiet || ! git diff --cached --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; thenlog "⚠️ Stashing local changes from '${current_branch:-detached HEAD}' so checkout can proceed"if run git stash push -u -m "portos-update-$(date +%s)"; thenstashed_for_branch="${current_branch:-detached HEAD}"+ # Capture the original commit SHA so detached-HEAD users can return+ # to the exact tree their stash was taken from.+ stashed_for_commit=$(git rev-parse HEAD)fifilog "⚠️ On branch '${current_branch:-detached HEAD}' — switching to main for update"@@ -201,6 +205,10 @@ log ""if [ -n "$stashed_for_branch" ]; thenlog "ℹ️ Your local changes from '$stashed_for_branch' were stashed for the update."- log " To restore them: git checkout '$stashed_for_branch' && git stash pop"+ if [ "$stashed_for_branch" = "detached HEAD" ]; then+ log " To restore them: git checkout $stashed_for_commit && git stash pop"+ else+ log " To restore them: git checkout '$stashed_for_branch' && git stash pop"+ filog " The stash entry is at the top of 'git stash list'."fi