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: don't let the local image probe gate a federated render (#5671)
Adam Eivye7542353250b
diff --git a/client/src/pages/ImageGen.jsx b/client/src/pages/ImageGen.jsxindex a1edde672a..7cd7a4de17 100644--- a/client/src/pages/ImageGen.jsx+++ b/client/src/pages/ImageGen.jsx@@ -250,6 +250,10 @@ export default function ImageGen() {// apply to it. Keep the target state intact so switching back to another// backend restores the user's previous target selection.const remoteTargetActive = effectiveMode !== IMAGE_GEN_MODE.GROK && remoteTarget.isRemote;+ // The status probe describes THIS machine's backend, and it can hang for a long+ // time against an unconfigured external SD API URL. A federated target renders+ // on the peer, so only a LOCAL dispatch waits on the probe.+ const localBackendPending = statusLoading && !remoteTargetActive;const isAsyncMode = isLocalMode || isCloudMode || remoteTargetActive;// Only probe `agy models` while Agy is the active backend — it spawns a// child process server-side, so an unselected backend must not pay for it.@@ -987,7 +991,7 @@ export default function ImageGen() {// pill is still checking, so an implicit submit must not dispatch against a// backend we haven't confirmed. A remote target runs on the peer, so the// LOCAL probe result doesn't gate it — mirror the submit button exactly.- if (statusLoading || (!remoteTargetActive && notConnected)) return;+ if (localBackendPending || (!remoteTargetActive && notConnected)) return;// The button reading is as old as the last render and a capacity window// expires on the clock, so an enabled button can already be pointing at a// lapsed peer. Re-derive here and say so, rather than letting the server@@ -1473,15 +1477,15 @@ export default function ImageGen() {// The probe decides WHICH backend can run, not what the user may// type — so it gates submit and backend selection only. Every form// control above stays live while the status pill is still checking.- disabled={statusLoading || (remoteTargetActive+ disabled={remoteTargetActive? remoteBlocked !== null- : (notConnected || editImageMissing || cloudNeedsPrompt))}- title={statusLoading+ : (localBackendPending || notConnected || editImageMissing || cloudNeedsPrompt)}+ title={localBackendPending? 'Checking the image backend…': remoteBlocked || (editImageMissing ? 'This image-edit model needs a source image — upload one below first' : cloudNeedsPrompt ? cloudPromptHint : undefined)}className="flex items-center gap-2 px-4 py-2 bg-port-accent hover:bg-port-accent/80 disabled:opacity-50 disabled:cursor-not-allowed text-white text-sm font-medium rounded-lg min-h-[40px]">- <Sparkles className="w-4 h-4" /> {statusLoading ? 'Checking…' : generating ? 'Queue' : 'Generate'}+ <Sparkles className="w-4 h-4" /> {localBackendPending ? 'Checking…' : generating ? 'Queue' : 'Generate'}{isAsyncMode && batchCount > 1 && <span className="text-xs opacity-80">× {batchCount}</span>}</button>{editImageMissing && (diff --git a/client/src/pages/ImageGen.probeGating.test.jsx b/client/src/pages/ImageGen.probeGating.test.jsxindex 1883e2d05e..35b37714dd 100644--- a/client/src/pages/ImageGen.probeGating.test.jsx+++ b/client/src/pages/ImageGen.probeGating.test.jsx@@ -4,6 +4,29 @@ import { MemoryRouter } from 'react-router';const MODEL = { id: 'dev', name: 'FLUX.1 Dev', runner: 'mflux', steps: 20, guidance: 3.5 };+// A peer opted in as an image provider with a live capacity window — the shape+// `GET /api/instances` returns.+const PEER = {+ id: 'peer-example',+ name: 'Example GPU',+ status: 'online',+ enabled: true,+ mediaProvider: { enabled: true, imageModels: [{ engine: 'local', modelId: 'peer-flux' }] },+ mediaProviderStatus: {+ state: 'ready',+ checkedAt: new Date().toISOString(),+ freshUntil: new Date(Date.now() + 60_000).toISOString(),+ snapshot: {+ queue: { accepting: true, running: 0, queued: 0, totalActive: 0, maxQueuedJobs: 4 },+ capabilities: [{+ kind: 'image', engine: 'local', engineName: 'Local image', modelId: 'peer-flux',+ modelName: 'FLUX.2 Klein', ready: true, unavailableReason: null,+ runtimeReady: true, platformSupported: true, cudaRequired: false, cudaState: 'available',+ }],+ },+ },+};+// The backend probe is held open on purpose: an unconfigured `external` SD API// URL times out, and that window used to grey out the whole form.const state = vi.hoisted(() => ({ resolveStatus: null, statusPromise: null, generateImage: vi.fn() }));@@ -122,4 +145,22 @@ describe('ImageGen backend-probe gating', () => {expect(state.generateImage).not.toHaveBeenCalled();});++ // A federated render runs on the peer, so THIS machine's probe — hung against+ // an unconfigured SD API URL — must not hold the submit hostage.+ it('still submits to a ready peer while the local probe hangs', async () => {+ const { getInstances } = await import('../services/api');+ getInstances.mockResolvedValueOnce({ peers: [PEER] });+ await mount();++ fireEvent.change(await screen.findByRole('combobox', { name: /generation target/i }), { target: { value: 'peer-example' } });+ fireEvent.change(screen.getByLabelText('Prompt'), { target: { value: 'a lighthouse at dusk' } });++ const generate = screen.getByRole('button', { name: /^Generate$/ });+ expect(generate).not.toBeDisabled();+ await act(async () => { fireEvent.click(generate); });++ await waitFor(() => expect(state.generateImage).toHaveBeenCalled());+ expect(state.generateImage.mock.calls[0][0]).toMatchObject({ mediaProviderPeerId: 'peer-example' });+ });});