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

61.0 KB
Raw Blame

Release v2.21.0

Released: 2026-06-14

Added

  • Long memories are summarized to fit the embedding context instead of truncated — so search sees the whole conversation — Plain truncation embeds only the first ~5k chars of an over-budget record, so for a long ChatGPT chat (≈1/3 of a typical import exceed the budget) everything after the opening is invisible to semantic search. Now, when a record overflows the embedding model's context, PortOS first asks a larger-context local model (the Brain default provider/model — gpt-oss:20b on a typical install) to compress it to an embedding-sized gist and embeds that, so the vector represents the entire record. For a ChatGPT-import record it summarizes the full archived transcript (via sourceRef), not the capped preview — fixing both the embedder overflow and the import's content cap in one pass. Within-budget records embed directly (no extra LLM call); if no summarizer provider is configured or the call fails, it falls back to truncate-and-retry so the record still gets an embedding. (server/services/memorySummarizer.js, server/services/memoryEmbeddings.js, server/services/brainMemoryBridge.js)

  • Train a LoRA for any universe-bible subject — objects and places, not just characters — LoRA training datasets were hardwired to a universe's characters; you couldn't build an adapter for a signature weapon, artifact, or location. Datasets now carry an entryKind (characters / objects / places) alongside the entry id, so the find-or-create / reassignment key is the full (universeId, entryKind, entryId) tuple — the same entry id can own one dataset per kind, and a run can't re-own a dataset that was reassigned to a different kind. The "New dataset" and "Reassign" dialogs gain a Subject type select (the picker reads universe[entryKind] and resets the entry when either the universe or the kind changes); the generate-batch dialog relabels its variation axes per kind (Expressions/Outfits for characters, Lighting/Settings for objects & places) and the prompt builder renders single-object / single-location training prompts (with kind-specific negative prompts) instead of the character figure layout. The record sanitizer defaults a missing entryKind to characters, so existing datasets and older clients keep working with no migration. (server/lib/loraDataset.js, server/services/loraDatasets.js, server/services/loraDatasetGenerate.js, server/services/loraTraining/{index,sidecar}.js, server/routes/loraDatasets.js, client/src/components/loraTraining/{UniverseCharacterPicker,GenerateBatchDialog,TrainingPanel,CharacterLoraChip}.jsx, client/src/pages/{LoraTraining,LoraDatasetDetail}.jsx, client/src/services/apiLoraTraining.js)

  • Choose your embedding provider + model in Brain config, and reprocess on demand — Memory's semantic search (pgvector) was hardwired to LM Studio with a fixed embedding model name, so an install running Ollama got silent embedding failures — records imported/captured fine but landed with a NULL embedding (unsearchable), and there was no UI to point embeddings elsewhere. Brain → Config gains an Embeddings (semantic search) card: pick the embedding provider (any OpenAI-compatible backend — Ollama, LM Studio, …) and model (e.g. nomic-embed-text on Ollama, 768-dim — matches the vector(768) column), with a live reachability/model-present status line and a Reprocess all embeddings button that re-embeds every brain record (the existing bridge-sync?refresh path, which drains sequentially in the background). The embedding service is now provider-aware: the LM-Studio-only model discover/load dance (/api/v0/models + /api/v1/models/load) is skipped for other backends (which serve /v1/embeddings directly and don't implement those endpoints — previously it 404'd every call and never latched), and a non-LM-Studio provider's configured model id is authoritative instead of being guessed from a substring match. (server/services/memoryEmbeddings.js, client/src/components/brain/tabs/ConfigTab.jsx)

  • Import your whole ChatGPT export — images, voice clips, and files included — The Brain → Import ChatGPT wizard now takes the entire export .zip instead of just conversations.json, removing the old 50 MB upload cap (the JSON was parsed in the browser and POSTed as a body; the ZIP streams straight to your PortOS like the Apple Health importer, with no size limit). It handles the modern multi-file export (conversations split across conversations-NNN.json shards) and extracts every asset — the .dat image / voice-audio / PDF files — into a served directory, sniffing each file's real type from its magic bytes and naming it from the export's asset map. Each conversation's archived transcript is rendered as markdown with inline images (image_asset_pointer parts resolve to the extracted image), plus 🔊/🎙️ links for voice clips and 📎 links for attached files; assets ChatGPT omitted from the export degrade to a plain placeholder rather than a broken link. Imported conversations render rich in Brain → Memory with a View full conversation viewer (the Memory entry keeps a truncated preview; the full thread + assets live in the archive). A lone conversations.json still works as before (just without images). (server/services/chatgptZipImport.js, server/services/chatgptImport.js, server/routes/brainImport.js, server/lib/fileUtils.js, server/index.js, client/src/components/brain/tabs/ImportTab.jsx, client/src/components/brain/tabs/MemoryTab.jsx, client/src/components/brain/ConversationViewer.jsx, client/src/components/cos/MarkdownOutput.jsx, client/src/services/apiBrain.js)

  • Jump to the Importer from the Series Pipeline — with the universe & series carried over — Starting a series and realizing you already have a manuscript no longer means hunting for the Importer. The Series Pipeline index gains an Import button beside New Series, the create form carries an inline "Already have a manuscript? Import it instead" link (deep-linking your in-progress universe + typed series name), and a series detail page gains an Import action that opens the Importer pre-targeted at that universe and series. The Importer's Universe Name and Series Name fields are now autocomplete comboboxes — the same match-or-create UX as the Universe creator — so you land an exact match instead of guessing the spelling; the series picker is scoped to the matched universe (its existing series, or type a new name). Deep links resolve via ?universeId=…&seriesId=… (with raw universe/series name params as a fallback), where a seriesId also pins its parent universe so the pair can't drift. The autocomplete itself is extracted into a shared EntityCombobox (the Universe creator's selector now wraps it). (client/src/components/EntityCombobox.jsx, client/src/pages/Importer.jsx, client/src/pages/Pipeline.jsx, client/src/pages/PipelineSeries.jsx, client/src/pages/UniverseBuilder.jsx)

  • Generate an author headshot from the persona's description + style — The Authors editor's headshot field gains a Generate button alongside Upload and Choose from gallery: it folds the author's physical description (the subject) and headshot style (the art direction) into one portrait prompt and renders through the existing image-gen system, dropping the result straight into the headshot slot. The button stays disabled until at least one of those fields is filled. While a render is in flight the thumbnail shows the live diffusion preview and step percentage (async local/codex backends), and the Upload / gallery / URL controls lock so a manual choice can't be clobbered when the render lands; the synchronous external SD-API backend lands the image directly. Switching authors mid-render cancels the in-flight tracking so a completed (or still-pending) render can't write the wrong persona's headshot. (client/src/pages/Authors.jsx)

  • Author personas — manage reusable authors and pick one for a series — Create gains an Authors page (/authors, reachable from the sidebar and ⌘K) for managing reusable author personas: each carries a name, writing style, bio, a physical description and a headshot style (the prompt inputs for generating a book-cover author headshot), plus an optional headshot image you can upload (a photo from your device), choose from your image gallery (the same searchable picker the image-gen page uses), or paste a URL into — with a live thumbnail preview and one-click clear. The Series Pipeline's author field — previously a free-text byline on both the create form and the series bible — is now an author picker that lists your personas: selecting one stores the persona link (authorId) and the denormalized byline string on the series, so covers and title screens still render the right name. Picking "— No author —" clears it; a legacy free-text byline with no linked persona is shown as a hint until you link one. Authors are stored in PostgreSQL (authors table, db-primary) and federate across your machines (see the next entry). (server/services/authors/, server/routes/authors.js, server/scripts/init-db.sql, server/lib/db.js, server/services/pipeline/series.js, client/src/pages/Authors.jsx, client/src/components/pipeline/AuthorPicker.jsx, client/src/services/apiAuthors.js, client/src/components/Layout.jsx, server/lib/navManifest.js)

  • Author personas sync across federated peers — Authors are now a first-class cross-machine sync category. Turn on Authors under a peer's sync settings (Instances page) and your personas — name, writing style, bio, physical description, headshot direction, and the headshot image itself when it's a gallery image — replicate to that peer: creating an author auto-subscribes it to every authors-enabled peer, each edit pushes the LWW-merged record, and a delete propagates as a tombstone (then garbage-collects once every subscribed peer has acked it). Built on the same per-record peer-push pipeline as media collections (not the 60s snapshot loop), with full version-gating — a peer on an older PortOS that predates author sync is detected and the authors category pauses for it (every other category keeps flowing) until it upgrades. A merge conflict (both machines edited the same author) is archived to the Conflicts tab. Gallery-picked headshots transfer their bytes; uploaded-from-device headshots sync the record but not yet the bytes (tracked as a follow-up). (server/services/authors/{logic,db,file,index}.js, server/lib/syncWire.js, server/lib/schemaVersions.js, server/lib/conflictJournal.js, server/lib/peerSyncValidation.js, server/services/sharing/peerSync.js, server/services/sharing/tombstoneGc.js, server/services/instances.js, server/routes/instances.js, client/src/pages/Instances.jsx)

  • LoRA dataset grid: collapse captions, click-to-preview, and full-height thumbnails — The dataset workbench image grid (/media/training/:id) gets three usability fixes. A Hide captions / Show captions toggle collapses every card's caption editor and action row at once, so you can scan the whole dataset as a clean thumbnail wall. Clicking any thumbnail now opens a full-size preview lightbox (← / → to step through the ready images, Esc to close) — the same affordance the media galleries already have. And thumbnails render at their natural aspect ratio (fixed column width, full relative height) instead of a fixed square crop, so portrait and landscape training images are no longer sliced off at the top and bottom. (client/src/components/loraTraining/DatasetImageGrid.jsx)

  • Describe a canon character / place / object from reference image(s) — Each canon card in the Universe editor (Cast, Places, Objects) gains a Describe from image(s) button (the scan-text icon next to Render). Upload one reference image to turn it into an image-gen-ready prose description, or several images of the same subject (a character from multiple angles, a location across lighting conditions) and a vision model returns the description common to all of them — ignoring incidental differences like pose, background, and framing. You pick the provider + model on demand in the modal (only API/vision-capable providers are offered), edit the generated prose before applying, and it writes straight into the entry's descriptor field (physicalDescription for characters, description for places/objects) — the same field the render prompt reads. Vision runs through the existing API runner's image_url content-block path; the new runPromptThroughProvider({ screenshots }) arg threads images through the shared runner, and the stateless POST /api/universe-builder/describe-from-images endpoint resolves an API provider (clear NO_API_PROVIDER error if none is configured) and builds the per-kind vision prompt. (server/services/universeVisionDescribe.js, server/routes/universeBuilder.js, server/lib/promptRunner.js, client/src/components/universe/VisionDescribeModal.jsx, client/src/components/pipeline/CanonCard.jsx, client/src/components/universe/UniverseCanonSection.jsx)

  • Live LoRA training progress — watch the adapter learn, sample by sample — A running training job used to show only a progress bar, a status line, and a single 32×32 thumbnail of the most recent preview. The active-run panel (/media/training) now renders a live sample gallery: a large current preview with its step label, a scrollable step-keyed thumbnail strip to scrub back through every earlier sample (so you can spot the moment a run starts to diverge), a loss sparkline that builds up over the session, and step / elapsed / ETA metrics. Samples merge two sources so a mid-run browser reload still shows the full timeline — a one-shot seed from a new GET /api/lora-training/runs/:id/samples endpoint (every preview persisted so far) plus the live SSE frames since re-subscribe. To drive the curve and key the thumbnails without re-parsing display strings, the trainer's STEP/SAMPLE line protocol now carries structured loss and step fields through the media-job SSE wire (additive — image/video gen frames are unaffected). (server/services/loraTraining/progress.js, server/services/loraTraining/checkpoints.js, server/services/loraTraining/index.js, server/services/mediaJobQueue/index.js, server/routes/loraTraining.js, client/src/components/loraTraining/LiveSampleGallery.jsx, client/src/components/loraTraining/TrainingPanel.jsx)

  • /do:next hot button on the app manage page — The Agent Operations panel on an app's Overview tab gains a /do:next button alongside /do:push, /do:review, /do:replan, and the rest. One click queues a CoS agent that claims the next unclaimed PLAN.md item, works it in an isolated worktree, and ships a PR — the consumer counterpart to /do:replan. The bundled slashdo submodule was updated to the latest release (which ships the do:next command). (lib/slashdo, client/src/components/apps/SlashDoPanel.jsx, server/routes/cosTaskRoutes.js)

  • Add canon characters / places / objects by hand — Each canon section in the Universe editor (Cast, Places, Objects) now has an Add button next to "Pick from Catalog" — the same manual-add affordance the variation buckets already had. Click it, type a name (and optionally a description), and Save mints a new canon entry you can immediately render, refine, and fill in. The entry lands unlocked (so its inline editors are usable right away), dedupes case-insensitively against existing names, and persists through the same optimistic-append path as the catalog picker — so you no longer have to extract from prose, pick from the catalog, or promote a variation just to start a character. (client/src/components/universe/UniverseCanonSection.jsx)

  • More suggested vision models for LoRA captioning — Settings → Local LLM's "Image Analysis" category only suggested LLaVA 7B, so a user looking for a captioner had nothing better to install and could end up pointing the captioner at a reasoning model (which then burns its whole token budget thinking and returns an empty caption). The catalog now ships the VLMs actually recommended for dataset captioning: Qwen2.5-VL 7B (the recommended default) and 32B (best detail on high-memory machines), Llama 3.2 Vision 11B, MiniCPM-V 2.6 8B, and Moondream 1.8B (tiny/fast) — each installable in one click on Ollama (and LM Studio where a well-known GGUF build exists). (server/lib/localLlmCatalog.js)

  • Character LoRA training — train consistent character adapters from your universe canon — Create → Media Gen gains a Training tab (/media/training) that closes the loop from "character exists in a universe" to "every render of that character looks the same." Per character, a dataset workbench builds reference material three ways: batch-generate single-subject training renders from the character's canon descriptors (deterministic view/pose/expression/outfit variation matrix, queued through the normal image lane), upload your own images (normalized to PNG via sharp), or slice the character's existing reference-sheet turnaround into grid crops. A vision-LLM captioner (same provider pathway as the voice agent's visual describe) auto-captions every image prefixed with the character's trigger word, with per-image caption editing and re-captioning. Once ≥10 captioned images are ready, train a FLUX.2 Klein LoRA locally through one of two engines, picked automatically: mflux's MLX-native trainer (mflux-train, mflux ≥0.17 — wrapped by scripts/train_mflux_lora.py, preferred on Apple Silicon; the dataset stages in mflux's NNNN.png+NNNN.txt auto-discovery layout, and quantize/low-ram knobs derive from total RAM so a 48 GB machine trains QLoRA-style instead of OOMing) or a vendored torch/diffusers+peft trainer (scripts/train_flux2_lora.py — bf16 bases only, precompute-then-free text/VAE encoding, gradient checkpointing) as the fallback. Either engine exports diffusers-format adapters. Training runs ride the media-job GPU lane (serialized with renders, SSE progress with per-step loss, mid-training sample previews, 30-min idle watchdog, cancel saves a checkpoint). The finished adapter lands in data/loras/ with a sidecar carrying the character link + trigger word + size-variant compat key (flux2-4b/flux2-9b), so it appears in the existing LoRA library and picker with the right base-model gating immediately. Auto-apply: pipeline comic-page and storyboard renders that match a character with a trained LoRA automatically attach the adapter and weave its trigger word into the prompt (local mode; per-stage opt-out in Generation settings). Character cards in the universe editor and catalog detail pages show a trained-LoRA chip + dataset entry point; trained LoRAs in the library link back to their dataset. Datasets are machine-local (like the LoRA files themselves — never federated) and fully backed up; training checkpoints/caches are excluded as regenerable. Run records live in PostgreSQL (lora_training_runs). (server/services/loraTraining/, server/services/loraDatasets.js, server/services/loraDatasetGenerate.js, server/services/loraDatasetCaption.js, server/services/characterLoraResolver.js, client/src/pages/LoraTraining.jsx, client/src/pages/LoraDatasetDetail.jsx)

  • Video LoRAs — install LTX-2 LoRAs from HuggingFace and fuse them into Video Gen renders — LoRA support now extends past image models to the dgrauet ltx2 video runtime. A new "Install video LoRA from HuggingFace" box on the LoRA Manager (/media/loras) takes any HF repo URL or org/name id (e.g. fal/ltx2.3-audio-reactive-lora), fetches the repo metadata, picks the .safetensors, auto-detects the video family from the repo id / tags / base_model (LTX-Video → ltx-video), and writes a sidecar — the HuggingFace analogue of the existing Civitai installer (gated repos use your HuggingFace token from Image Gen settings). Video Gen (/media/video) gains a LoRA picker that appears only on an LTX-2 (ltx2) model, filtered to the ltx-video family, with per-LoRA strength and a trigger-word append button — the same component the Image Gen page uses. Selected LoRAs fuse into the transformer via the pipeline's _pending_loras hook (the exact mechanism upstream's ltx-2-mlx generate --lora CLI uses), so they apply across every mode — text, image, FFLF, extend, and audio-to-video — including multi-chunk chains. Applied LoRAs are stamped into the video-history entry and round-trip through the resume/Remix flow. Only the ltx2 runtime can fuse LoRAs today; the route and service reject LoRAs on the legacy mlx_video / wan22 / hunyuan runtimes with a clear error. (server/lib/huggingfaceLora.js, server/services/loras.js, server/routes/loras.js, server/services/videoGen/local.js, server/routes/videoGen.js, scripts/generate_ltx2.py, server/lib/runners.js, client/src/lib/runnerFamilies.js, client/src/pages/VideoGen.jsx, client/src/pages/Loras.jsx)

  • Suggested video LoRAs + Image/Video filter on the LoRA Manager — The LoRA Manager (/media/loras) only suggested image LoRAs (Civitai per-runner-family), so a video LoRA like fal/ltx2.3-audio-reactive-lora was reachable only by knowing its repo and pasting it into the install box. A new Video LoRAs section now surfaces a curated quick-install list of HuggingFace LTX-Video LoRAs alongside the Civitai suggestions — one click installs through the HF path with the right family pre-stamped. An All / Image / Video filter at the top of the page narrows both the suggestion panel and the installed list by media type, so a video-focused session isn't buried under image suggestions. Curated video cards mark themselves "Installed" by matching the installed sidecar's HF repo, and installed video LoRAs now link back out to HuggingFace from their card. The curated list enriches each card with HuggingFace metadata best-effort (description/preview) and degrades to the static card on a fetch failure, caching for an hour like the Civitai panel. (server/services/videoLoraSuggestions.js, server/routes/loras.js, server/services/loras.js, server/lib/runners.js, client/src/lib/runnerFamilies.js, client/src/pages/Loras.jsx)

