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

resolve the chroma key off the record in the walk postprocess too

[._.]/ Adam Eivy0edbe03e02cd
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 1ddcaaa44c..4514cb7596 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -186,4 +186,4 @@
- **[claude-default-opus-5] Default Claude CLI/TUI and Bedrock providers now use `claude-opus-5`.** The seeded `claude-code`, `claude-code-tui`, `claude-code-bedrock`, and `claude-code-tui-bedrock` providers ship the new opus tier as their default/heavy model (`claude-opus-5`; Bedrock: `global.anthropic.claude-opus-5[1m]`), and `claude-opus-5` leads the Anthropic API model-refresh list. The Bedrock `[1m]` long-context variant is carried forward and mapped like-for-like — a box pinned to `…opus-4-8[1m]` lands on `…opus-5[1m]`, one pinned to the plain id lands on the plain id — so the bump never silently changes which context tier a Bedrock request asks for. `data.reference/providers.json`, the aiToolkit sample defaults, and the PortOS scaffolder are updated together, and migration `206-claude-default-opus-5.js` rewrites existing installs' `data/providers.json` on the next `update.sh` — conservatively, matching migration 058/153: only an exact match on the prior seeded model list is rewritten (a curated list is left alone), a tier pointer still parked on a now-absent opus-4-8 id is repaired on its own, and still-current haiku/sonnet pins are preserved. `claude-opus-5` is added to the usage cost table at Opus-tier rates ($5/$25 per MTok), and the `/opus/i` family rule now reports it as the tier's rate anchor.
- **[issue-2991] Support portless desktop managed processes and an app→sprite reverse lookup** — a managed app can now describe a GUI/desktop process (`type: 'desktop'`, e.g. a Godot game binary) with no HTTP port, and the port-dependent surfaces degrade gracefully instead of faking a port. Start now launches a desktop app from its own `startCommands` with PM2 `autorestart` OFF (a window closing is a normal exit, not a crash to loop on — `startWithCommand` gained an `{ autorestart }` option), skips the web-server ecosystem path, and refuses to spawn a second instance when the process is already online. Status reports from the supervisor alone (a clean quit renders as *stopped*, never "unreachable"), and the null-tolerant reserved-port collection already excludes absent ports. The "Open UI" launcher stays hidden for a portless app (`getLaunchUrls` returns all-null) rather than linking to `undefined`. New `GET /api/apps/:id/sprite-bindings` reverse-lookup lists the sprite records whose `publishBinding.appId` targets an app, surfaced on the app Overview tab as "Published Sprite Assets" with their destination paths — making "PortOS is the creative source for this app" legible from the app side. Publishing itself still resolves purely from `repoPath`, with no dependency on registered processes.
- **[issue-2953] Finish the image-to-3D workspace: file-upload picker, a per-record detail route, and a records library** — the `/media/3d` page now doubles as a library, listing every `image_to_3d_models` record (newest-first) as a deep-link card into a new `/media/3d/:id` detail view. The detail page mounts the reusable `GlbViewer` (with **Download .glb**) once a render lands `ready`, polls while `generating`, surfaces the runner's actionable error on `failed`, and offers re-render + delete (inline-confirm) — the URL is the source of truth for what's open, per the ID-based deep-linking convention. `GalleryImagePicker` gains an optional `allowUpload` prop: an "Upload" control saves a file off disk into the gallery via the existing peer-syncable `POST /api/image-gen/upload`, then selects it exactly like a gallery image, so an uploaded photo feeds `createImageTo3dModel` the same way a render-history pick does. No new backend surface — everything runs against the endpoints that landed in #2973.
-- **[issue-3043] Let a frozen imported walk set be unlocked for regeneration** — a character imported from the source pipeline whose walk set was finalized without its per-run source clips (the phase-1 import shape) had *no reachable action at all*: unlock and reopen both 409'd `LEGACY_IMPORTED_WALK_SET` (nothing to re-derive from), the cycle-target PUT 409'd `WALK_SET_FINAL` (set is frozen), and the workflow header rendered a dead `imported · no clips to re-derive` label with no button behind it — while the drift banner told the user to re-derive. The guard's premise was too narrow: it reasoned only about *re-derivation*, but a walk render is conditioned on the direction's **locked anchor**, so such a set can always be rebuilt from scratch — it just costs a new render per direction instead of a free local repack. `POST /walk/unlock` now accepts `{ acknowledgeNoClips }`, honored only where the server has proven every stranded direction has a locked anchor to regenerate from (an acknowledgement can never be the thing that strands a set — a stranded direction with an unlocked anchor still refuses, with the original error code). `getWalkState` stamps `walkSet.unlock = { blocked, stranded, acknowledgeable }` from the same resolver the gate itself uses, so the button a client offers and the 409 it might hit are computed from one reading of the set; the refusal that *can* be acknowledged past gets its own code (`LEGACY_IMPORTED_WALK_SET_REGENERABLE`) and names that path. The Walk Cycles header replaces the dead label with an **Unlock anyway** panel stating the cost as visible text rather than a tooltip (one new grok render per direction, every approval dropped, nothing deleted on disk), and the Loop Trimmer disables its `CycleTarget` while the set is frozen — it was enabled and 409'd on change — with the same two unlock offers below it. Two adjacent bugs surfaced while proving the escape is real and are fixed with it: `startWalkGenerationImpl` read `manifest.chromaKey` alone, but the importer stamps the key it used on the RECORD and copies a manifest carrying none — so every fully-locked source-pipeline import reported `MAIN_NOT_LOCKED` ("no frozen chroma key") and refused every Generate; the lookup now falls back manifest → record, the order reference.js already resolves it in at eight sites, with absent-on-both still the genuine refusal. And the render path's anchor/chroma preconditions are now one shared `resolveWalkRenderability()`, so the gate that promises "every direction can be regenerated" and the render path that has to deliver it cannot drift — a predicate checking less than the render requires is exactly how an acknowledgement walks a user into the dead end it promises cannot happen.
+- **[issue-3043] Let a frozen imported walk set be unlocked for regeneration** — a character imported from the source pipeline whose walk set was finalized without its per-run source clips (the phase-1 import shape) had *no reachable action at all*: unlock and reopen both 409'd `LEGACY_IMPORTED_WALK_SET` (nothing to re-derive from), the cycle-target PUT 409'd `WALK_SET_FINAL` (set is frozen), and the workflow header rendered a dead `imported · no clips to re-derive` label with no button behind it — while the drift banner told the user to re-derive. The guard's premise was too narrow: it reasoned only about *re-derivation*, but a walk render is conditioned on the direction's **locked anchor**, so such a set can always be rebuilt from scratch — it just costs a new render per direction instead of a free local repack. `POST /walk/unlock` now accepts `{ acknowledgeNoClips }`, honored only where the server has proven every stranded direction has a locked anchor to regenerate from (an acknowledgement can never be the thing that strands a set — a stranded direction with an unlocked anchor still refuses, with the original error code). `getWalkState` stamps `walkSet.unlock = { blocked, stranded, acknowledgeable }` from the same resolver the gate itself uses, so the button a client offers and the 409 it might hit are computed from one reading of the set; the refusal that *can* be acknowledged past gets its own code (`LEGACY_IMPORTED_WALK_SET_REGENERABLE`) and names that path. The Walk Cycles header replaces the dead label with an **Unlock anyway** panel stating the cost as visible text rather than a tooltip (one new grok render per direction, every approval dropped, nothing deleted on disk), and the Loop Trimmer disables its `CycleTarget` while the set is frozen — it was enabled and 409'd on change — with the same two unlock offers below it. Two adjacent bugs surfaced while proving the escape is real and are fixed with it: `startWalkGenerationImpl` read `manifest.chromaKey` alone, but the importer stamps the key it used on the RECORD and copies a manifest carrying none — so every fully-locked source-pipeline import reported `MAIN_NOT_LOCKED` ("no frozen chroma key") and refused every Generate; the lookup now falls back manifest → record, the order reference.js already resolves it in at eight sites, The postprocess path carried the SAME missing rung (`run.chromaKey || manifest.chromaKey`) and died inside sharp with `Invalid hex color: undefined` on any reprocess of an imported run — a parser complaining about its argument, naming neither the field nor the record behind it. All three sites now share one `resolveChromaKey({ manifest, record, run })` (run → manifest → record), and a genuinely keyless record is refused by name before reaching the color parser. And the render path's anchor/chroma preconditions are now one shared `resolveWalkRenderability()`, so the gate that promises "every direction can be regenerated" and the render path that has to deliver it cannot drift — a predicate checking less than the render requires is exactly how an acknowledgement walks a user into the dead end it promises cannot happen.
diff --git a/server/services/sprites/walk.js b/server/services/sprites/walk.js
index d24e925be4..8aef5452e7 100644
--- a/server/services/sprites/walk.js
+++ b/server/services/sprites/walk.js
@@ -855,6 +855,25 @@ async function setWalkTargetImpl(recordId, { frameCount, fps }) {
* "usable anchor" drifting between them is how a gate ends up promising a render
* the render path then refuses.
*/
+/**
+ * The chroma key a walk operation should key against, most specific first: the
+ * run's own frozen key, then the reference manifest's, then the record's.
+ *
+ * The record rung is not optional garnish — it is the ONLY rung a source-pipeline
+ * import populates (the importer stamps the key it used on the record and copies
+ * a manifest carrying none), and the rest of the sprite code has always resolved
+ * it this way (reference.js does, at eight sites). Reading only the first two
+ * rungs is what made an imported run un-generatable (`MAIN_NOT_LOCKED`) and its
+ * reprocess die inside sharp with `Invalid hex color: undefined` — the same
+ * missing rung surfacing as two unrelated-looking failures.
+ *
+ * Returns null when no rung has one, so callers refuse explicitly rather than
+ * handing `undefined` to a color parser.
+ */
+const resolveChromaKey = ({ manifest, record, run } = {}) => (
+ run?.chromaKey || manifest?.chromaKey || record?.chromaKey || null
+);
+
const lockedAnchorFor = (manifest, direction) => {
const anchor = manifest?.anchors?.find((a) => a.direction === direction);
return anchor?.status === 'locked' && anchor.path ? anchor : null;
@@ -894,7 +913,7 @@ function resolveWalkRenderability(manifest, record, direction) {
error: () => new ServerError(`Lock the ${anchorIdForDirection(direction)} anchor before animating it`, { status: 409, code: 'ANCHOR_NOT_LOCKED' }),
};
}
- const chromaKey = manifest.chromaKey || record?.chromaKey || null;
+ const chromaKey = resolveChromaKey({ manifest, record });
if (!chromaKey) {
return {
anchor,
@@ -1137,17 +1156,25 @@ async function packageRun(recordId, run, overrides = {}, location = {}) {
// parseable duration; leave the field ABSENT in that case rather than
// stamping 0, so "unknown" never reads as "a zero-length clip". A previously
// stamped value survives — a probe that can't run is not evidence of change.
- const [probedSeconds, manifest] = await Promise.all([
+ const [probedSeconds, manifest, record] = await Promise.all([
probeVideoDuration(videoAbs),
loadManifest(recordId),
+ getRecord(recordId),
]);
if (probedSeconds) run.sourceVideoSeconds = Math.round(probedSeconds * 100) / 100;
const anchor = manifest?.anchors?.find((a) => a.direction === run.direction);
if (!anchor?.path) throw new Error(`No locked ${run.direction} anchor in the reference manifest`);
+ // Refuse HERE rather than letting an absent key reach the un-key step, which
+ // reported it as `Invalid hex color: undefined` — a parser's complaint about
+ // its argument, naming neither the field nor the record that lacks it.
+ const chromaKey = resolveChromaKey({ manifest, record, run });
+ if (!chromaKey) {
+ throw new Error(`No chroma key for ${recordId} — the run, the reference manifest, and the record all lack one, so the matte cannot be keyed out`);
+ }
const result = await runWalkPostprocess({
recordId,
direction: run.direction,
- chromaKey: run.chromaKey || manifest.chromaKey,
+ chromaKey,
runAbs,
runRel,
anchorRel: anchor.path,
diff --git a/server/services/sprites/walk.test.js b/server/services/sprites/walk.test.js
index e0327ce243..183a3532b8 100644
--- a/server/services/sprites/walk.test.js
+++ b/server/services/sprites/walk.test.js
@@ -1112,6 +1112,47 @@ describe('imported walk sets — evidence-based re-derive', () => {
expect((await getWalkState(id)).walkSet.unlock).toMatchObject({ acknowledgeable: false });
});
+ /**
+ * The same missing rung, in the OTHER path that keys a matte. `packageRun` read
+ * `run.chromaKey || manifest.chromaKey` — both absent on an imported run — and
+ * handed `undefined` to the un-key step, which surfaced as the parser's own
+ * `Invalid hex color: undefined`: a complaint about an argument, naming neither
+ * the field nor the record behind it. This is the reprocess a user reaches for
+ * the moment their clips ARE on disk, so it has to resolve the record rung too.
+ */
+ it('reprocesses an imported run using the record-level chroma key', async () => {
+ const id = await characterWithLockedAnchors(newId(), ['east']);
+ const runIds = await importedCharacter(id, { east: {} });
+ const manifestPath = join(TEST_ROOT, 'sprites', id, 'reference', `${id}-reference-set-v1.json`);
+ const manifest = JSON.parse(await readFile(manifestPath, 'utf8'));
+ delete manifest.chromaKey;
+ await writeFile(manifestPath, JSON.stringify(manifest));
+ await records.updateRecord(id, { chromaKey: '#FF00FF' });
+ // Reopen so the frozen set stops refusing the re-derive.
+ await reopenWalkDirection(id, { direction: 'east' });
+
+ const run = await rerunWalkPostprocess(id, { runId: runIds.east });
+ expect(run.status).toBe('candidate');
+ expect(run.postprocessError).toBeUndefined();
+ expect(runWalkPostprocess.mock.calls.at(-1)[0]).toMatchObject({ chromaKey: '#FF00FF' });
+ });
+
+ it('names the record when NO rung carries a chroma key, instead of failing inside the color parser', async () => {
+ const id = await characterWithLockedAnchors(newId(), ['east']);
+ const runIds = await importedCharacter(id, { east: {} });
+ const manifestPath = join(TEST_ROOT, 'sprites', id, 'reference', `${id}-reference-set-v1.json`);
+ const manifest = JSON.parse(await readFile(manifestPath, 'utf8'));
+ delete manifest.chromaKey;
+ await writeFile(manifestPath, JSON.stringify(manifest));
+ await records.updateRecord(id, { chromaKey: null });
+ await reopenWalkDirection(id, { direction: 'east' });
+
+ await expect(rerunWalkPostprocess(id, { runId: runIds.east })).rejects.toMatchObject({
+ message: expect.stringContaining('No chroma key'),
+ });
+ expect(runWalkPostprocess).not.toHaveBeenCalled();
+ });
+
// The acknowledgement is an override of the CLIP requirement only — it must
// never become a way to strand a direction that cannot be rebuilt at all.
it('refuses an acknowledged unlock when a stranded direction has no locked anchor', async () => {