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

docs([cos-runner-client-non-json-response-handling]): remove from PLAN.md and log to changelog

[._.]/ Adam Eivy96b799eb5b5a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 1bf2ea0727..48aeb899bd 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -36,6 +36,7 @@
## Fixed
+- **[cos-runner-client-non-json-response-handling] CoS agent and run failures now surface the runner's actual error instead of a cryptic "Unexpected token <" crash.** When the background agent runner returns a non-JSON error response (for example while it is restarting mid-request), PortOS reports the runner's real message rather than choking on the unparseable body.
- **[cos-task-id-uniqueness-validation] Reordering a CoS task list with duplicate task IDs no longer silently drops tasks.** If a hand-edited or corrupted task file holds two tasks sharing the same ID, reordering it previously kept only one and discarded the rest; every task is now preserved, with any collision given a distinct ID.
- **[banner-icon-aria-hidden] Screen readers no longer announce the decorative icon on alert banners.** The warning/error/info banners' leading icon is now hidden from assistive tech by default, so only the message text is read aloud instead of an unhelpful icon name preceding it.
- **[media-job-sse-transient-reconnect-resilience] A brief network blip mid-render no longer fails the whole image or video generation.** The live progress stream now distinguishes a transient connection hiccup — which the browser silently reconnects, picking up where the render left off — from a real disconnect, so a momentary Wi-Fi/Tailscale drop while a render is in flight no longer aborts it with a "Lost connection to server" error.
diff --git a/PLAN.md b/PLAN.md
index 8e71d29c52..9b94ecd7c2 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -6,7 +6,6 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [.changel
Claimable, well-specified, no decision needed — `/claim`-able. Unordered.
-- [ ] [cos-runner-client-non-json-response-handling] **`cosRunnerClient.js` fetch wrappers — handle non-JSON runner responses.** `spawnAgentViaRunner` and siblings (~`server/services/cosRunnerClient.js:139`) `await response.json()` unconditionally; if the runner returns a 500 HTML error page (e.g. PM2 crash mid-restart) the client crashes with `Unexpected token <` instead of surfacing the runner's actual error. Wrap each parse in `try { JSON.parse(text) } catch { { error: text } }` and propagate the synthesized error so the caller sees a useful message.
- [ ] [cos-agent-output-write-amplification] **`appendAgentOutput` write-amplification — already batched via `appendAgentOutputLines`, audit non-runner producers.** CLAUDE.md documents the streaming-producers convention (batched variant + ~250ms debounce + drain on completion); the runner path uses it. Verify every producer that calls `appendAgentOutput` directly (`server/services/cosAgents.js:216`) is human-pace, not a hot loop. If any hot producer is still calling the per-line variant, migrate it. Likely a no-op audit; capture it so the convention doesn't silently drift.
- [ ] [cos-on-demand-mark-app-review-started-dedupe] **`evaluateTasks` on-demand loop — dedupe `markAppReviewStarted` calls per app.** When multiple on-demand requests for the same app are queued in a single evaluation cycle (`server/services/cos.js:730`), `markAppReviewStarted` is called once per request — wasted state writes. Collect unique `appId`s before the loop and call once. Nit-level priority.
- [ ] [subagent-spawner-top-level-side-effects] **`subAgentSpawner.js` top-level side effects — move init into an explicit `initSpawner()`.** Module-load (`server/services/subAgentSpawner.js:153`) wires event listeners + timers, which interferes with test isolation (each test import re-arms them). Wrap the init block in `export function initSpawner()` and call it from `server/index.js` after dependencies are ready. Treat as a refactor — needs care that no consumer relies on the import-time wiring.