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

50.4 KB
Raw Blame

Release v2.38.0

Released: 2026-08-04

Highlights

Quota Burn is a page, not a per-app setting. Unused provider quota now drains through one install-level loop with its own page under Dev Tools, instead of a duplicated block of config inside every managed app — two enabled apps used to run two loops racing for the same window. Each provider family runs an ordered list of jobs with its own type, model and target, and the page tells you exactly why a family will or won't burn on the next tick rather than leaving you to guess. Ten ready-made audit prompts ship with it, each scoped to file issues and change nothing, and burns run on the TUI so you can watch and steer one mid-flight. Every one-click way to spend or destroy something on that page now arms first.

Provider quota readings stopped lying and stopped blocking. A reset time is an instant everywhere now, not whatever wording each CLI happened to print — which had left the entire claude family permanently unburnable behind a message that looked like a provider fault, and grok reporting a window that reset in 2002. Opening the Usage or Quota Burn page no longer waits 20–30 seconds on live scrapes: cached readings serve immediately and refresh behind you, a still-in-flight scrape renders as "reading quota…" instead of a verdict, and each provider card refreshes on its own instead of respawning all of them.

Apps stop reporting things that didn't happen. A failed JIRA sprint fetch used to render as "No tickets assigned to you" and cache that answer for the life of the page; a failed archive fired a green success toast; a running Update vanished the moment you collapsed the row, inviting a second concurrent npm install against the same checkout. All three now say what actually happened — with retry where it helps, a page-level banner that survives navigation, and a server-side guard that refuses the duplicate dispatch. "Open in Xcode" resolves the real project on the server instead of guessing its filename, and unarchiving your last archived app no longer strands you on a blank page.

Agent completion is idempotent. A completed TUI agent could be finalized a second time by the 15-minute health check — overwriting a success with exitCode: 143 and requeueing work that had already shipped. The terminal write now returns early from inside the lock it already holds, a half-written archive can finish rather than blocking every retry, and the "does this process own the agent?" rule that was open-coded (wrong) at two call sites is one named predicate. A manually-triggered perpetual claim drain keeps draining instead of stalling after one item.

Writers Room and pipeline durability. Storyboard scenes carry a durable id instead of an array index, so a reorder landing mid-write can't retarget a render onto the wrong scene, and a rejected write cancels the job it just queued. Concurrent renders no longer clobber each other's job ids. Regenerating over unsaved text shows you a diff and lets you keep your version, manuscript tabs mark which issues hold an unsaved edit, and a format switch flushes pending saves instead of discarding them. Text-stage generation streams its progress over SSE rather than spinning blind for minutes.

Music, City and audio. Game studio music bindings publish into the game repo with the same provenance, overwrite consent and write serialization the artwork lane already had. CyberCity gained a manual soundscape override, moved its ambient music onto the audio clock so it stops drifting under load, and sheds two point lights on the low quality tier. The SongBook drum play-along makes sound on iPhone Safari again — iOS audio sessions are now arbitrated across the app so fixing this couldn't kill the microphone, and every resume path handles the non-standard interrupted state that used to leave a page silently "playing".

Composition over 1,000-line components. Music Video, Round Editor, Universe Builder, the Sprites page, the Writers Room editor and the 987-line /api/universe-builder router all split along their real seams into named hooks, per-concern components and sub-routers — verified behavior-identical (the router split by resolving 520 method+URL combinations against both). Typing in the Writers Room no longer re-renders the storyboard sidebar.

Better audit (2026-08-03). Unsaved edits can no longer be silently lost across the writing surfaces, eight City-scene components stopped leaking GPU buffers, touch targets across City/writers/music meet the 44px convention, and ~90 falsifiability-verified tests landed with it.

Added

  • Quota Burn is now its own page (Dev Tools → Quota Burn) driven by one programmatic loop. It used to be a quota-burn entry in each managed app's taskTypeOverrides, which meant the schedule, the provider windows, and the burn prompt were duplicated per app — and two enabled apps ran two independent loops racing for the same window budget, even though quota belongs to the machine, not to any one repo. There is now ONE install-level loop inside PortOS reading one machine-local plan (data/cos/quota-burn.json), with a full config surface: master switch, poll interval, and per-provider-family reset window / reserve / dispatch cap / priority.
  • Each family runs an ORDERED list of burn jobs, each with its own type, model, and target — so "have codex render every universe bible entry that has no image, and only then fall through to agent work" is expressible. Two job types ship: agent-prompt (the previous behavior — queue a CoS agent in a named managed app, so the work can still target any app) and universe-bible-images, a fully programmatic job that enqueues renders for bible entries whose imageRefs[] is empty, defaulting the render backend to the burning family's own image mode so a codex burn spends codex's image quota. A new job type is three server edits; the config form builds itself from the server's job catalog.
  • The page states, per family, whether it will burn on the next tick and — when it won't — the exact gate that closed (resets in 40h — outside the 24h window, dispatch cap reached (2/2), 62% left is at or below the 70% reserve), evaluated by the same predicate the runner uses. Per-job pending counts, a run log that records skips with reasons, and manual "Evaluate now" / "Burn now" / per-job force-run controls are all on the page.
  • Game studio music bindings can now publish into the game repo, symmetric with the artwork lane. POST /api/games/:id/music/:bindingId/publish copies the bound track's library audio into the managed app repository with SHA-256 provenance, an occupied/diverged-destination guard behind an explicit overwrite acknowledgement, a mid-deploy refusal, and per-repo write serialization shared with the artwork lane (one queue, so artwork and music publishes into the same repo can't race). Music bindings gained an editable repo-relative destinationPath (PATCH /api/games/:id/music/:bindingId, defaulted from the rendered audio filename under game/assets/music/ at bind time), the integrity preflight now reports published/pending state for music exactly as it does for artwork — without changing the manifest-input hash of destination-less legacy bindings, so upgrading alone can't flag an existing bundle stale — and the Assets tab's music rows grew destination editing, a Publish button, and an inline overwrite-consent flow.
  • CyberCity's ambient music mood can now be pinned by hand. The Audio tab of the city settings drawer gained a SOUNDSCAPE select — AUTO plus every mood (bright / neutral / tense) — persisted with the other city settings. AUTO is an explicit null sentinel, so "following live system health and agent activity" is never confused with a pinned mood, and an unrecognized stored value degrades to AUTO rather than freezing the music. A pinned mood re-derives the whole mood half of the soundscape (chord table, filter cutoff, pad detune) while leaving the activity-driven half live, and setting or clearing it re-ramps the running graph immediately instead of waiting for the next system-state change. (#3395)

