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
carry the base-model + effort rules into the shared useTaskModelPins hook
[._.]/ Adam Eivy5dcc323add75
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 260430df98..637a5362f4 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -95,7 +95,7 @@- **The Antigravity model dropdown made you pick your reasoning effort inside the model name.** `agy models` enumerates the effort tiers as separate ids (`gemini-3.6-flash-low|-medium|-high`), so there was no way to set the base model and the effort independently — and the Three.js Model Generator, which builds its own prompt-runner invocation, had no effort control at all. `ProviderModelSelector` grows optional `effort`/`onEffortChange` props that render a "Thinking effort" select for the effort-capable providers (Antigravity, Claude, Codex) and nothing for the rest, so callers need no guard of their own; a picker that wires those also passes `withEffort` to `useProviderModels` and then lists base models with the suffixes stripped and deduped. That pairing is deliberate rather than a global rewrite: in a picker with no effort control the suffixed ids are the only way to express a tier, so collapsing them there would strip the capability instead of relocating it. Verified against the real binary before building it: `agy` takes `--effort` as its own session flag and accepts the base id — but it validates the PAIR, erroring with `gemini-3.1-pro has no "medium" effort (available: low, high)`. So the tiers offered for an Antigravity model are derived from that provider's own catalog rather than assumed to be the full ladder, and an out-of-range effort clamps down to the nearest tier the model really has instead of producing an invocation agy rejects. A stored suffixed id — still what older installs and federated peers persist — splits into base plus `--effort`, the equivalent invocation, rather than being orphaned, and the picker seeds both controls from its two halves; one that somehow can't be split stays visible as its own option instead of blanking the select. The effort the record stores is the one that will ACTUALLY run — resolved server-side against the provider and model before persisting — so a level left over from a previous selection can not be saved and rendered for a run that never used it. Threading the effort down to `runPromptThroughProvider` also closed a gap on that path generally: it rides the provider clone the arg builders already read, and until now `buildCliArgs`/`buildTuiInvocation` emitted no effort flag at all for claude or codex there (#3480).-- **[issue-3495]** **Only one picker had gained the separate reasoning-effort control, so everywhere else Antigravity still hid the tier inside the model name.** #3480 relocated the effort out of the model id but wired it into the Three.js Model Generator alone; every other dropdown still listed `gemini-3.6-flash-low|-medium|-high` as three separate models. The remaining pickers that already persist and forward an effort now list base models with the tier picked beside them: the CoS Add Task form, the Resume Agent modal (which gains a Thinking Effort select it never had, so a resumed run keeps the tier the original ran at), the scheduled-task global config and its per-stage pipeline config, the Scheduled Jobs provider/model fields, the Agent Operations `/do:*` drawer, the game AI-feedback panel, and the Three.js Models create page (which also gains an effort control — only the detail page had one). Every one of them feeds the selected model to the effort select, so the offered tiers are the ones that model actually has rather than the full ladder — agy rejects `--model gemini-3.1-pro --effort medium` outright. A record, template, or agent saved before the split reads back as base model plus its baked tier, and where a form edits a saved record in place the stored suffixed id stays selectable as its own option instead of blanking the select — it still runs, because the server splits it into `--model` + `--effort`. Pickers whose route has no effort field at all (the editorial-checks run, the per-feature AI assignments, and the prose/vision/embedding pickers) are deliberately left listing the suffixed ids: collapsing them without somewhere to put the tier would strip the capability rather than relocate it (#3495).+- **[issue-3495]** **Only one picker had gained the separate reasoning-effort control, so everywhere else Antigravity still hid the tier inside the model name.** #3480 relocated the effort out of the model id but wired it into the Three.js Model Generator alone; every other dropdown still listed `gemini-3.6-flash-low|-medium|-high` as three separate models. The remaining pickers that already persist and forward an effort now list base models with the tier picked beside them: the CoS Add Task form, the Resume Agent modal (which gains a Thinking Effort select it never had, so a resumed run keeps the tier the original ran at), the scheduled-task global config and the schedule card's quick controls (one change, since both drive the same `useTaskModelPins`), its per-stage pipeline config, the Scheduled Jobs provider/model fields, the Agent Operations `/do:*` drawer, the game AI-feedback panel, and the Three.js Models create page (which also gains an effort control — only the detail page had one). Every one of them feeds the selected model to the effort select, so the offered tiers are the ones that model actually has rather than the full ladder — agy rejects `--model gemini-3.1-pro --effort medium` outright. A record, template, or agent saved before the split reads back as base model plus its baked tier, and where a form edits a saved record in place the stored suffixed id stays selectable as its own option instead of blanking the select — it still runs, because the server splits it into `--model` + `--effort`. Pickers whose route has no effort field at all (the editorial-checks run, the per-feature AI assignments, and the prose/vision/embedding pickers) are deliberately left listing the suffixed ids: collapsing them without somewhere to put the tier would strip the capability rather than relocate it (#3495).- **Composite boards were the only Universe Builder surface with no thumbnail, so a rendered board looked unrendered.** Characters, places, objects and category variations all show their latest render as an `EntryThumbSlot` avatar with a click-to-preview lightbox; the Composites tab showed label + prompt only. Nothing was missing server-side — `compile.js` already stamps an `entryRef` of kind `sheet` on each queued board render and the completion hook already appends the resulting filename to that board's `imageRefs[]`, so the data was sitting in the record with nothing reading it. Composite rows now render through the same `EntryCard` shell + three-state `EntryThumbSlot` the variation and canon rows use (in-flight spinner → rendered thumbnail → empty placeholder with a one-click render button), so their spacing and locked accent can no longer drift from the other surfaces, and clicking a board opens the same page-level lightbox with the real render prompt hydrated from the gallery sidecar. `useRenderJobQueue` had been dropping `sheet`-kind jobs on the grounds that no row consumed them; with every kind the server stamps now settled by a row, the filter is deleted rather than widened — an allowlist that already covers everything can only ever fail closed on the next kind added, silently, with no spinner and no error. Two things this collapsed rather than copied: the row settles through `EntryThumbSlot`'s existing `onComplete` bridge instead of opening a second `useMediaJobProgress` subscription against a jobId the slot is already watching (which is what the variation and canon rows do, at the cost of a row re-render per diffusion tick), and the two page-level job handlers that had each inlined the same append-dedupe-cap now share `appendImageRefById` in `lib/bibleLimits.js`, the client mirror of the server's `mapAppendImageRef` (three other surfaces still inline their own copy). The settle callback is memoized rather than rebuilt per render: `MediaJobThumb` fires its completion effect on `[filename, onFilename]`, so a fresh arrow would re-settle the same job on every keystroke in the builder draft, each one a full gallery refetch — there is a test that fails against the unstable form. Codex review then surfaced the gap that made the whole thing conditional: the draft never adopted the ids the server sanitizer mints, so a board added and rendered in the same session had no `id` to match the one the server stamped onto `entryJobs` — no spinner, no thumbnail until reload, and (now that sheet jobs are tracked) a pending entry with no consumer to clear it. `handleSave` had the server record in hand the whole time and only ever used it for the universe list, so it now adopts the minted ids into both the draft and its dirty baseline — backfilling only the draft would leave the page permanently dirty. That fixes variations, which had the identical latent bug, in the same place rather than special-casing boards. A second review round found the same mismatch in its other shape: on records written before entry ids were persisted at all, `ensureEntryId` mints a fresh uuid on every read, and `POST /render` migrates the record — persisting yet another set — before queueing jobs against it, so the draft is holding ids that exist nowhere. The render flow now reconciles from the persisted record before it enqueues, and the adopt rule is stated as "keep every id the server also has, replace the ones it does not": an id the server has never heard of cannot be the key anything is stored under, while a confirmed id is never re-pointed and so can never be pulled out from under an in-flight job. And a failed board render now says so, the way the variation and canon rows already did, instead of the spinner just vanishing — `EntryThumbSlot` reports the terminal status on a dedicated `onTerminalStatus` prop so a cancel can stay silent. That status deliberately does NOT ride on `onComplete`'s second argument, which was the first thing tried: `useSingleImageRender`'s `handleComplete(filename, key)` is wired straight into that prop by the base-style probe, so a status arriving where it expects a key looked up a job that did not exist, never cleared the real one, and left the probe spinning forever after a perfectly successful render. The full client suite did not catch it — the collision only shows up through a component boundary neither module's tests cross — so `EntryThumbSlot` now asserts `onComplete` is called with exactly one argument, which fails the moment anyone overloads it again.diff --git a/client/src/hooks/README.md b/client/src/hooks/README.mdindex f4f1cf84aa..bd0335cf45 100644--- a/client/src/hooks/README.md+++ b/client/src/hooks/README.md@@ -143,7 +143,7 @@ grep -i "what you want to do" client/src/hooks/README.md| `useAppDeploy` | Stream `deploy.sh` output via Socket.IO. | App deployment surfaces only. || `useAppOperation` | Socket-based app ops (update, standardize) with step tracking. | App operations UI. || `useAppOverrideActions` | Per-app scheduled-task override mutations (`{ handleUpdateOverride, handleBulkToggleOverride }`) with shared toast copy + silent flag; pass the tab's `refetch`. | Any surface hosting `PerAppOverrideList` (Schedule tab, Timeline tab) — don't re-copy the write-plus-toast-plus-refetch handlers. |-| `useTaskModelPins` | Provider/model/effort pins for one CoS scheduled task: optimistic write per change (`'' → null` clears; picking a provider clears model+effort), rollback when `onUpdate` resolves falsy, a `saving` flag to gate "Run Now", plus the derived `availableModels` (stale pin kept selectable), `effectiveProviderId` and `defaultProviderLabel` a `ProviderModelSelector` needs. | Any surface that retargets a scheduled task's model (schedule card quick controls, config drawer Global defaults) — don't re-roll the select/PUT/rollback trio. |+| `useTaskModelPins` | Provider/model/effort pins for one CoS scheduled task: optimistic write per change (`'' → null` clears; picking a provider clears model+effort, picking a model clears the effort only when that model has no tiers at all), rollback when `onUpdate` resolves falsy, a `saving` flag to gate "Run Now", plus the derived `availableModels` (Antigravity base models, stale pin kept selectable), `effectiveProviderId` and `defaultProviderLabel` a `ProviderModelSelector` needs. | Any surface that retargets a scheduled task's model (schedule card quick controls, config drawer Global defaults) — don't re-roll the select/PUT/rollback trio. || `useCanonPatch` | Optimistic canon-entry patch: rebuild the kind list with one entry mutated, apply locally, PATCH the universe, re-apply the server copy. Targets + staleness-guards on the loaded record's `universe.id` so a mid-flight universe swap can't cross-PATCH or resurrect stale state. `apply` is `setUniverse` or `onUniverseChange`. | Inline canon-field edits on a universe (UniverseCanonSection, NounsStage). Don't re-roll the optimistic-then-confirm dance. || `useCityAudio` | CyberCity ambient audio. | CyberCity only. || `useCityData` | CyberCity environment data + physics. | CyberCity only. |diff --git a/client/src/hooks/useTaskModelPins.test.js b/client/src/hooks/useTaskModelPins.test.jsnew file mode 100644index 0000000000..99dda9cf43--- /dev/null+++ b/client/src/hooks/useTaskModelPins.test.js@@ -0,0 +1,62 @@+import { describe, it, expect, vi } from 'vitest';+import { act, renderHook } from '@testing-library/react';++import useTaskModelPins from './useTaskModelPins';++// Mirrors the shipped `agy models` catalog: the effort tiers are separate ids,+// and not every model has all three (`claude-sonnet-4-6` has none at all).+const AGY = {+ id: 'antigravity-cli',+ name: 'Antigravity CLI',+ type: 'cli',+ command: 'agy',+ enabled: true,+ defaultModel: 'antigravity-configured-default',+ models: [+ 'antigravity-configured-default',+ 'gemini-3.6-flash-high', 'gemini-3.6-flash-medium', 'gemini-3.6-flash-low',+ 'gemini-3.1-pro-high', 'gemini-3.1-pro-low',+ 'claude-sonnet-4-6',+ ],+};++const mount = (config, onUpdate = vi.fn().mockResolvedValue(true)) => {+ const hook = renderHook(() => useTaskModelPins({+ taskType: 'code-review',+ config,+ providers: [AGY],+ activeProviderId: AGY.id,+ onUpdate,+ }));+ return { ...hook, onUpdate };+};++describe('useTaskModelPins — Antigravity base models + effort', () => {+ it('lists base models, not the per-tier ids, since the surface picks effort separately', () => {+ const { result } = mount({ providerId: AGY.id });+ expect(result.current.availableModels).toEqual([+ 'gemini-3.6-flash', 'gemini-3.1-pro', 'claude-sonnet-4-6',+ ]);+ });++ it('keeps a stored pre-split id selectable so it still shows what the task runs', () => {+ const { result } = mount({ providerId: AGY.id, model: 'gemini-3.6-flash-high' });+ expect(result.current.availableModels).toContain('gemini-3.6-flash-high');+ });++ it('clears the effort in the same write when the new model has no tiers at all', async () => {+ // `claude-sonnet-4-6` hides the effort select entirely, so a leftover `high`+ // would keep being sent with no UI left to drop it — agy rejects the pair.+ const { result, onUpdate } = mount({ providerId: AGY.id, model: 'gemini-3.6-flash', effort: 'high' });+ await act(async () => { await result.current.changeModel('claude-sonnet-4-6'); });+ expect(onUpdate).toHaveBeenCalledWith('code-review', { model: 'claude-sonnet-4-6', effort: null });+ });++ it('leaves the effort alone when the new model merely narrows the ladder', async () => {+ // `gemini-3.1-pro` offers low/high only; EffortSelect renders the clamp as a+ // visible option rather than silently discarding the user's choice.+ const { result, onUpdate } = mount({ providerId: AGY.id, model: 'gemini-3.6-flash', effort: 'medium' });+ await act(async () => { await result.current.changeModel('gemini-3.1-pro'); });+ expect(onUpdate).toHaveBeenCalledWith('code-review', { model: 'gemini-3.1-pro' });+ });+});