Changed

  • LoRA training runs in GPU-cooldown segments to survive the macOS watchdog kernel panic — Three separate FLUX.2 LoRA training runs hard-rebooted this machine with an identical watchdog timeout: no checkins from watchdogd kernel panic, each a couple of checkpoints into sustained GPU compute (the new-silicon GPU-driver hang tracked in docs/research/2026-06-13-mflux-training-watchdog-panic.md) — so no run had ever completed. The mflux trainer now runs in checkpoint-sized segments (default ON): it trains one save interval, terminates the mflux child so its Metal/GPU context is fully torn down, idles the GPU for a cooldown (default 90 s), then --resumes the newest checkpoint for the next segment. mflux resume reads num_epochs from the checkpoint (the config value is ignored on resume), so segmentation is numerically equivalent to one continuous run — it just never lets sustained GPU pressure span the whole run, and resets any accumulated driver/thermal state between segments. The child is killed only after the trainer steps past the boundary, so the boundary checkpoint is guaranteed fully flushed (no truncation) and resume loses at most one in-flight step. Disable globally — e.g. once a macOS/mflux update fixes the driver hang — with settings.loraTraining.segmentation = false; tune the gap with segmentCooldownSec. (scripts/train_mflux_lora.py, server/services/loraTraining/runtimes.js, server/services/loraTraining/index.js, server/lib/validation.js)

  • Reassign a LoRA training dataset to a different universe character — A dataset was permanently bound to the character you picked when you created it — a mis-pick (or a character you later renamed/restructured) meant deleting the dataset and rebuilding all its images from scratch. The dataset workbench header (/media/training/:id) now has a Reassign button next to the character name: pick a different universe + character and the dataset's images, captions, and trigger word all move with it (the trigger word is left as-is — edit it separately if the new character needs its own token, which re-prefixes captions as before). Reassigning onto a character that already owns a dataset is refused (one dataset per character), reassignment is blocked while a training run is in flight, and the picker is the same universe→character cascade the "New dataset" dialog uses, factored into a shared UniverseCharacterPicker. (server/services/loraDatasets.js, server/routes/loraDatasets.js, client/src/pages/LoraDatasetDetail.jsx, client/src/components/loraTraining/UniverseCharacterPicker.jsx, client/src/pages/LoraTraining.jsx)

  • LoRA dataset workbench now coaches toward a quality target, not just the 10-image floor — The readiness summary only knew two states ("add more" / "ready to train"), so a barely-trainable 10-image dataset looked just as finished as a strong 25-image one. The workbench now tracks a recommended quality target (~20, sweet spot 20–30) alongside the hard MIN_TRAINING_IMAGES floor: the count badge turns amber while trainable-but-thin and green once it clears the target, the sub-label tells you exactly how many more captioned images are recommended, and the Train panel echoes the same nudge. A new collapsible "Tips for a strong character dataset" panel spells out the variety that actually matters — vary angle, framing (face close-ups + full-body), pose, expression, outfit, lighting, and background; keep it single-subject and on-model; drop blurry/near-duplicate frames. The Generate batch dialog now defaults to 20 images (was 12) and notes the sweet spot inline. Advisory only — the server still trains any dataset that clears the 10-image gate. (server/lib/loraDataset.js, client/src/pages/LoraDatasetDetail.jsx, client/src/components/loraTraining/TrainingPanel.jsx, client/src/components/loraTraining/GenerateBatchDialog.jsx)

  • LoRA dataset caption fields auto-size to their content — Each image card's caption box was a fixed 3-row textarea, so anything longer than ~3 lines was clipped behind an internal scrollbar (and you had to drag the corner to read it). The caption field now grows to fit its full caption by default — no scrolling, no manual resize — with a comfortable minimum height for short/empty captions. Factored into a reusable useAutoSizeTextarea hook + AutoSizeTextarea component for any future auto-growing field. (client/src/components/loraTraining/DatasetImageGrid.jsx, client/src/components/ui/AutoSizeTextarea.jsx, client/src/hooks/useAutoSizeTextarea.js)

  • LoRA dataset workbench gains a "Re-caption all" button — re-run every caption through a new model — "Caption all" already skips images that already have a caption (it only fills in the uncaptioned ones), so there was no one-click way to re-run a whole dataset through a freshly-picked vision model. A new Re-caption all button next to it sends overwrite: true, re-captioning every ready image with the model chosen in the caption-model picker (overwriting existing captions, including manual edits — the button's tooltip says so). The single-image "Re-caption" button already overwrote one image; this extends the same intent to the whole set. (client/src/pages/LoraDatasetDetail.jsx)

  • Resume a killed LoRA training run from its last checkpoint — and see a failed run's samples — A training run that got interrupted (an app restart, a manual cancel, a crash partway through) was a total loss: the panel showed only the error, hid the checkpoint picker (it rendered for completed runs only), and the only path forward was to start over from step 0 — re-spending all the GPU time the run had already banked. Two changes recover that work. (1) The Train panel now surfaces the checkpoint picker for any run that saved a checkpoint, not just completed ones — so you can scrub the failed run's sample previews to judge how far it got, and "Use this" still salvages a partial checkpoint into a usable LoRA. (2) A Resume training button re-launches a failed/canceled run from its newest checkpoint via the new POST /api/lora-training/runs/:id/resume — it re-enqueues a job against the same run id (mflux bakes the output path into its checkpoint zip and restores the optimizer + adapter state and step counter from --resume <zip>, so the resumed trainer must write back into the original run dir; a fresh dir would strand its artifacts where the watcher can't see them). New checkpoints and samples append to the existing timeline, and finalize registers the LoRA as usual. Resume works for both local training engines: mflux (--resume <zip>) and the torch FLUX.2 trainer (--resume-from <dir>) each restore the optimizer state and step counter, so a resumed run picks up mid-training and continues toward its original step total instead of over-training from a fresh optimizer or re-colliding checkpoint step numbers. (server/services/loraTraining/index.js, server/services/loraTraining/checkpoints.js, server/routes/loraTraining.js, scripts/train_flux2_lora.py, client/src/services/apiLoraTraining.js, client/src/components/loraTraining/TrainingPanel.jsx)

  • LoRA training picks the best checkpoint instead of blindly deploying the final step — and you can promote any checkpoint by eye — A FLUX.2 character LoRA could finish "successfully" yet render garbage: the trainer always handed back the FINAL step's adapter, but late training divergence (a recurring FLUX.2 failure — the loss keeps dropping while the sample image collapses to a near-black frame) made that final step the worst one. Loss is no guide here; on the run that motivated this it was anti-correlated with quality (the lowest-loss checkpoint was visually broken). Two changes close the gap: (1) a collapse guard at finalize analyzes each checkpoint's preview (sharp entropy + per-channel stdev) and, when the final preview is a degenerate near-black/near-uniform collapse, deploys the latest healthy checkpoint instead and flags the run for review — calibrated with a wide margin (a real frame measured entropy 5.5–7.1 vs the collapse's 2.8) so it never vetoes a legitimate image; (2) a new checkpoint picker under a completed run (/media/training) shows every saved checkpoint as a preview thumbnail with its step + loss, and a "Use this" button re-extracts that step's adapter and overwrites the deployed LoRA in place — the human override for subtler degradation the guard leaves alone. Per-checkpoint loss is now captured at checkpoint time, and lib/zipStream gains extractZipEntryToBuffer to crack one adapter out of an mflux checkpoint zip long after the trainer exited. The final debounced checkpoint/sample now flush to the run record before finalize reads it, so the guard always sees the last artifacts. (server/services/loraTraining/checkpoints.js, server/services/loraTraining/index.js, server/lib/zipStream.js, server/routes/loraTraining.js, client/src/components/loraTraining/CheckpointPicker.jsx)

  • LoRA training defaults tuned down to avoid divergence — The default training recipe drove the divergence above: at 1000 steps / learning-rate 1e-4 the sample collapsed by ~step 500 while the loss kept falling. Defaults are now 600 steps, lr 5e-5, 768px (up from 512 — a 4K source crushed to 512 loses the face), with checkpoint/sample cadence tightened to every 150 steps so the picker has more healthy steps to choose from. Existing installs that pinned their own settings.loraTraining.defaults keep them. (server/services/loraTraining/runtimes.js)

  • CoS system jobs can now pin their own AI provider + model — Each autonomous "System Task" (Chief of Staff → Jobs) gains an optional AI Provider & Model picker in its create and edit forms, so a heavy refactor job can run on Opus while a lightweight triage job runs on a cheaper/local model — independently, per job, instead of every job inheriting the single active provider. The override is forwarded into the generated task's metadata on both the scheduled and manual-trigger paths, where the agent runner already honors metadata.provider/metadata.model. Leaving the picker on its defaults preserves the prior behavior (active provider, per-task model selection). Only AI-agent jobs show the picker; shell/script jobs never reach the AI runner. A pinned provider is now resolved before the active-provider availability gate, so a job pinned to a healthy provider runs even when the globally active provider is down or unset. (client/src/components/cos/tabs/JobsTab.jsx, server/services/autonomousJobs/crud.js, server/services/autonomousJobs/skillTemplates.js, server/services/agentProviderResolution.js, server/routes/cosJobRoutes.js, server/lib/validation.js)

  • LoRA captioning now guarantees a vision model, lets you pick it, and can pull from your gallery — Auto-captioning a training dataset used to silently send images to whatever model the local backend defaulted to; a text-only model would fail every image with a cryptic Model does not support images 400. The captioner now resolves (and validates) a vision-capable model up front: it auto-picks the first installed vision model across Ollama + LM Studio, and fails the whole run with one actionable message if none is installed — instead of N per-image errors. A new caption-model picker on the dataset workbench lists your installed vision models (each tagged with its backend) and persists the choice to settings.loraTraining, so "Caption all" and per-image re-caption both use it; "Auto" defers to the auto-pick. Vision capability is detected from explicit backend metadata when available (LM Studio's type: 'vlm', Ollama's vision capability) and an id heuristic otherwise (isVisionModel, mirrored client-side). And a new "From gallery" button imports images you've already generated/saved straight into the dataset (multi-select, copied independently so deleting the gallery original won't strand the dataset). (server/lib/localModelHeuristics.js, server/services/loraDatasetCaption.js, server/services/loraDatasets.js, server/services/localLlm.js, client/src/components/loraTraining/CaptionModelPicker.jsx, client/src/components/loraTraining/ImportGalleryDialog.jsx)

  • [issue-1214] Staged upload images no longer pile up on disk — init and reference images you upload for edit/image-to-image renders are now cleaned up automatically once they're a week old and no longer used by any saved image, so repeated edit-from-upload renders stop quietly growing your data folder.

Fixed

  • Long memories embed reliably (no more "input exceeds context length" NULLs), and oversized transcript cards stop overflowing the page — Two issues surfaced reprocessing a large ChatGPT import. (1) The embedder truncated input to a flat 8000 chars, but small local embedding models like Ollama's nomic-embed-text cap at a 2048-token context, and dense transcripts (code/JSON/non-English) run ~3 chars/token — so the longest conversations overflowed and embedded to NULL (unsearchable). The embedder now budgets input against the model's real context (embeddingMaxTokens, default 2048) at a conservative chars-per-token with headroom, and if the backend still reports an overflow it halves and retries before giving up; a batch that overflows falls back to per-item embedding so one oversized member can't null the whole batch. (2) In Brain → Memory, an imported conversation containing a long unbroken code block (e.g. a giant binary string) blew the card's width out and pushed its action buttons off-screen — the content row now shrinks correctly (min-w-0 so unbreakable content wraps instead of expanding) and the transcript preview is height-capped with an internal scroll. (server/services/memoryEmbeddings.js, server/services/memoryConfig.js, client/src/components/brain/tabs/MemoryTab.jsx)

  • Bulk brain-record creates no longer fire a thundering herd of embedding calls — The Brain→Memory bridge (which mirrors every brain record into the pgvector memory table so agents can semantically search them) handled each {type}:upserted event inline with a fire-and-forget syncBrainRecord — fine for human-paced single edits, but a bulk producer like the new ChatGPT import (creating ~1,400 conversations back-to-back) fired that many :upserted events in a tight loop, launching ~1,400 concurrent embedding HTTP calls + Postgres writes. That saturated the embedding backend (most calls time out and the embedding is swallowed to null, so the records persist silently unsearchable) and exhausted the PG pool. The peer-sync sync:applied path already solved this with a debounced (250 ms) + sequential + deduped queueResync drain; the direct entity events now route through that same machinery. Because queueResync re-reads each record's canonical stored state (resyncBrainRecord), the archived/deleted/tombstoned branches are handled uniformly and a now-stale event payload still converges correctly. (server/services/brainMemoryBridge.js)

  • Test runner can no longer write to the real portos database through a transaction (the last guard hole) — The query() row-write backstop added in the previous incident fix guarded only PortOS's own pool wrapper, but withTransaction() hands its callback a raw pg client whose client.query() bypasses query() entirely — and nearly every store mutation (updateAuthor/deleteAuthor/mergeAuthorsFromSync, universe runs, catalog, writers-room, story-builder, creative-director) issues its INSERT/UPDATE/DELETE inside a transaction. So a suite running under VITEST against the real portos DB (a CoS-agent worktree with NODE_ENV unset, or any non-DB suite that reaches a transaction write path) still wrote straight into production, unguarded — the DB-backed *.db.test.js suites skipped correctly via checkHealth(), but the transaction door was wide open. Fix: the shared backstop is factored into assertWriteAllowed() and withTransaction() now wraps its client in a Proxy that runs every client.query() through it (the SQL is read from both the string and { text } call forms; BEGIN/COMMIT/ROLLBACK and SELECT … FOR UPDATE pass through). Verified: a transaction INSERT against portos under VITEST now throws Refusing to mutate and leaves no row, while all 14 DB-backed suites (109 tests) still pass against portos_test. (server/lib/db.js, server/lib/db.guards.test.js)

  • Test runner can no longer write fixtures into — or wipe — the real portos database when NODE_ENV isn't test — A CoS agent running the server test suite in its worktree wrote test fixtures (Test Work writers-room works, Issue 1/Old B pipeline issues, X/B universes, u-1/u-B universe-runs, stb-* story-builder sessions) straight into the shared production Postgres, and the DB suites' DELETE FROM … cleanup hard-deleted the user's real universes, series, and writers-room work. Root cause: the test-runner safety gate in server/lib/db.js keyed only on NODE_ENV==='test'. The agent's wrapper left NODE_ENV unset/development, so checkHealth() did not report disconnected, the DB-backed *.db.test.js suites ran against the real DB instead of skipping, and the query() backstop only blocked DELETE/TRUNCATE — letting INSERTs leak while cleanup DELETEs threw and stranded them. Fixes: a new isTestRunner() detects the runner via NODE_ENV==='test' or process.env.VITEST (set in every vitest worker), so a misconfigured NODE_ENV can't disarm the gate; checkHealth() and the query() backstop both use it; and the backstop now refuses all row writes (INSERT/UPDATE/DELETE/TRUNCATE), not just deletions, against a non-test database under the runner. Verified: with NODE_ENV=development, writersRoom/db.test.js + seriesStore/db.test.js now skip against the prod DB and write nothing; the full main suite (11,251 tests) leaves the prod DB byte-identical; npm run test:db (99 tests on portos_test) still passes. (server/lib/db.js, server/lib/db.guards.test.js)

  • LoRA training stops oversubscribing unified memory — frees resident models, spills the latent cache to disk, and refuses to start when memory is too tight — On a 128 GB Apple-Silicon box a single mflux FLUX.2 run pushed the machine to ~122 GB used + ~21 GB swap, and that swap-thrash coincided with the GPU watchdog reboots above. Three changes keep a run inside the unified-memory pool. (1) Pre-train reclaim — before spawning the trainer, PortOS unloads every model resident in Ollama and LM Studio (best-effort; failures are ignored) so their memory returns to the pool instead of stacking under the run. Only loopback-local backends are touched — a remote OLLAMA_URL/LM_STUDIO_URL (a LAN peer in a federated setup) is left alone, since evicting it would free no local memory. (2) Latent cache always spills to disk — the mflux low_ram flag is now on at every memory tier; keeping the encoded dataset cache in RAM bought nothing but the swap pressure, and disk-backing it costs only I/O, no training quality. (3) Headroom gate — the quantize/low_ram tier is now derived from the post-unload available memory (measured via vm_stat on macOS, free + inactive + speculative + purgeable) rather than raw RAM, so a busy box auto-tightens to a smaller base; and a run refuses to start with a clear error when under ~24 GB is free, rather than crashing the box mid-run. (server/services/loraTraining/memoryPrep.js, server/services/loraTraining/runtimes.js, server/services/loraTraining/index.js)

  • LoRA training now survives a mid-run machine crash and self-instruments for GPU forensics — Two GPU watchdog-timeout kernel panics (watchdog timeout: no checkins from watchdogd in 90 seconds) hard-rebooted the machine during mflux FLUX.2 training in a single day on M5 silicon (Mac17,7/T6050, macOS 26.5) — a system-level Metal/GPU hang, not a PortOS bug. Two changes make training resilient to it: (1) a checkpoint crash-resilience floor — save_frequency is now capped at ceil(totalSteps/4) (MFLUX_MIN_CHECKPOINTS) even when the user picks "only final save" (checkpointEvery: 0) or a huge interval, so a hard reboot loses at most ~¼ of a run instead of everything; resume from the newest checkpoint as before. (2) Each run streams powermetrics --samplers cpu_power,gpu_power,thermal into <run>/powermetrics.log so the next crash leaves a forensic record of GPU temp/power leading up to the hang — gated on a non-interactive sudo -n probe so it no-ops cleanly (training unaffected) when passwordless powermetrics isn't configured. The incident, analysis, and an investigation checklist are documented in docs/TROUBLESHOOTING.md ("GPU watchdog kernel panic during LoRA training") + docs/research/2026-06-13-mflux-training-watchdog-panic.md. (server/services/loraTraining/runtimes.js, scripts/train_mflux_lora.py, docs/TROUBLESHOOTING.md, docs/research/)

  • Postgres pool no longer throws spurious "timeout exceeded when trying to connect" — On a single-user box that periodically runs heavy local workloads (Ollama model pulls, CoS agents), establishing a fresh loopback connection could briefly exceed the 2s connectionTimeoutMillis, surfacing pool connection errors against a perfectly healthy Postgres. The connect timeout is raised to 10s (absorbs busy moments while still failing fast on a real outage) and max connections bumped 10→20 so concurrent in-process work isn't starved while one connection is slow to establish. (server/lib/db.js)

  • DB-adapter test suites run again — against a throwaway portos_test, never your real data — Blocking the test runner from the production portos database (previous fix) left the 12 DB-backed adapter suites skipping everywhere: CI has no Postgres, and locally they're now refused on the real DB — so the universe/series/issue/story/writers-room/catalog/media DB layer had effectively zero executed coverage. This restores it the safe way. npm run setup:db:test provisions a throwaway portos_test database (creates it + applies init-db.sql), and npm run test:db runs just the DB-backed suites against it via a dedicated vitest.config.db.js that runs them serially (fileParallelism: false) so suites truncating the same tables can't clobber each other. CI now spins up a pgvector/pgvector:pg17 service and runs those suites against portos_test on every PR — the default npm test still skips them (no test DB in scope), so nobody needs Postgres to run the rest of the suite and nobody's real portos is ever touched. A drift guard in db.guards.test.js fails if a new checkHealth()-gated suite is left out of the DB config (silently losing coverage). (server/scripts/setup-db-test.mjs, server/vitest.config.db.js, server/lib/db.guards.test.js, .github/workflows/ci.yml, server/package.json, package.json)

  • Tests can no longer wipe your real universes, series, and writing — and every deletion is now audited — The DB-backed *.db.test.js suites (universe, pipeline series/issues, story builder, writers room, catalog, creative director, media index) connect to the single real portos Postgres whenever it's reachable and run DELETE FROM … in their setup, restoring a snapshot afterward. Because git worktrees share that one database, a CoS agent running the suite in its worktree wiped all 12 universes + 4 series + the writers-room works when its process was torn down before the restore finished (the snapshot/restore swallowed every error). Two new guards in server/lib/db.js close this off: (1) checkHealth() reports "disconnected" under NODE_ENV=test against any non-test database, so every db-backed suite skips cleanly instead of deleting — a database is "safe for destructive tests" only when its name ends in _test (e.g. portos_test) or TEST_DB_OK=1 is set (isTestDatabase()); (2) query() is a hard backstop that throws on DELETE FROM / TRUNCATE under the test runner on a non-test DB even if a suite reaches it without gating first. Separately, a new record_audit table + generic DB trigger now logs every tombstone, un-tombstone, and hard-delete of user-authored content (universes, pipeline series/issues, story-builder sessions, writers-room works/folders/drafts, catalog ingredients/scraps/types, creative-director projects, LoRA runs) — captured at the database layer so it records deletions from any source (the app, a stray test, a manual psql), with the old row snapshot kept for recovery and the originating SQL for forensics. Inspect it with node scripts/show-deletions.mjs. (server/lib/db.js, server/scripts/init-db.sql, server/lib/db.guards.test.js, server/lib/db.catalogDdlParity.test.js, scripts/show-deletions.mjs)

  • Opening a LoRA dataset whose universe was deleted no longer spams the server log with ❌ Route error — The dataset workbench (/media/training/:id) speculatively fetches the dataset's character.universeId ({ silent: true }) to pre-load the canon character's variation axes. When that universe has since been deleted, the lookup 404s — harmless, and the client already swallows it — but the server logged every 404 as ❌ Route error [GET /api/universe-builder/<id>]: Universe not found, and since the page reconnects every ~20s it logged the same line on a loop. GET /api/universe-builder/:id now tags a not-found result severity: 'warning', so the error middleware skips the log line (and the client's error-toast hook already drops warnings) — matching the existing benign-404 precedent for speculative media-job archive lookups. (server/routes/universeBuilder.js)

  • A gated-model LoRA training failure now shows a one-click "Request access" link, like image rendering already does — Training a FLUX.2 Klein LoRA pulls a different, separately-gated HuggingFace repo than rendering does (the mflux trainer resolves flux2-klein-9b → black-forest-labs/FLUX.2-klein-base-9B, whereas inference uses FLUX.2-klein-9B). So a user who'd accepted the inference model's license — and whose stored token is otherwise valid, with canReadGatedRepos — still hit a GatedRepoError the instant training started, with no obvious next step. Image rendering already turns this into an actionable banner with a deep link to the license page; training now does the same. The failure classifier extracts the gated owner/repo from the trainer's stderr (both the Access to model … is restricted and Cannot access gated repo for url … forms), persists it on the run record as errorRepo, and the training panel renders a "Request access to <repo> ↗" button that opens the exact license page — accept it there with the token's account and retry, no token change needed. The repo-extraction the image runner already did inline is now a shared extractGatedRepo() helper (server/lib/hfErrors.js) both subsystems consume. (server/lib/hfErrors.js, server/services/loraTraining/failure.js, server/services/loraTraining/index.js, server/services/imageGen/local.js, client/src/components/loraTraining/TrainingPanel.jsx)

  • mflux-trained FLUX.2 LoRAs now load into diffusers (double-block to_out key mismatch) — Even on the bf16 base, an mflux-trained adapter failed to load with Target module ModuleList(...) is not supported, so the whole LoRA was dropped and the render fell back to base. Cause: mflux targets a double transformer block's attn.to_out as a bare Linear and exports the key transformer_blocks.N.attn.to_out.lora_*, but diffusers' Flux2Attention wraps that projection in ModuleList([Linear, Dropout]) — PEFT needs the inner .0. The shared LoRA loader (scripts/lora_utils.py) now normalizes mflux adapters on load: it inserts the .0 for double-block to_out only (single-block to_out is a bare Linear in diffusers and is left alone), then hands diffusers the remapped state dict. Verified against the real diffusers Flux2 structure — all 100 of the adapter's target modules resolve to nn.Linear after the fix. Self-healing: existing trained LoRAs are fixed at load time with no re-training or migration. Every other mflux target already matched diffusers naming. (scripts/lora_utils.py)

  • Trained character LoRAs now actually apply at render time (were silently ignored on quantized FLUX.2) — A trained LoRA attached to a FLUX.2 Klein render did nothing: the default inference model is the SDNQ 4-bit quantized Klein, and PEFT can't inject an adapter into SDNQ-quantized Linear layers (Target module SDNQLinear … is not supported). The runner's LoRA loader is best-effort, so it logged the failure and rendered the base model anyway — every "LoRA" render was the plain base, which looked like a broken LoRA. Since a trained adapter is trained against the bf16 base, the image runner now auto-routes any LoRA render off the quantized repo onto the gated bf16 base (black-forest-labs/FLUX.2-klein-{4B,9B}, resolved from the model's size variant) with quantization=none; non-LoRA renders stay on the fast SDNQ/Int8 path. The bf16 base repos are now a single source of truth in lib/runners.js that LoRA training reuses, so the train-against and render-against repos can't drift. (server/lib/runners.js, server/services/imageGen/local.js, server/services/loraTraining/runtimes.js)

  • LoRA training that died with a bare "exited with code 2" now says what actually broke — and a stale mflux fails loudly instead — A FLUX.2 LoRA training run could fail instantly with the useless message Training exited with code 2 — ❌ mflux trainer exited with code 2. The real cause was a stale mflux 0.12.x in the local image-gen venv: that version predates FLUX.2 LoRA training, so its mflux-train CLI rejected the wrapper's --config flag (it wants --train-config) and had no flux2-klein-* base models — argparse exited 2 before any work began. The actual argparse error was lost because the wrapper merges mflux's stderr into stdout, leaving the Node failure classifier's stderr window empty. Two fixes: (1) on a non-zero exit the wrapper now replays the trainer's last ~40 output lines to stderr (so tracebacks, argparse errors, and version-mismatch complaints reach the classifier instead of vanishing), and a new CLI_MISMATCH classification turns the argparse rejection into an actionable "your mflux is too old for FLUX.2 LoRA training — pip install -U 'mflux>=0.17'"; (2) scripts/setup-image-video.sh now pins mflux>=0.17 (the first release with FLUX.2 training) and lets pip resolve mflux's declared runtime deps instead of a hand-kept list — mflux 0.17 imports packages the old list omitted (pillow, matplotlib, platformdirs, sentencepiece, …) and constrains transformers>=5,<6 and mlx<0.32, so the stale list (which pinned transformers<5 and an unbounded mlx) would have left mflux-train failing at import. (scripts/train_mflux_lora.py, server/services/loraTraining/failure.js, scripts/setup-image-video.sh)

  • Concurrent LoRA caption runs no longer fan out parallel requests at a single-GPU backend — Within one run the captioner already processes images one at a time, but nothing stopped several runs from overlapping (captioning two datasets at once, re-captioning multiple single images, or a double-click). Each run is a detached loop, so concurrent runs fired N parallel /chat/completions requests at the same local Ollama/LM Studio — and on one GPU that's pure downside: every Ollama parallel slot reserves its own 32K-token KV cache, so concurrent vision requests multiply VRAM and risk an OOM or model reload, while parallel decoding gives no throughput win (it just time-slices the same compute and makes each request slower). A module-level mutex now serializes every caption vision call across all runs, holding backend load at concurrency 1 regardless of how many runs are in flight. One-shot vision calls (voice ui_describe_visually, the vision-test page) stay off the lock so a long batch run can't FIFO-starve an interactive describe. (server/services/loraDatasetCaption.js)

  • LoRA caption failures now tell you they happened instead of failing silently — The captioner already reported per-image failures and a final failure tally over its progress stream (a vision model refusing an image or returning an empty description), but the dataset workbench threw that away: the "Caption all" button just stopped spinning and the run looked done, even when half the images were never captioned. The terminal frame is now surfaced as a toast — an actionable error when the whole run failed up front, a "Captioned 8/10 — 2 images failed (model refused…). Re-caption individually or pick another vision model." summary when some failed, and a success confirmation when all landed. This also covers the per-image "Re-caption" button, whose failures were previously invisible. (client/src/pages/LoraDatasetDetail.jsx)

  • LoRA auto-captions no longer silently come back as just the trigger word — When a vision model returned an empty reply (common when it refuses a realistic close-up face, or when a thinking model spends its whole token budget reasoning), the captioner prefixed that empty string with the trigger word and saved the result — so the image was bound but undescribed, yet the run still logged it as captioned. A blank model reply is now treated as a per-image failure: it's surfaced in the caption run's progress (with the model name and a hint to try a different vision model or caption manually) and never persisted, so the image stays un-captioned and a re-run re-attempts it instead of leaving a degenerate trigger-word-only caption. (server/services/loraDatasetCaption.js)

  • LoRA caption failures now name the real cause — reasoning model vs. refusal — instead of always blaming a refusal — A blank vision reply used to fail with one fixed message ("it may have refused this image"), which was usually wrong: capability-tagged reasoning models (a qwen3.6:35b-style MoE, thinking Gemma builds) emit a hidden <think> block FIRST and, at the old 300-token caption budget, routinely hit the budget mid-reasoning and return empty content — a token-exhaustion problem, not a refusal. The captioner now reads the response's finish_reason, token usage, and any out-of-band reasoning (describeImageDataUrlDetailed) and writes the diagnosis into the failure: "it spent its whole token budget on hidden reasoning (spent N completion tokens, the model-reported count) and ran out before writing a caption — this is a reasoning model, not a vision model. Pick a dedicated VLM (Qwen2.5-VL, LLaVA, MiniCPM-V, Llama 3.2 Vision)" for a thinking model, a plain truncation message when cut off with no reasoning trace, and the original refusal wording only when there's genuinely no diagnostic signal. The per-image reason now also reaches the dataset-workbench toast (not just the generic tally), so a single-image run tells you exactly what to do. The caption token budget was also raised 300→600 to give a borderline reasoning model enough headroom to finish; dedicated VLMs stop well before it, so it costs them nothing. (server/services/visionTest.js, server/services/loraDatasetCaption.js, client/src/pages/LoraDatasetDetail.jsx)

  • LoRA caption-model picker now sees vision-capable Ollama models whose name lacks a vl/vision token — The picker showed "none installed" even with a vision model like the qwen3.6:35b MoE installed, because Ollama's /api/tags carries no vision flag and the id heuristic only matches names containing a vl/vision/known-family token. Ollama does report capabilities: ["…","vision",…] via /api/show, but PortOS only consulted that for LM Studio. listVisionModels now enriches each Ollama model the id heuristic doesn't already catch with its /api/show capabilities (cached per model, busted on delete), so capability-tagged vision models surface in the picker — and, through the same path, in the captioner's auto-pick and explicit-model validation. (server/services/ollamaManager.js, server/services/localLlm.js)

  • TUI agents no longer leave the prompt sitting unsent in the input box — CoS agents that run inside a terminal-UI provider (Claude Code, Codex) bracketed-paste their task prompt and then send a single Enter to submit it. On a large multi-line prompt that one \r could arrive while the TUI was still reflowing the paste and get swallowed — so the prompt sat typed-but-unsubmitted, the agent did no work, idled out after 3 minutes, and was (wrongly) recorded as a successful run. You'd see it only by opening the Shell tab and hitting Enter yourself. The submit Enter now fires a few times spaced ~700ms apart so one lands after the paste settles; re-sending is safe because once the prompt submits the input box is empty and a bare Enter is a no-op. Applies to both the long-running agent path and the one-shot TUI runner. (server/lib/tuiHandshake.js, server/services/agentTuiSpawning.js, server/lib/tuiPromptRunner.js)

  • A TUI agent that never started working is no longer recorded as a success — Two follow-ups to the unsent-prompt fix above. First, the paste-commit fast path that submits the prompt the moment Claude Code finishes ingesting it was effectively dead: it scanned the raw terminal stream for the [Pasted text #N] marker, but Claude Code draws that marker with cursor-positioning codes between every word, so the literal text never matched and every run fell back to a blind 3.5-second timer. The matcher now runs against the cleaned text, so the fast path fires again on large pastes (short prompts still use the timer, and the multi-Enter safety net covers both). Second, a long-running agent that idled out without ever submitting its prompt was still marked successful — the idle check only confirmed the terminal had repainted something, and the status bar repaints constantly even with an unsent prompt. An agent now must show a real sign of work — the terminal's elapsed-time working counter actually advancing — before an idle-out counts as done; an idle-out with no such activity is recorded as a failure instead, so a no-op run can't masquerade as completed. (The paste-marker fix applies to both the agent path and the one-shot prompt runner; the work-activity gate is agent-only — the one-shot runner's idle fallback legitimately captures inline answers that carry no working counter, and its authoritative signal is the response file.) (server/lib/tuiHandshake.js, server/services/agentTuiSpawning.js, server/lib/tuiPromptRunner.js)

  • calendarSync test no longer depends on the developer's machine state — the "throws 401 when Google OAuth is not configured" test read the REAL Google credentials/tokens off disk, so on a machine with OAuth configured it failed with a GaxiosError (400 invalid_grant) instead of the pinned 401. The auth client is now mocked to the not-configured state. (server/services/calendarSync.test.js)

Full Changelog

Full Diff: https://github.com/atomantic/PortOS/compare/v2.20.0...v2.21.0