Fixed

  • [issue-3437] A failed JIRA sprint-ticket fetch no longer reads as "No tickets assigned to you". Expanding a JIRA-enabled app row substituted [] for a thrown request and cached it, so an unreachable instance, an expired token, or a wrong project key all rendered as an authoritative empty sprint — and because the !jiraTickets[id] guard was satisfied by that cached empty array, the page never retried for the rest of its life. Failure now records a message in a parallel ticketErrors map and leaves the ticket entry unset (the null = not fetched vs [] = fetched-and-empty sentinel rule), so the panel renders three distinct states — loading, "Couldn't load sprint tickets — " with a Retry button, and the genuine empty case — and both Retry and a re-expand re-issue the request. A successful empty result is still cached, since JIRA calls are slow and rate-limited. The fetch passes { silent: true } now that this path owns its error UI. The server was swallowing it too — GET /api/jira/instances/:id/my-sprint-tickets/:key called the soft getMyCurrentSprintTickets wrapper and answered 200 [] for an unreachable instance, so no client fix alone could have worked; the route now calls the strict fetchMyCurrentSprintTickets and returns 502 JIRA_FETCH_FAILED (non-UI callers that genuinely want a soft failure keep the wrapper). The app-detail Overview tab ran the same swallow-into-[] fetch on mount and gets the same treatment.
  • [issue-3436] Archiving an app no longer reports success when the request failed. handleArchive / handleUnarchive on /apps swallowed the failure with .catch(() => null) and then fired their success toast unconditionally — so a failed archive showed the red "Request failed" toast from request() immediately followed by a green " archived", and the last one read won. The user was told an app was excluded from CoS scheduling when it was not. Both handlers now gate the toast on a response, matching handleBuild in the same file, and update the row's archived state locally on success instead of waiting for the apps:changed round-trip. The app-detail Overview tab carried the identical bug and is fixed with it.
  • [issue-3435] A running app Update no longer vanishes when you collapse the row or leave /apps, and can't be dispatched twice. The Update / Standardize flow (git pull → npm install → setup → PM2 restart, minutes long) rendered its step log inside the expanded row, and the hook tracking it held isOperating / steps in page state whose unmount tore down the socket listeners — so collapsing the row or navigating away left a long-running operation with no indicator anywhere, and the second dispatch that invited ran a concurrent npm install against the same checkout. The server now owns the in-flight set: a module-level map keyed by app id rejects a second app:update / app:standardize for an app already operating (a re-entrancy guard, not a lock), buffers the steps emitted so far, and broadcasts progress with io.emit instead of replying only to the socket that dispatched. Clients rehydrate from app:operations:active — pushed on connect and on demand via app:operations:list — so a page that mounts mid-operation restores the whole log. /apps renders that state in a sticky page-level banner naming the app (Updating <app>…) above the list instead of inside the row, and a row blocked only by another app's operation now reads Update (busy) rather than being silently greyed out. Operations are tracked per app id, so two apps operating from different tabs each get their own banner instead of one shadowing the other, and the app-detail Overview tab passes its own appId so it still reports only its own operation. The guard also matches on repoPath, since two app records can point at the same checkout; a refused dispatch is flagged duplicate so the client toasts it without marking the healthy run failed; and a completion carrying success: false now reads as a failure instead of "Operation complete".
  • A successful branch-cleanup run is no longer recorded as a failure. The task deletes merged branches in the app's live checkout — its prompt cds to the repo path and runs git branch -d / git push --delete — but it was the only git/gh coordinator type shipping with no taskMetadata at all, so applyAppWorktreeDefault filled useWorktree/openPR from the app's defaultOpenPR: true. Every run got a CoS-managed worktree it never touched (one that holds the very refs it was trying to delete) and a PR expectation it could never satisfy, and finalization scored the completed run pr-missing. The four non-committing coordinator types — branch-cleanup, branch-reconcile, issue-reconcile, jira-status-report — now share one documented taskMetadata posture: useWorktree/openPR explicitly false (not merely absent, which is what let the app defaults in) and locked via MANAGED_AGENT_OPTIONS so a per-app override can't re-attach them, plus worktreeChangesExpected: false, because a clean tree is the success shape for a branch deletion or a posted report and the TUI idle-complete gate must not read it as "the model produced no work". jira-status-report was hit by the same bug for a subtler reason: its readOnly: true skips worktree creation but the finalize-time PR-claim check reads metadata.openPR directly, so a posted report still scored pr-missing. A guard test now iterates NON_COMMITTING_COORDINATOR_TASK_TYPES — the set that already grants these types their commit-criterion exemption — so a future coordinator type can't be added to one list and not the other. Existing installs pick all of this up on the next schedule load: the taskMetadata deep-merge backfills the new keys and enforceManagedAgentOptions rewrites any stored true.
  • [issue-3396] CyberCity's ambient music no longer drifts under main-thread load. The chord changes (every 2400ms) and the 16th-note arp plucks (every 150ms) rode two independent setIntervals that each read ctx.currentTime at fire time — so under load both drifted against the audio clock and against each other, the failure mode the sibling synth players adopted the shared lookahead scheduler to avoid. Both now come off one 16th-note step counter (16 steps per chord, so the arp is phase-locked to the chord changes by construction) and every event is written to the audio clock at an absolute grid time, gridOrigin + step × 0.15s, which cannot accumulate drift. The timing constants come from SYNTH_TIMING in lib/lookaheadTransport.js so the feel stays shared; the transport body itself is deliberately not reused, because it reads its clock from the shared lib/audioContext.js singleton while cityAudioEngine is a documented holdout that owns (and closes) its own AudioContext — scheduling this graph against a clock it doesn't run on would be worse than the drift. A backgrounded tab now re-anchors to the grid on return instead of dumping every missed step into one burst. Generative behavior (chord walk, mood sets, energy-driven arp gain) and the stop-ramp contract are unchanged.
  • A manually-triggered ("Run Now") perpetual claim drain no longer stalls after one item. A claim-issue / claim-work schedule set to perpetual is meant to drain actionable work back-to-back. When the daemon's own scheduler drives it that works, but a manual "Run Now" (RunTaskButton → POST /api/cos/schedule/trigger) did not: the on-demand trigger only gates on the master Improve flag, so the first item ran, but refillPerpetualForCompletedAgent then gated the continuation on canQueueImprovementTasks — which additionally requires idle-review ON and CoS auto-run = execute. Those are exactly the postures in which a user reaches for "Run Now" (auto-run off/dry-run, or idle-review off), so the drain refused to spin up the next item even with a queue of claimable issues. The refill now routes a manual drain through perpetualRefillPlan's onDemand lane: it re-issues an on-demand request for the same task type + app, gated only on the master Improve flag (matching what let the manual run START), and returns before the auto-run-gated queue lane — so a manual perpetual drain keeps draining, scoped to that one type+app (it can't leak unrelated rotation/idle autonomous work past the auto-run kill switch), until the work-detector parks. The on-demand spawn engines mark generated tasks metadata.onDemand (projected onto the agent as taskOnDemand) and forward the completion's ignoreTaskId to addTask, so the re-issued claim isn't rejected as a duplicate of the still-in_progress run that just triggered it. Scheduled perpetual drains are unchanged.
  • [issue-3400] Rendering two storyboard scenes at once no longer loses one of the jobs. enqueueStoryboardSceneVideo, enqueueStoryboardShotStartFrame, and refineStoryboardScenePrompt each read stages.storyboards.scenes up front, then wrote the whole pre-read array back through updateStage. That write is serialized, but the array it shallow-merges was built outside the lock — so two enqueues for different scenes that both read before either wrote would revert each other's freshly-stamped sceneVideoJobId / startFrameJobId, and the losing render would run to completion with nothing left pointing at it. All three now patch a single scene through updateStageWithLatest, so the read-modify-write of scenes happens inside the write region and only the targeted index is replaced. A scene that disappeared between the caller's read and the write now 404s instead of resurrecting itself.
  • [issue-3413] A storyboard scene is now addressed by a durable id, and a rejected render write no longer orphans its job. #3400 stopped two concurrent enqueues from clobbering each other, but scenes were still addressed purely by array index end to end — the route took sceneIndex, the media-job owner encoded scene<idx>, and the write patched scenes[index] — so a reorder or delete landing between a caller's read and its write silently retargeted the job id onto whatever scene now sat in that slot (only the out-of-range case 404'd), and the completion hook routed the finished render by the same stale index, making the mis-targeting consistent rather than self-correcting. Scenes (and shots) now carry a durable id stamped by sanitizeVisualStage and backfilled on existing installs by migration 222 (file store) + db-migration 007 (Postgres); the ids are deterministic (scene-01, collision-escaped) so concurrent readers and federated peers derive identical values. Every write region re-resolves the captured id against the fresh array and returns 409 PIPELINE_SCENE_STALE_TARGET / PIPELINE_SHOT_STALE_TARGET when the target is gone, distinct from the 404 for an index that never existed, with the index kept only as the fallback for pre-migration records. Media-job owners carry the ids too (percent-encoded), and the filename hook still attaches jobs queued under the legacy index-only owner. Separately, all three render surfaces — storyboard scene/shot, comic page slot, and issue/volume covers — now cancel the job they just enqueued when the stage write rejects, instead of leaving it queued with nothing referencing it.
  • [issue-3407] Stacker News sync works again. Stacker News renamed its territory listing route from /recent to /new, so every browser-transport sync was refused with "landed on a different page than the one requested" — the redirect guard correctly caught the rename. Syncs now request the new route directly; the guard stays strict.
  • A completed TUI agent could be recorded as failed by a duplicate finalize. cleanupOrphanedAgents runs every 15 minutes and calls syncRunnerAgents, which only checked runnerAgents for "already tracked" — but a runner-backed TUI agent is owned by the live spawnTuiAgent closure, which registers in activeAgents and never in runnerAgents. Any TUI run outliving one health-check tick was therefore hoisted into runnerAgents mid-flight, so the agent:completed event the runner emits when the TUI spawner's own finish() kills the session slipped past the if (!agent) return guard and ran a second finalizeAgent. That overwrote a sentinel-signalled success with success: false, exitCode: 143 plus a bogus startup-failure analysis (computed from an output buffer that path can't read — a TUI writes output.txt under the dated run dir, not AGENTS_DIR/<id>), which in turn flipped the agent card to Failed and requeued the already-finished task as pending. Observed on a 55-minute release-check run that had already published v2.37.0 and merged all three of its PRs.
  • completeAgent is now idempotent, so the caller-level guard is no longer the only line of defense. Six call sites funnel every terminal agent write through completeAgent, and each carried the same latent "I might be second" assumption. A duplicate call re-recorded result (success verdict, exit code, error analysis) and re-ran the completed-agent directory move; the guards that caught the TUI double-finalize above read the record outside the state lock, so they narrowed the race rather than closing it. completeAgent now returns an already-completed record unmutated from inside the lock it already holds — and skips the budget-ledger charge and the second agent:completed emit that would otherwise re-run the scheduler hand-off. paused records are still completable, so a resumed agent can't wedge. The one thing a duplicate does still do is finish a half-written archive: archiveCompletedAgent is now idempotent (the directory move is skipped once the date bucket exists, the index write always re-runs because saveAgentIndex swallows its own errors), and the cross-filesystem copy fallback rolls back a partially-copied target instead of leaving a directory that every later attempt mistakes for a finished archive.
  • The SongBook drum play-along makes sound on iPhone Safari again — kit and metronome both. Two iOS-only failures stacked into total silence while the transport counted and the playhead scrolled, so nothing on screen explained it. First, iOS leaves a page's Web Audio on the ambient audio session unless it says otherwise, and an ambient session is muted by the hardware ring/silent switch — a pure-synth play-along has no media element to lift it out of one. createLookaheadTransport gained an audioSession option, and the drum player passes 'playback' (Safari 16.4+). That session is arbitrated, not assigned, because it belongs to the DOCUMENT rather than the context and playback marks the page output-only — it refuses capture. PortOS is a single-page app with a globally-mounted VoiceWidget, so a naive "set it when you start playing" breaks twice: it outlives the route that set it, and it collides with a mic that can open on any page at any moment — either way trading this silence for a dead microphone on voice, audioRecorder, and the Songs training views. So acquireAudioSession(type) hands out claims with idempotent releases and declares the union of what's live: capture always wins, since play-and-record satisfies both sides (it ignores the ring/silent switch too, so the play-along stays audible through a voice turn). The transport claims on play and releases on teardown — including the paths where nothing ever sounds: a pause() that cancels a play still awaiting its resume, a rejected resume, and an empty schedule. It stays a per-player capability rather than a transport default because scorePlayback/midiPlayback/metronome share pages with those capture surfaces and have no silent-switch problem to solve. Second, every resume gate in the app read state === 'suspended', and iOS Safari also parks a context in the non-standard 'interrupted' (a call, Siri, the screen locking, another tab taking the session) — so a page returned to after any of those armed its scheduler against a clock that never advanced and "played" in silence until reload. The shared resumeAudioContext(c) now gates on state !== 'running' (skipping only 'closed', whose resume would reject), and all ten resume sites route through it: the lookahead transport (drums, score, MIDI, chiptune), the metronome, layered song playback, the Morse trainer, the stream analyser, the voice client's playback and capture contexts, and the Security page's meter plus its "Enable audio" button — which could previously rescue a suspended context but not an interrupted one.

