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 (claude): quiet delete-mid-render, drop stale download header, recovery test
[._.]/ Adam Eivy9c88de74d4e4
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 2b8332dd7f..aeef48710a 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,7 +2,7 @@## 3D-- **[issue-2952] Turn a rendered image into a downloadable 3D mesh** — once TRELLIS.2 is installed, PortOS can now take one of your gallery images and render it into a real 3D model (a `.glb` mesh with PBR textures) entirely on-device. Each render is saved as its own record you can list, re-render, download, or delete, and it tracks live status (generating → ready, with progress) and its render history — so the 3D page has a working "create a 3D model" path end to end. The render only ever runs when you ask for it (never in the background), and is refused with a clear reason if the model isn't installed or your hardware can't run it.+- **[issue-2952] Turn a rendered image into a downloadable 3D mesh (create/render backend)** — once TRELLIS.2 is installed, PortOS can now take one of your gallery images and render it into a real 3D model (a `.glb` mesh with PBR textures) entirely on-device. Each render is saved as its own record you can list, re-render, download, or delete, and it tracks live status (generating → ready, with progress) and its render history — the backend "create a 3D model" path the 3D page's UI drives. The render only ever runs when you ask for it (never in the background), and is refused with a clear reason if the model isn't installed or your hardware can't run it.- **[issue-2953] Install image-to-3D models from a new 3D page** — a new **3D** page under Create lists the available image-to-3D models (starting with Microsoft TRELLIS.2) and shows each one's state at a glance: **Ready**, an **Install** button, or a note explaining why your hardware can't run it (e.g. needs an Apple Silicon Mac with enough memory). Installing runs entirely on-device with a live progress log — the same in-app install experience as the image generators — so you never touch a terminal. Reachable from the sidebar, ⌘K, and voice. (Turning one of your rendered images into a 3D mesh from this page lands next.)- **[issue-2952] TRELLIS.2 install now survives network hiccups** — the multi-gigabyte TRELLIS.2 install pulls from several code repositories, and a single dropped connection mid-download used to abort the whole thing with a cryptic error. The installer now automatically retries a step that fails from a transient network drop (with a short backoff), and already-downloaded pieces are kept — so a flaky connection resumes instead of starting over. If it still can't finish, the error now says plainly that it was a network hiccup and that clicking **Install** again picks up where it left off.diff --git a/server/routes/imageTo3d.js b/server/routes/imageTo3d.jsindex 628994bde9..a046158e87 100644--- a/server/routes/imageTo3d.js+++ b/server/routes/imageTo3d.js@@ -151,8 +151,14 @@ router.get('/models/:id/asset', asyncHandler(async (req, res) => {// Pre-stream (common: file removed after the readiness check) → shared 404// envelope. Mid-stream (headers already flushed) → tear the socket down, since// sendErrorResponse no-ops once headers are sent.- if (res.headersSent) res.destroy(err);- else sendErrorResponse(res, new ServerError('Mesh file not found', { status: 404, code: 'ASSET_MISSING' }));+ if (res.headersSent) {+ res.destroy(err);+ } else {+ // Drop the GLB download headers set above so the JSON error body isn't+ // offered to the browser as a "<name>.glb" attachment.+ res.removeHeader('Content-Disposition');+ sendErrorResponse(res, new ServerError('Mesh file not found', { status: 404, code: 'ASSET_MISSING' }));+ }});stream.pipe(res);}));diff --git a/server/services/imageTo3d/models.js b/server/services/imageTo3d/models.jsindex 8c62c3deae..e69d86a350 100644--- a/server/services/imageTo3d/models.js+++ b/server/services/imageTo3d/models.js@@ -83,8 +83,11 @@ function updateRun(runs, operationId, patch) {async function failGeneration(id, operationId, error) {const message = cleanError(error);+ // includeDeleted so a record the user deleted mid-render resolves (rather than+ // throwing NOT_FOUND → a spurious "failure could not be persisted" log); the+ // `deleted` guard then no-ops the write — the delete already recorded the intent.await store.mutateModel(id, (current) => {- if (current.generationOperationId !== operationId) return null;+ if (current.deleted || current.generationOperationId !== operationId) return null;return {...current,status: 'failed',@@ -96,7 +99,7 @@ async function failGeneration(id, operationId, error) {completedAt: new Date().toISOString(),}),};- }).catch((persistError) => {+ }, { includeDeleted: true }).catch((persistError) => {console.error(`❌ Image-to-3D model ${id} failure could not be persisted: ${persistError.message}`);});}@@ -123,8 +126,11 @@ async function executeRender({ id, operationId, runner, sourcePath }) {});const completedAt = new Date().toISOString();+ // includeDeleted + `deleted` guard: if the user deleted the record while the+ // render ran, complete quietly as a no-op (the GLB on disk is orphaned — full+ // kill-on-delete is tracked as a follow-up) instead of throwing NOT_FOUND.await store.mutateModel(id, (current) => {- if (current.generationOperationId !== operationId) return null;+ if (current.deleted || current.generationOperationId !== operationId) return null;return {...current,status: 'ready',@@ -138,7 +144,7 @@ async function executeRender({ id, operationId, runner, sourcePath }) {completedAt,}),};- });+ }, { includeDeleted: true });console.log(`🧊 Image-to-3D mesh ready: ${id}`);} catch (error) {console.error(`❌ Image-to-3D render failed for ${id}: ${cleanError(error)}`);diff --git a/server/services/imageTo3d/models.test.js b/server/services/imageTo3d/models.test.jsindex b72b693075..b8d0daef19 100644--- a/server/services/imageTo3d/models.test.js+++ b/server/services/imageTo3d/models.test.js@@ -35,7 +35,7 @@ vi.mock('./db.js', () => ({import { resolveTarget } from './targets.js';import { isTrellis2Installed, runTrellis2Generate } from './trellis2.js';import * as store from './db.js';-import { createModel, startGeneration, getModelAsset } from './models.js';+import { createModel, startGeneration, getModelAsset, recoverInterruptedModels } from './models.js';const draftRecord = () => ({id: 'image3d-example',@@ -133,6 +133,15 @@ describe('image-to-3D model orchestration', () => {expect(current.runs.at(-1)).toMatchObject({ status: 'failed' });});+ it('recoverInterruptedModels never launches a render (no cold-bootstrap)', async () => {+ store.recoverInterruptedModels.mockResolvedValue({ recovered: 2 });+ const result = await recoverInterruptedModels();+ expect(result).toEqual({ recovered: 2 });+ // The whole point of boot recovery: mark interrupted renders failed-retryable+ // WITHOUT relaunching any GPU work (CLAUDE.md no-cold-bootstrap policy).+ expect(runTrellis2Generate).not.toHaveBeenCalled();+ });+it('getModelAsset 409s until a mesh is rendered, then returns the download path', async () => {store.getModel.mockResolvedValueOnce({ ...draftRecord(), status: 'generating' });await expect(getModelAsset('image3d-example'))