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): make the idle-loop guard test actually pin the guard
[._.]/ Adam Eivy368cb1519c61
diff --git a/.changelog/v2.36.0.md b/.changelog/v2.36.0.mdindex 9884c17039..b69d456f72 100644--- a/.changelog/v2.36.0.md+++ b/.changelog/v2.36.0.md@@ -92,6 +92,7 @@ Released: 2026-07-31## Fixed+- **Publishing a sprite picker idle now tells you what to create instead of failing with a server error.** The publish form offers the picker-idle destination unconditionally, but `idle-loop` is a user-authored animation track — since animation types became user-defined, no install ships one. On any install that had not created it, publishing failed with a raw "Unknown animation track" error naming PortOS internals. It now returns the same clear prerequisite message the not-yet-approved case already gave.- **CoS TUI agents detect claude's input prompt again.** The restart-survival work (issue 3202) moved TUI agents onto a runner that launches the coding CLI directly on its own PTY — no wrapping shell. Two startup checks still assumed the old shell-wrapped launch: input-readiness waited for the launch shell to toggle bracketed-paste mode off before the CLI's own "input ready" signal counted (so every runner-launched claude died `tui-not-ready` after 45s with a live input box on screen), and the pre-paste liveness probe asked whether the shell had a live child process — a question that misreads a healthy directly-launched CLI as exited. Both now recognize the direct-launch mode: the CLI's own paste-mode signal is trusted as ready, and liveness is left to the PTY exit event.- **[issue-3223] Published sprite atlases now expose frame counts uniformly for custom animation tracks.** A consuming game can read a user-authored track's declared frame-count field from both the atlas manifest and its layout sidecar, just as it already could for walk, scanner, and ambient tracks; tracks with no known count remain omitted.- **Sprite correction notes are no longer ignored on regenerate.** Typing a correction on a sprite re-roll ("hip bag should be on the other leg") and hitting Regenerate produced a render essentially identical to the one you'd just rejected. The note was being sent — it was losing an argument inside the prompt. Every regenerate prompt spends several sentences pinning the render to the attached reference ("keep accessories on the same anatomical side", "treat the turnaround panels as the source of truth"), and the correction was one trailing sentence asking to change exactly that, phrased as an edit to the *attached* image rather than a fix in the image being produced — so the model sided with the bulk of the prompt. Corrections now frame the render up front, before any preservation rule is read, and close it with an explicit override. Verified on the reported case: the note that had left the sprite unchanged now moves the bag on both samples. A blank note still produces a byte-identical blind regenerate on every surface (turnaround, main, the 7 directional anchors, walk, and every animation track including user-defined ones).@@ -122,8 +123,6 @@ Released: 2026-07-31- **[issue-3194] Consolidated the AI-CLI child-environment composition.** Ten spawn sites each rebuilt the same environment tuple by hand (provider env vars, the OpenCode declared-models map, the working-directory pin, the nested-session strip, and the pm2 guard shim for agents), so every environment-level fix had to sweep all ten and a missed site failed silently — which is exactly what happened to the OpenCode fix once already. `buildCliChildEnv` now owns the full child env and `composeProviderEnv` the ordered layers for sites that hand off a partial env, both preserving each site's original precedence. A discovery-based test fails when a new spawn site composes the environment by hand instead of routing through them.-- **Publishing a picker idle answers a missing `idle-loop` track as a prerequisite, not a server error.** The publish form offers the picker-idle destination unconditionally, but `idle-loop` is a user-authored track — since animation types became user-defined, no install ships one. On any install that had not created it, publishing failed with a raw "Unknown animation track" registry error instead of the intended message telling you what to create.-- **Three test suites stopped depending on state outside the code under test.** The Layered Intelligence outcome suite pinned its fixtures to absolute dates but read them back through a 30-day retention window measured against the real clock, so on 2026-07-31 twenty tests failed on a tree nobody had touched; its clock is now frozen. Two sprite suites asserted the exact list of animation tracks against the *live* registry, so they turned red on any machine whose operator had authored a track of their own — they now assert the shipped set and the keyed-by-id contract instead.## Full Changelogdiff --git a/server/services/sprites/animationTracks.test.js b/server/services/sprites/animationTracks.test.jsindex ccdace0aea..c028db8078 100644--- a/server/services/sprites/animationTracks.test.js+++ b/server/services/sprites/animationTracks.test.js@@ -288,8 +288,12 @@ describe('registry-derived source reference and primacy (#3136)', () => {// non-directional one has no anchor to read at all — a place record never// generates directional anchors.expect(sourceReferenceFor(WALK_TRACK)).toBe('anchor');- expect(sourceReferenceFor(SCANNER_TRACK, EFFECTIVE)).toBe('anchor');- expect(sourceReferenceFor(AMBIENT_TRACK, EFFECTIVE)).toBe('main');+ // SHIPPED, not EFFECTIVE — these name the seed's own flags, and the seed's+ // `_comment` says every row in it may be retuned or deleted. Read from the+ // live table, an operator deleting `scanner` (a supported edit) reds a test+ // about the shipped contract that they never touched.+ expect(sourceReferenceFor(SCANNER_TRACK, SHIPPED)).toBe('anchor');+ expect(sourceReferenceFor(AMBIENT_TRACK, SHIPPED)).toBe('main');// Reads the row it's HANDED, not the shipped table.expect(sourceReferenceFor('ambient', { ambient: AMBIENT_TRACK_ROW })).toBe('main');expect(() => sourceReferenceFor('unknown')).toThrow(/Unknown animation track/);@@ -298,16 +302,16 @@ describe('registry-derived source reference and primacy (#3136)', () => {it('answers which track a record kind publishes off', () => {// ONE definition, shared by the publish-contract schema (which field is// required) and the compile dispatch (which evidence chain to validate).- expect(primaryTrackForKind('character', EFFECTIVE)?.id).toBe(WALK_TRACK);- expect(primaryTrackForKind('place', EFFECTIVE)?.id).toBe(AMBIENT_TRACK);- expect(primaryTrackForKind('object', EFFECTIVE)?.id).toBe(AMBIENT_TRACK);- expect(primaryTrackForKind('props', EFFECTIVE)?.id).toBe(AMBIENT_TRACK);+ expect(primaryTrackForKind('character', SHIPPED)?.id).toBe(WALK_TRACK);+ expect(primaryTrackForKind('place', SHIPPED)?.id).toBe(AMBIENT_TRACK);+ expect(primaryTrackForKind('object', SHIPPED)?.id).toBe(AMBIENT_TRACK);+ expect(primaryTrackForKind('props', SHIPPED)?.id).toBe(AMBIENT_TRACK);// A short action a record can't publish off alone is never the primary.- expect(primaryTrackForKind('character', EFFECTIVE)?.id).not.toBe(SCANNER_TRACK);+ expect(primaryTrackForKind('character', SHIPPED)?.id).not.toBe(SCANNER_TRACK);// Absent/unknown answers null rather than defaulting to a kind.- expect(primaryTrackForKind('nope', EFFECTIVE)).toBeNull();- expect(primaryTrackForKind('', EFFECTIVE)).toBeNull();- expect(primaryTrackForKind(undefined, EFFECTIVE)).toBeNull();+ expect(primaryTrackForKind('nope', SHIPPED)).toBeNull();+ expect(primaryTrackForKind('', SHIPPED)).toBeNull();+ expect(primaryTrackForKind(undefined, SHIPPED)).toBeNull();});});@@ -430,18 +434,21 @@ describe('per-track clamps', () => {expect(clampTrackFps(99)).toBe(24);});+ // Both clamp tests read SHIPPED: they assert the seed's own numeric bounds, so+ // against the live table an operator who retunes `scanner.maxFrameCount` — the+ // seed invites exactly that — would red a test about the shipped defaults.it('clamps scanner values against scanner bounds', () => {- expect(clampTrackFrameCount(99, SCANNER_TRACK, EFFECTIVE)).toBe(8);- expect(clampTrackFrameCount(-1, SCANNER_TRACK, EFFECTIVE)).toBe(2);- expect(clampTrackFps(99, SCANNER_TRACK, EFFECTIVE)).toBe(12);- expect(clampTrackFps(-1, SCANNER_TRACK, EFFECTIVE)).toBe(2);+ expect(clampTrackFrameCount(99, SCANNER_TRACK, SHIPPED)).toBe(8);+ expect(clampTrackFrameCount(-1, SCANNER_TRACK, SHIPPED)).toBe(2);+ expect(clampTrackFps(99, SCANNER_TRACK, SHIPPED)).toBe(12);+ expect(clampTrackFps(-1, SCANNER_TRACK, SHIPPED)).toBe(2);});it('clamps ambient values against the ambient range', () => {- expect(clampTrackFrameCount(99, AMBIENT_TRACK, EFFECTIVE)).toBe(6);- expect(clampTrackFrameCount(-1, AMBIENT_TRACK, EFFECTIVE)).toBe(2);- expect(clampTrackFps(99, AMBIENT_TRACK, EFFECTIVE)).toBe(12);- expect(clampTrackFps(-1, AMBIENT_TRACK, EFFECTIVE)).toBe(2);+ expect(clampTrackFrameCount(99, AMBIENT_TRACK, SHIPPED)).toBe(6);+ expect(clampTrackFrameCount(-1, AMBIENT_TRACK, SHIPPED)).toBe(2);+ expect(clampTrackFps(99, AMBIENT_TRACK, SHIPPED)).toBe(12);+ expect(clampTrackFps(-1, AMBIENT_TRACK, SHIPPED)).toBe(2);});});diff --git a/server/services/sprites/presentationIdle.test.js b/server/services/sprites/presentationIdle.test.jsindex 3bd4dc2e6a..966648b6a4 100644--- a/server/services/sprites/presentationIdle.test.js+++ b/server/services/sprites/presentationIdle.test.js@@ -1,14 +1,29 @@import { describe, expect, it, vi } from 'vitest';import sharp from 'sharp';-// The registry table this module consults, pinned to a install that never-// authored an `idle-loop` track — the default state of every install, since-// #3152 made every non-walk track user-defined. Reading the real table would-// make the assertion below depend on whichever tracks THIS machine happens to-// have authored.+// The registry this module consults, pinned to an install that never authored an+// `idle-loop` track — the default state of every install, since #3152 made every+// non-walk track user-defined. Reading the real table would make the assertion+// below depend on whichever tracks THIS machine happens to have authored.+//+// `effectiveTrack` is mocked ALONGSIDE the table, not just the table: it is the+// call the guard protects (getTrackState resolves the id through it), and+// spreading `importOriginal()` would otherwise hand back the real function+// closed over the real module-scope registry — so on a machine that HAS authored+// `idle-loop` the un-guarded path would resolve, fall through to the+// not-yet-approved branch, and throw the SAME status+code, leaving the test+// green with the guard deleted. That is the exact machine-dependence this+// suite's sibling fixes exist to remove.+const NO_IDLE_LOOP = { walk: { id: 'walk' } };vi.mock('./animationTrackStore.js', async (importOriginal) => ({...(await importOriginal()),- getEffectiveAnimationTracks: () => ({ walk: { id: 'walk' } }),+ getEffectiveAnimationTracks: () => NO_IDLE_LOOP,+ effectiveTrack: (id) => {+ if (!NO_IDLE_LOOP[id]) {+ throw new Error(`Unknown animation track '${id}' — known tracks: ${Object.keys(NO_IDLE_LOOP).join(', ')}.`);+ }+ return NO_IDLE_LOOP[id];+ },}));import {@@ -80,9 +95,14 @@ describe('presentation idle strip', () => {// through the registry throws a bare Error naming the known tracks — a 500// about internals. It must arrive as the same 422 the not-yet-approved case// gets, so the UI can tell the user what to create.+ // The MESSAGE is asserted, not just status+code: the not-yet-approved branch+ // below the guard throws an identical 422/PRESENTATION_IDLE_TRACK_REQUIRED,+ // so status+code alone cannot tell "the track does not exist" from "it exists+ // but isn't approved" — and would pass with the guard removed.await expect(buildPresentationIdle('rec-1')).rejects.toMatchObject({status: 422,code: 'PRESENTATION_IDLE_TRACK_REQUIRED',+ message: expect.stringContaining("Create an animation track named 'idle-loop'"),});});});