Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: scheduled reference-watch default must be writable to update PLAN.md
Adam Eivy456f0582e95f
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 1588ae5006..aa87a6f61c 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -29,6 +29,8 @@ TBD## Fixed+- **Scheduled `reference-watch` was silently read-only, breaking weekly PLAN.md updates.** `DEFAULT_TASK_INTERVALS['reference-watch']` in `server/services/taskSchedule.js` carried `taskMetadata: { readOnly: true }`, which `agentPromptBuilder.js` translated into a "## Read-Only Task — Do NOT commit, push, or modify any files" guard at the bottom of the prompt. But the v2 reference-watch prompt (`PROMPT_VERSIONS['reference-watch'] = 2`) explicitly instructs the agent to APPEND slug-tagged `[ref-watch-…]` checklist items to PLAN.md and commit them — the agent (correctly) refused to write any files, defeating the whole flow on every weekly cron firing. The on-commit trigger path in `referenceRepos.js#triggerReferenceAnalysis` was already correct (`readOnly: false`, with an inline comment documenting exactly this pitfall); the scheduled-cron default drifted. Flipped the default to `readOnly: false`, updated the stale comment, and pinned the contract via tests in `taskSchedule.test.js` (default-interval contract) and `referenceRepos.test.js` (trigger-path contract).+- **Big-local-models PR review pass.** Multi-agent review of the big-local-models branch surfaced eight cross-file regressions that landed alongside the Memory Management + new-runtime work:- `HiDream / Qwen image renders were rejected with "Local image generation is not configured" at the route gate before reaching the worker.** `server/routes/imageGen.js` and `server/routes/universeBuilder.js` still ran the legacy `!isFlux2 && !isZImage && !isErnie && !py` predicate chain — adding HiDream + Qwen via the `usesDiffusersRunner(model)` helper (already exported from `server/lib/runners.js`) in both routes lets the new families through without requiring a `settings.imageGen.local.pythonPath` they don't need.- `Wan 2.2 i2v never received the `--image` arg.** `buildWan22Args` gated `--image` on the *request* `mode === 'i2v'` while `videoGen.js`'s request schema doesn't have an `'i2v'` enum value — so the i2v model was dispatched with `--task i2v-A14B` but no source image, and upstream `generate.py` errored. Now gates on `model.mode === 'i2v'` (registry source of truth) and hard-fails when an i2v model is invoked without a source image rather than silently degrading.diff --git a/PLAN.md b/PLAN.mdindex 9bde4cf3d6..5c83047b19 100644--- a/PLAN.md+++ b/PLAN.md@@ -226,6 +226,7 @@ The first slice shipped a working **seed-mode** conductor (`/story-builder`): cr- [ ] [memory-mgmt-new-endpoint-tests] **Add tests for the 5 new memory-management routes.** `/api/local-llm/loaded`, `/api/local-llm/unload`, `/api/voice/whisper`, `/api/voice/tts/status`, `/api/voice/tts/unload` have no test coverage. The PR description claims "8062/8062 tests passing" — true for the existing suite, but no asserts pin the new wire contracts (response shapes, residency precondition, validation rejection). Add focused happy-path + validation-rejection tests so future regressions in the schema-parity fixes (or the `unloadModel` residency check) surface as test failures. Surfaced by /do:review of PR #516 (2026-05-28).- [ ] [qwen-image-edit-init-image-required] **Qwen-Image-Edit dispatches without its required init image.** `qwen-image-edit` (registry `mediaModels.js:202`) loads `QwenImageEditPipeline` which requires an `image` arg; the entry is exposed in the normal image-gen model picker which permits text-only submission. Today the user picks the model, submits a text prompt, and the runner crashes deep inside the diffusers pipeline after loading the 20B-param model from disk. Options: (a) add an `editOnly: true` flag to the model + validate at `routes/imageGen.js` POST; (b) filter the model from the picker when no source image is uploaded; (c) reroute through a future `/api/image-gen/edit` endpoint. Touches the image route schema + UI gating — defer to a focused PR. Surfaced by codex review of PR #516 (2026-05-28).- [ ] [hidream-requires-hf-token-fail-fast] **Probe HF token upfront for HiDream gated-encoder downloads.** `data.reference/media-models.json`'s HiDream entries carry `requiresHfToken: true` + a `licenseUrl` pointing at `meta-llama/Meta-Llama-3.1-8B-Instruct`, but `scripts/z_image_turbo.py` `load_external_text_encoder()` does NOT call `probe_hf_auth()` the way `flux2_macos.py:265` does for the base FLUX repo. A user without a valid HF token currently sees a multi-GB download attempt that fails with a 401 deep inside transformers instead of a clean upfront error. Mirror the FLUX.2 probe before invoking `transformers.from_pretrained()` on the gated encoder repo. Surfaced by /do:review of PR #516 (2026-05-28).+- [ ] [reference-watch-default-prompt-version-bump-check] **Re-audit `DEFAULT_TASK_INTERVALS['reference-watch'].taskMetadata` whenever `PROMPT_VERSIONS['reference-watch']` changes.** The schedule default was flipped from `readOnly: true` → `false` on 2026-05-28 because the v2 prompt instructs the agent to append `[ref-watch-…]` items to PLAN.md and commit them — the read-only guard silently defeated that on every weekly cron firing (the on-commit `triggerReferenceAnalysis` path was already correct). A future v3 of the prompt that returns to a propose-only flow would need to flip the default back. Pin: `server/services/taskSchedule.js#DEFAULT_TASK_INTERVALS` reference-watch entry must stay in sync with the prompt's behavior; tests in `taskSchedule.test.js` and `referenceRepos.test.js` pin the current contract.## Future Ideasdiff --git a/server/services/referenceRepos.test.js b/server/services/referenceRepos.test.jsindex c0c0069afa..b2e6e2f6f8 100644--- a/server/services/referenceRepos.test.js+++ b/server/services/referenceRepos.test.js@@ -394,6 +394,11 @@ describe('triggerReferenceAnalysis', () => {// Task type markersexpect(addTaskMock.mock.calls[0][1]).toBe('internal');expect(addTaskMock.mock.calls[0][2]).toEqual({ raw: true });+ // readOnly must be false: the v2 reference-watch prompt appends slug-tagged+ // [ref-watch-…] items to PLAN.md and commits them. readOnly:true would inject+ // the "## Read-Only Task" guard into the system prompt and the agent would+ // refuse to write the PLAN entries — defeating the whole flow.+ expect(taskArg.metadata.readOnly).toBe(false);});it('returns duplicate when addTask signals a duplicate', async () => {diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.jsindex e7a911ba96..4bd09de1ff 100644--- a/server/services/taskSchedule.js+++ b/server/services/taskSchedule.js@@ -2323,10 +2323,16 @@ const DEFAULT_TASK_INTERVALS = {// do-replan audits PLAN.md after open PRs and stale branches have been cleaned up,// so the plan reflects what actually merged.'do-replan': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, runAfter: ['pr-reviewer', 'branch-cleanup'], taskMetadata: { useWorktree: true, openPR: true } },- // Read-only by default — the agent's job is to propose, not implement.- // Worktree off because the task body itself reads from data/cos/reference-repos- // (managed clones the user can't accidentally clobber).- 'reference-watch': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { readOnly: true } }+ // Writable — the v2 reference-watch prompt (PROMPT_VERSIONS['reference-watch'] = 2)+ // instructs the agent to APPEND slug-tagged `[ref-watch-…]` checklist items to+ // PLAN.md and commit them. `readOnly: true` would inject the "do not modify or+ // commit files" guard into the system prompt and the agent would refuse to write+ // the PLAN entries — defeating the whole flow. Worktree off because the task body+ // itself reads from data/cos/reference-repos (managed clones the user can't+ // accidentally clobber) and the PLAN.md write is small enough that the in-place+ // commit on the source repo is simpler than a worktree round-trip. Mirrors the+ // on-commit trigger path in referenceRepos.js#triggerReferenceAnalysis.+ 'reference-watch': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { readOnly: false } }};// Agent-options that a task manages internally — UI locks the toggle, anddiff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.jsindex 7876ba411e..23068ba244 100644--- a/server/services/taskSchedule.test.js+++ b/server/services/taskSchedule.test.js@@ -219,6 +219,16 @@ describe('taskSchedule', () => {const interval = await getTaskInterval('unknown-task')expect(interval.enabled).toBe(false)})++ it('reference-watch default is writable so the v2 prompt can append [ref-watch-…] items to PLAN.md', async () => {+ // The v2 reference-watch prompt instructs the agent to append slug-tagged+ // checklist items to PLAN.md and commit them. If `readOnly` flips back to+ // true, agentPromptBuilder injects the "## Read-Only Task" guard and the+ // agent refuses to write the entries — silently breaking the flow. Pin+ // the contract so a future "default to read-only" refactor surfaces here.+ const interval = await getTaskInterval('reference-watch')+ expect(interval.taskMetadata?.readOnly).toBe(false)+ })})describe('updateTaskInterval', () => {