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: keep an orphaned instance pin visible and editable in the task editor (#4520)
[._.]/ Adam Eivy481cb6e520b7
diff --git a/client/src/components/cos/InstancePicker.jsx b/client/src/components/cos/InstancePicker.jsxindex 66e9aa6129..623044ef1e 100644--- a/client/src/components/cos/InstancePicker.jsx+++ b/client/src/components/cos/InstancePicker.jsx@@ -8,7 +8,12 @@ import { Server } from 'lucide-react';// Presentational on purpose — the instance list is fetched once by the owning// view (`useAssignableInstances`) and passed in, so a list of task rows doesn't// issue one request per row.-export default function InstancePicker({ id, value, onChange, instances, label = 'Run on' }) {+export default function InstancePicker({ id, value, onChange, instances = [], label = 'Run on' }) {+ // A pin whose instance has left the registry has no <option> to match, so the+ // control would show "Any instance" while still holding — and submitting — the+ // stale id, which the server then rejects. Surface it as its own option so what+ // is shown is what is sent, and the user can move the task to a live instance.+ const orphanedValue = value && !instances.some((i) => i.instanceId === value) ? value : '';return (<label htmlFor={id} className="flex items-center gap-2 py-1"><span className="flex items-center gap-1.5 text-sm text-gray-400 whitespace-nowrap">@@ -23,6 +28,7 @@ export default function InstancePicker({ id, value, onChange, instances, label =className="min-w-44 rounded border border-port-border bg-port-bg px-2 py-1 text-sm text-white focus:border-port-accent focus:outline-hidden"><option value="">Any instance</option>+ {orphanedValue ? <option value={orphanedValue}>unknown instance ({orphanedValue})</option> : null}{instances.map((instance) => (<option key={instance.instanceId} value={instance.instanceId}>{instance.isSelf ? `${instance.name} (this instance)` : instance.name}diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsxindex f0ac80f2e1..3c570ec68f 100644--- a/client/src/components/cos/TaskAddForm.jsx+++ b/client/src/components/cos/TaskAddForm.jsx@@ -388,6 +388,9 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa// Only clear form inputs after successful submissionsetNewTask(t => ({ ...t, description: '' }));setSlashdoCommand('');+ // targetInstanceId deliberately SURVIVES the clear, like app/model/provider+ // and the worktree toggles: it is a run setting, and someone queueing work+ // onto the GPU box is usually queueing more than one item.// The posture belongs to the workflow the cleared template pinned, so it// must not survive into the next, template-less task.setWorktreeChangesExpected(undefined);diff --git a/client/src/components/cos/tabs/TaskItem.test.jsx b/client/src/components/cos/tabs/TaskItem.test.jsxindex 8113abeb08..bd4248a5ed 100644--- a/client/src/components/cos/tabs/TaskItem.test.jsx+++ b/client/src/components/cos/tabs/TaskItem.test.jsx@@ -654,3 +654,29 @@ describe('TaskItem instance registry — not-fetched vs fetched-empty (#4520)',expect(screen.getByText('unknown instance')).toBeTruthy();});});++// An orphaned pin must stay editable: without its own <option> the select falls+// back to showing "Any instance" while still submitting the dead id, and the+// server rejects every save with no visible cause.+describe('TaskItem editing a pin whose instance has left the registry (#4520)', () => {+ const instances = [+ { instanceId: 'self-instance-id', name: 'workstation', isSelf: true },+ { instanceId: 'peer-instance-id', name: 'render-box', isSelf: false },+ ];+ const orphaned = { ...task, metadata: { ...task.metadata, targetInstanceId: 'ghost-instance-id' } };++ it('shows the dead pin as the selected option rather than a misleading "Any instance"', () => {+ render(<TaskItem task={orphaned} providers={providers} instances={instances} onRefresh={vi.fn()} />);+ fireEvent.click(screen.getByLabelText('Edit task'));+ expect(screen.getByLabelText('Run on').value).toBe('ghost-instance-id');+ });++ it('lets the user move the task to a live instance', async () => {+ render(<TaskItem task={orphaned} providers={providers} instances={instances} onRefresh={vi.fn()} />);+ fireEvent.click(screen.getByLabelText('Edit task'));+ fireEvent.change(screen.getByLabelText('Run on'), { target: { value: 'peer-instance-id' } });+ fireEvent.click(screen.getByText('Save'));+ await waitFor(() => expect(api.updateCosTask).toHaveBeenCalled());+ expect(api.updateCosTask.mock.calls[0][1].targetInstanceId).toBe('peer-instance-id');+ });+});