Changed

  • The chiptune preview loop now shows where it is. ChiptunePanel's Play/Stop row gained a thin progress bar and elapsed/total timecode for the 15–30s loop, driven by a requestAnimationFrame clock that reads the player's transport position and paints straight into the DOM (no per-frame React render). createChiptunePlayer exposes position() + loopSec() for it — the length of the schedule actually sounding, so a mid-preview regeneration can't re-scale the bar against a loop nobody is hearing yet.
  • quota-burn is no longer a scheduled CoS task type. The type, its perpetual work-detector, its programmatic-I/O hooks, and the cramped inline family editor in the CoS schedule tab are all gone. Migration 221 folds every app's existing override into the new global plan (each family's prompt becomes an agent-prompt job pointing back at the app it came from, and an install that never enabled the feature stays silent) and strips the dead task type from data/apps.json. Two apps that configured the same family keep BOTH prompts as ordered jobs — dropping one would silently lose configured work.
  • "Does this process own the agent?" is now one named predicate. Ownership is split across activeAgents and runnerAgents by spawn mode, and which map an agent lands in isn't guessable from its executionMode — a runner-tui agent is driven locally and registers in activeAgents even though the runner owns its process and lists it. That implicit protocol was open-coded at two call sites, one of which had it wrong (above). isAgentOwnedLocally in agentState.js now owns the invariant, and syncRunnerAgents + cleanupOrphanedAgents both call it.
  • handleAgentCompletion bails when the persisted record is already terminal — the same check its post-restart branch has always had — so any double-completion path is a no-op rather than a clobbering re-finalize.
  • The Music Video page is a composition, not a 1,492-line component. Its seven co-located concerns are now six named hooks in client/src/hooks/ (useMusicVideoYoutubeImport, useMusicVideoMidiJob, useMusicVideoRenderJob, useMusicVideoModelSettings, useMusicVideoSceneMedia, useMusicVideoManualTempo) plus seven presentational components in client/src/components/musicVideo/, leaving MusicVideo.jsx at 529 lines of project/scene CRUD and page shell. Behavior is unchanged — same polling flows, settings persistence, and render lifecycle. (#3386)
  • The Sprite Manager page no longer carries its three header panels inline. ImportPanel, NewSpritePanel, and SpriteSearch were independent top-level components sharing Sprites.jsx with the detail/render orchestration; each is now its own file in client/src/components/sprites/, leaving the page at 606 lines of routing, render tracking, and workflow wiring. Pure move — same props, handlers, and markup. (#3390)
  • /api/universe-builder is a directory of sub-routers, not one 987-line file. The 36 endpoints split along the service seams they already delegated to — expand.js, vision.js, styleReferences.js, referenceSheets.js, merge.js, crud.js, render.js, canon.js — behind a thin routes/universeBuilder/index.js, with the zod fragments and image resolvers more than one router composes moved to shared.js. Mount order is the load-bearing part and is documented at the mount: every sub-router owning a single-segment static path (/expand, /duplicates, /merge*, …) mounts ahead of crud.js, whose GET /:id would otherwise swallow it. Verified by resolving 520 method+URL combinations against the old and new routers and confirming every one lands on the same handler. (#3392)
  • Typing in the Writers Room no longer re-renders the storyboard sidebar. WorkEditor's body textarea shared a render with <StoryboardPanel> — a heavy tree of bibles, boards, scene cards, and image config with zero dependency on the prose — so every keystroke re-rendered the whole sidebar. The panel is now memoized and every prop it receives is referentially stable across keystrokes (the run/style handlers are useCallbacks and onJumpToScene reads the body through a ref instead of a dep), leaving one re-render on the clean → dirty flip and none after. Three hooks came out with it — useLiveSuggest, useSidebarResize, useTokenPopover — plus WorkEditorVersions / WorkEditorVoicePanel as their own files. Behavior is unchanged. (#3387)
  • A canon trunk's wiring travels by context, not a 36-prop bag. KindSection inside UniverseCanonSection.jsx took every handler, spinner id, and job map as an individually threaded prop, so adding one capability meant editing the call site, the signature, and its defaults. The bag is now published once per kind through KindSectionContext and read where it's used, and the inline add-entry mini-form moved to CanonAddEntryForm.jsx as a controlled leaf — the typed draft stays with the section, because the toolbar "Add" button is a toggle and collapsing the form has to bring the draft back on reopen. KindSection takes zero props; behavior, markup, and classes are unchanged. (#3388)
  • The Round editor is a composition, not a 1,326-line component. RoundEditor.jsx drops to 164 lines of page shell — header chrome plus the pick between its three body surfaces — with the state split into four named hooks (useRoundViewParams for the ?mode/?stack/?analyze views, useRoundDraft for load/save/refresh-from-template/AI-merge and the baseDirty saved-state gate, useRoundRows for section/layer/reference/proposed-part edits, useRoundPartners for the quodlibet pick list) and the markup into five components in client/src/components/songs/ (RoundEditForm, RoundReadView, RoundSheetMusic, RoundReferenceCard, RoundBuiltInBanner). The draft rules the page, hooks, and form all shared — server caps, the temp-id contract, the tempo band, and the save patch builder — are now client/src/lib/roundDraft.js, and the host-anchored TikTok embed-id helpers moved to utils/urlNormalize.js with tests. Behavior is unchanged. (#3389)
  • agentLifecycle.js imported getAgent aliased as getAgentRecord, shadowing the real transcript-free reader that was split out in #3368 for exactly this purpose. Both call sites read only .status/.metadata, but the alias made them hydrate the record: reading and line-splitting a completed run's whole output.txt (megabytes on a long TUI run) and potentially rewriting metadata.json via repairCodexTaskSummary. Now imports the real getAgentRecord, read once and shared.
  • Universe Builder is a composition shell again. UniverseBuilderPage.jsx drops from 778 to ~530 lines: the URL-backed tab/sub-bucket state (plus the two effects that strip a ?tab=/?bucket= the current categories no longer support) is now useUniverseTabs, and generate-in-bucket / promote-to-canon / auto-sort — each with its own in-flight gate and stale-snapshot merge rules — is now useUniverseBucketActions. The render-completion handler that was copy-pasted between the trunk tabs and the Other tab is one shared callback. Expand/refine already lived in useUniverseExpand, so it stayed put. Behavior, markup, and API calls are unchanged; useUniverseTabs picks up 11 tests. (#3391)
  • Text-stage generation streams its progress instead of spinning blind. A draft-gated prose/script stage can run up to three generate+judge cycles — minutes with no signal — so generateStage now broadcasts phase frames (context build, drafting attempt N of M, judging, best-draft restore, canon extraction) and a per-attempt scorecard over a new SSE channel, and TextStagePanel renders them with PolishPanel's phase-label pattern. The channel is subscribe-first (attaching opens it, so the client can't race the POST it is about to send) and purely advisory: with no subscriber every emit is a no-op, and autoRunner, Series Autopilot, and the volume beat runner call generation exactly as before. (#3393)
  • The CyberCity low tier stops paying for lights it can't show off. A mounted light costs a per-fragment iteration in the lighting loop of every MeshStandardMaterial in the scene no matter how dim it is, so the adaptive-quality low tier could never shed that cost by fading lights out — only by unmounting them. CityLights now gates its two ground-level accent point lights (the green and red warning accents, the dimmest and smallest-radius of the set) behind the same cityShowDetail tier gate the street furniture and trams already use, dropping the low tier from 11 dynamic point lights to 9. Medium tier and above — and any install whose payload predates effectiveTier — render exactly as before. (#3397)
  • Regenerating over unsaved stage edits now shows you the diff first. The dirty gate on text-stage Generate turned "you might lose your edits" into "you can't generate at all" — you had to save or discard first, with no way to see what the new version would have been. Generate is live again while the editor is dirty: it opens an inline confirm row, and the result lands in an InlineDiff against your unsaved text rather than in the textarea. "Use new version" applies it, "Keep my edits" leaves your text exactly as typed (still dirty against the newly persisted output, so Save pushes your version back over it). The generated stage is lifted to the parent either way — the server persisted it, so history stays truthful — and switching issue/stage drops a pending comparison. (#3398)

Better audit 2026-08-03 (UX, City scene, game/music/writing focus) — PRs #3401–#3404

  • Writers room / pipeline: unsaved edits can no longer be silently lost — text-stage Generate, every analysis/extract trigger, and the storyboard bible refreshes gate on saved state; the work and manuscript editors warn before tab close; the bible trio collapsed into one shared BibleSection (−350 lines) with the missing input labels fixed
  • City scene: geometry-disposal leaks fixed across eight components (status flips, polls, and dim toggles were stranding GPU buffers), data-rain/embers respect the adaptive quality tier with count-keyed geometry remounts, and the ambient synth fades out instead of popping on mute/unmount
  • Music: chiptune generate/render/publish are mutually exclusive; album/artist/track delete confirms use the shared ConfirmButtonPair; Music page tabs adopt shared TabPills with canonical /music/:tab deep links
  • Routes: writersRoom/sprites/musicVideo/games lists support opt-in pagination; rounds + songbook partial updates move to PATCH; rounds sanitizers extracted to server/lib/roundsValidation.js; universeBuilderRefine reuses lib/jsonExtract
  • Touch targets: City HUD, writers dock, and music surfaces meet the 44px convention
  • ~90 new falsifiability-verified tests across the changed surfaces; creative-director autopilot runs gain a 45-minute idle backstop
  • Manuscript issue tabs show which issues hold an unsaved edit. Sections only persist onBlur, so typing in issue 3 and tabbing to issue 7 left the pending text with no cue anywhere on screen. The saved-content baselines the unload guard already tracked are now state rather than a bare ref, so the tab strip subscribes to them: an issue with content drifting from its last server-confirmed save gets a dot (and an "unsaved edits" tooltip) that clears when the save lands — and stays put when the save fails. (#3399)
  • Switching manuscript formats no longer discards an unsaved section edit. Sections save onBlur, but a format switch replaced the whole section list — and its baselines — so an edit that hadn't blurred (or whose save had failed) was dropped, and switching back refetched the server's older text. The switch now flushes pending saves first and aborts if one fails, leaving the text and its tab dot on screen. Saves are also queued per section, so the blur save and the switch's flush can't PATCH the same text twice and snapshot a redundant version. (#3399)
  • "Continue Today's Routine" no longer dead-ends on the drill you just finished. The handler navigated straight to the top recommendation's deep link with no check that it pointed somewhere else — and a sub-50% run makes the drill just missed the very item the scheduler resurfaces first, so Continue on Element Flash re-navigated to the URL already in the address bar and left the completion panel untouched. A self-referential recommendation now restarts the drill in place: a run nonce goes into the query string (preserving unrelated params like Morse's ?ref=) and flows into the key of every surface the handler drives — Elements, Morse, Wordplay, and memory practice — so the drill remounts for a fresh run. Recommendations pointing elsewhere navigate exactly as before, and the comparison is path-only so a deep link carrying its own query string is still recognized as self-referential. (#3428)
  • Quota-burn plan editor: nothing spends or destroys on one click any more. The row's ▶ force-dispatched the job past the window/reserve/cap gates on a single click, sitting in a strip of small icons on a page that has no Save button — so it reads as "save" and got hit by accident. It now arms first, like the row's delete (and arming either disarms the other). Two more one-click losses went with it: the job-type picker no longer wipes params, so clicking through it can't silently destroy a long work prompt, and a preset asks before overwriting prompt text the user wrote. The page header now says "Changes save automatically" / "Saving changes…" — the missing feedback that sent people hunting for a save button in the first place. The step-name box also stopped using the job-type label ("Agent prompt") as its placeholder, which made it look like a second prompt field next to the real Work prompt, and a collapsed family card now shows its job count so "healthy window, no plan" is visible without expanding.
  • Quota-burn work prompts ship with presets. A burn window is spent unattended, so a blank "what should this provider spend its remaining quota on?" textarea was the weakest part of the feature. Ten ready-made prompts (server/lib/quotaBurnPresets.js, served in the config catalog) each run ONE narrow audit — UX, accessibility, mobile, failure paths, performance, test gaps, dead code, data/upgrade safety, docs drift, security — the single-focus form of /do:better --issues: read real code in a bounded slice, de-dupe against open issues, file at most five decision-complete GitHub issues, change nothing. They run in the app's own checkout with no worktree at all — they read code and file issues, so there is nothing to isolate, and useWorktree: true + openPR: false is in fact the auto-merge posture (the agent's branch is merged onto the managed app's default branch on success, unreviewed), meaning "isolating an audit for safety" would hand it a way to land code. Instead agent-prompt gains two distinct never-lands-code params (both default false, so jobs meant to land code are unchanged): noCodeOutput — the deliverable is what the agent DOES during the run, used by the presets — and discardWorktree, for a job that does want a scratch checkout (to build or test) whose contents must never land. Either one forces openPR/simplify off (an openPR that can never produce a PR makes the spawner report pr-missing and retry, burning up to five agent runs per window) and marks a clean tree as success. noCodeOutput also strips every commit/push/PR instruction from the prompt — including the Git Hygiene arm that told a no-worktree task to /do:push to the branch it is standing on, which for a task in the app's live checkout is its default branch; that arm also covered the Creative Director agents, which run in the same shape. The shared contract also requires scratch files go to mktemp, that the run leave the tree and branch exactly as it found them (it is the user's working copy), and that secrets, hostnames, and personal records are redacted before anything is filed — an issue is world-readable the moment it exists. There is a curl fallback so a gh network failure doesn't end the window having filed nothing. Add one from a family card ("Add a preset job", inheriting the plan's app) or a job row ("Start from a preset"). Presets are templates — picking one copies the text into the job, so editing a preset never rewrites a configured job on any install.
  • Quota Burn opens instantly, and the claude family can finally burn. Two bugs, both on the page's critical path. (1) normalizeResetAt fed the provider's reset string straight to Date.parse, which claude's Aug 4 at 1:59pm (an " at " separator, a meridiem glued to the minutes, and sometimes no minutes at all — Jul 7 at 2pm) returns NaN for, so EVERY claude window read as "no window states a reset time" and the family was permanently unburnable — invisibly, since that reason looks like a provider fault. A year-less reset (grok's August 10, 06:07) had the mirror problem: Date.parse resolves it to 2001, so the roll-forward fired against a date 25 years back and landed on 2002, leaving grok reporting "window already reset" forever. The string is now reshaped before parsing and the year stamped from now in the provider's own zone — before the DST offset lookup, which is a per-year table. (2) A status read blocked on a live quota reading: measured 30s to open the page after five idle minutes and 21s on the first load after a restart, for a 10-20s PTY spawn per provider family, over percentages that move by single digits an hour. Page load is now ~9ms in both cases. Every cycle also logs its verdict now — "Evaluate now" previously left no trace in the server log at all, so a cycle that correctly declined was indistinguishable from one that never ran. (Follow-up #3433: the two adapters that emit a raw CLI reset string rather than ISO should normalize in the adapter, which is also why the Usage page still prints Aug 4 at 1:59pm unlocalized.)
  • Slow provider readings are stale-while-revalidate, in one place. server/lib/staleWhileRevalidate.js — createStaleWhileRevalidate({ ttlMs, failureBackoffMs?, isComplete?, partialTtlMs? }) → read(key, produce, { wait }) — replaces the hand-rolled TTL+in-flight caches in providerUsage.js (TUI scrapes) and claudeCodeUsage.js, which had drifted into two shapes of the same tricky async contract. A cached reading is served immediately and refreshed behind the caller; only a cold cache waits. Three things the naive version got wrong are now handled once: a background revalidation resolves {value}|{error} so an unawaited rejection can't kill the process; a failure keeps the last good value AND records failedAt, so a broken producer backs off instead of being respawned by every caller (serve-stale without that degrades into one subprocess per request exactly when the subprocess is broken); and PENDING is terminal — a cold cache whose producer already failed throws rather than promising a reading that is never coming, which a poller would wait on forever. wait is one three-state enum (fresh / cached / never) rather than the two booleans it started as, because "give me a live reading but don't wait for one" has no meaning and encoding it as flags forces a precedence rule at every layer that threads them.
  • A quota status read never blocks — on either page. /api/quota-burn and /api/usage/providers answer a cold cache with pending: true cards; the UI renders "reading quota…" and polls (via the shared useAutoRefetch, so it pauses on a hidden tab) until the readings land. pending is its own state ahead of the verdict everywhere it is rendered: on a Quota Burn family card, and on the Usage page's ProviderQuotaCard, which would otherwise have shown a pending provider as "No rate-limit data reported" — a verdict about the provider rather than a statement about a scrape still in flight. It fails closed in the burn gate ladder, ahead of the error branch and holding even under force, so a card with no numbers on it can never become a burn candidate. ?refresh=1 — the Refresh button, and every runner cycle about to spend real quota — still waits for a live reading.
  • Quota-burn agents run as TUI, so a burn can be watched and steered. A burn runs unattended for minutes on the user's own subscription, and the family's provider was picked with a plain find over the enabled CLI/TUI providers — which returns the CLI, because that is what sorts first. Every dispatch therefore went to a headless run that could only be read after it finished. The picker now prefers the TUI (the same preference pickScrapeProvider applies when reading /usage), so the agent shows up in Active Agents with a live terminal. Two selection bugs came out with it: the whole agy family was unreachable — its providers ship as antigravity-cli/antigravity-tui, neither of which contains "agy", so a configured Antigravity plan reported "no enabled CLI/TUI provider" forever while the quota card above it showed a healthy window (the card's matcher checks the command; the burn picker only checked the id, and now checks both) — and an ollama-backed wrapper was eligible: claude-ollama-tui matches the claude family and is a TUI, but it runs a local model, so burning through it spends nothing and lets the window it was meant to drain expire unused. resolveEnabledFamilies already excludes those from the quota cards for the same reason; the burn picker now excludes them too, explicit pin included.
  • A provider's reset time is an instant, not the wording its CLI happened to use. Two of the four quota adapters put a raw panel string on the wire — claude's Aug 4 at 1:59pm plus a separate timezone field, grok's year-less August 10, 06:07 — so the Usage page printed those two verbatim while codex and agy rendered properly: the same field, formatted two ways on one screen, with no localization and no relative time. The parsing stays in server/lib/quotaReset.js but is now exported as parseHumanReset(str, { now, timezone }) and called from parseLimitLine and parseGrokUsage, so resetsAt is ISO 8601 (or null when unreadable) for all four families and a fifth provider's dialect belongs in its own adapter rather than in the shared choke point. Both parsers take now explicitly, as parseAgyUsage already did. normalizeResetAt keeps its wall-clock fallback — a reading off an older federated peer still carries the raw string and must not regress to "no window states a reset time" — but every in-tree adapter now hits its hasExplicitZone fast path. The Usage page localizes the instant and adds the countdown (Aug 4, 1:59 PM (in 3h)). (#3433)
  • Unarchiving your last archived app no longer strands you on a blank Apps page. The Active/Archived toggle only rendered while at least one archived app existed, and showArchived was local state with nothing to reset it — so unarchiving the last one unmounted the only control on screen and left a permanently empty "No archived apps" card, recoverable only by navigating away and back. The filter now lives in the URL (/apps?view=archived), so the archived list is linkable and reload-safe; the toggle stays mounted while the archived view is open even once it empties (reading Active (N)), and the empty state gained a "Back to active apps" button. (#3434)
  • "Open in Xcode" opens the actual project instead of guessing its filename. The button built <display name>.xcodeproj on the client and navigated to an xcode:// URL, so any app whose display name wasn't byte-identical to its project on disk ("My Client" → MyClient.xcodeproj) got a path that doesn't exist — and a custom-scheme navigation reports nothing either way, so the click was a silent no-op, doubly so from a phone where the scheme isn't registered at all. The new POST /api/apps/:id/open-xcode resolves the real target the same way the Xcode script generators do (deriveProjectInfo: project.yml name: → the *.xcodeproj on disk → the sanitized app name), prefers a .xcworkspace over the .xcodeproj it wraps, and opens it on the machine Xcode is installed on. A swift SPM package — which has no .xcodeproj at all — falls back to its Package.swift, and a repo with none of the three comes back as a 404 naming everything it looked for, so the click always ends in a visible toast. (#3438)
  • Each provider card on the Usage page refreshes on its own. Every family's reading is an independent 10-20s CLI/TUI scrape, so the single "Refresh" button made re-checking one provider cost a spawn for all of them — and reset every other card's reading age in the process. GET /api/usage/providers now takes ?family=<id>, getProviderQuotas({ family }) resolves just that card (the derived image-gen card included), and each card carries its own refresh control that swaps in only its own result. A family that no longer resolves — its provider was disabled since the page loaded — comes back as an empty list and the card is dropped rather than left with a reading it can never refresh again. The section button is now "Refresh all".

Upgrade notes

  • Migration 223 re-keys the quota-burn dispatch ledger. The per-window dispatch counter — the cap that bounds how much subscription an unattended burn can spend — changed its key from the exact reset epoch to the hour it rounds into, so a provider reporting its reset a few seconds apart between reads lands in one bucket instead of two. Same file, different keys, which would have left an already-exhausted window reading zero on the first boot after upgrade and free to spend a whole extra cap inside itself. The migration carries the counts across (summing two old keys that fold into one bucket, since both were really spent) rather than dropping the ledger, which would read as zero for the same reason.
  • Migration 221 fails closed on the old arming switch. An absent, entry-less, or unparseable task-schedule.json now reads as not armed — matching the shipped enabled: false default rather than assuming consent — and the schedule prune is the last write it performs, so a migration that dies partway through can't have its re-run mistake the entry it already deleted for permission to start burning.

Full Changelog

Full Diff: https://github.com/atomantic/PortOS/compare/v2.37.0...v2.38.0