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

fix: offer only vision-capable Ollama models in the Stacker News vision picker (#3315)

[._.]/ Adam Eivy8ed1fc538216
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 2b2016298b..101c4c411e 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -103,6 +103,7 @@
## Stacker News stewardship
+- **[issue-3315] The Stacker News vision-model picker now only offers models that can actually see an image.** It listed every installed Ollama model — coder and embedding models included — and picking one was silently accepted, so a model that cannot read an image still produced a confident-looking "vision" verdict that fed the safety policy gating the account's actions. The picker now shows the same vision-capable list the rest of PortOS uses (the server's per-model capability report unioned with the id heuristic, so a brand-new multimodal family still shows up), the text picker is untouched, a model you configured earlier is preserved even if it no longer qualifies, and the form now says whether it is still checking capabilities or has confirmed you have no vision model installed.
- **[issue-3302] Safe Stacker News community stewardship** — Add independent account rules and effective account/territory schedules, editable ownership-aware communities, removable encrypted credentials, constrained GraphQL reads and reviewed publishing, conservative local text/vision analysis with safe image normalization, fixed-origin identity-verified browser handoffs, target-bound Review Hub approvals, and an auditable action ledger in Comms.
## Goals
diff --git a/client/src/pages/StackerNews.jsx b/client/src/pages/StackerNews.jsx
index 511d4bcef4..bb42f260e3 100644
--- a/client/src/pages/StackerNews.jsx
+++ b/client/src/pages/StackerNews.jsx
@@ -6,8 +6,14 @@ import PageHeader from '../components/PageHeader';
import PageSkeleton from '../components/ui/PageSkeleton';
import TabPills from '../components/ui/TabPills';
import useLocalModels from '../hooks/useLocalModels';
+import useVisionModelIds from '../hooks/useVisionModelIds';
import { useValidTab } from '../hooks/useValidTab';
+import { visionLocalModelFilter } from '../utils/providers';
+// Stacker News analysis is hard-wired to Ollama (every call site is
+// `runOllamaAnalysis`), so the vision filter's provider key is always `ollama`.
+// Module-level so the reference is stable across renders.
+const OLLAMA_PROVIDER = { id: 'ollama' };
const TABS = [
{ id: 'review', label: 'Review', icon: ShieldCheck },
{ id: 'territory', label: 'Territory', icon: Newspaper },
@@ -60,6 +66,7 @@ export default function StackerNews() {
const { accountId } = useParams();
const tab = useValidTab(TABS, 'review');
const localModels = useLocalModels();
+ const { idsByProvider: visionIds, loaded: visionLoaded } = useVisionModelIds();
const [accounts, setAccounts] = useState([]);
const [territories, setTerritories] = useState([]);
const [items, setItems] = useState([]);
@@ -89,6 +96,18 @@ export default function StackerNews() {
const activeTab = selected ? tab : 'accounts';
const accountPath = (id, nextTab = tab) => `/stacker-news/${id}/${nextTab}`;
const models = useMemo(() => [...new Set(localModels.ollama)], [localModels.ollama]);
+ // The vision stage sends images to whatever id is configured, so only models
+ // that can actually see one belong in that picker: the server's capability map
+ // unioned with the id regex (the regex alone goes stale as new VLM families
+ // ship). The text picker keeps the full installed list.
+ const visionModels = useMemo(
+ () => models.filter((id) => visionLocalModelFilter(id, OLLAMA_PROVIDER, visionIds)),
+ [models, visionIds],
+ );
+ // Distinguish "still asking which models can see" from "asked, none installed" —
+ // either fetch still in flight leaves the filtered list empty for a reason that
+ // is not "you have no vision model".
+ const visionPending = !visionLoaded || localModels.loading;
const accountFormDirty = selected ? !sameAccountForm(editAccount, savedAccount) : false;
const accountActionsDisabled = accountFormDirty || Boolean(busy);
const visibleTerritories = resourcesAccountId === accountId ? territories : [];
@@ -317,8 +336,8 @@ export default function StackerNews() {
const renderAccounts = () => (
<div className="grid gap-3 xl:grid-cols-3">
<section className="rounded border border-port-border bg-port-card p-4"><h2 className="font-semibold text-white">Accounts</h2><div className="mt-3 space-y-2">{accounts.map((account) => <button key={account.id} className={`block w-full rounded border p-3 text-left ${account.id === selected?.id ? 'border-port-accent' : 'border-port-border'}`} onClick={() => navigate(accountPath(account.id, 'accounts'))}><div className="flex justify-between gap-2"><span className="font-medium text-white">{account.label}</span><span className="text-xs text-gray-400">{account.apiKeyConfigured ? 'Key protected' : 'No key'}</span></div><div className="mt-1 text-sm text-gray-400">@{account.username} · {account.monitoringEnabled ? `every ${account.monitoringIntervalMinutes}m` : 'monitoring off'}</div></button>)}{!accounts.length && <p className="text-sm text-gray-500">No accounts configured.</p>}</div></section>
- {selected ? <AccountForm title="Selected account" submitLabel="Save account" form={editAccount} setForm={setEditAccount} models={models} onSubmit={saveAccount} busy={busy === 'save-account'} canClearCredential={selected.apiKeyConfigured} extra={<div className="flex flex-wrap gap-2"><button type="button" className={secondaryButton} disabled={accountActionsDisabled} onClick={checkConnection}>Check API identity</button><button type="button" className={secondaryButton} disabled={accountActionsDisabled} onClick={checkBrowser}>Check browser identity</button><button type="button" className={secondaryButton} disabled={accountActionsDisabled} onClick={syncNow}>Sync now</button></div>} /> : <div className="rounded border border-port-border bg-port-card p-4 text-sm text-gray-400">Choose an account to edit its independent rules, models, and monitoring schedule.</div>}
- <AccountForm title="Add account" submitLabel="Add protected account" form={newAccount} setForm={setNewAccount} models={models} onSubmit={createAccount} busy={busy === 'create-account'} showCredential />
+ {selected ? <AccountForm title="Selected account" submitLabel="Save account" form={editAccount} setForm={setEditAccount} models={models} visionModels={visionModels} visionPending={visionPending} onSubmit={saveAccount} busy={busy === 'save-account'} canClearCredential={selected.apiKeyConfigured} extra={<div className="flex flex-wrap gap-2"><button type="button" className={secondaryButton} disabled={accountActionsDisabled} onClick={checkConnection}>Check API identity</button><button type="button" className={secondaryButton} disabled={accountActionsDisabled} onClick={checkBrowser}>Check browser identity</button><button type="button" className={secondaryButton} disabled={accountActionsDisabled} onClick={syncNow}>Sync now</button></div>} /> : <div className="rounded border border-port-border bg-port-card p-4 text-sm text-gray-400">Choose an account to edit its independent rules, models, and monitoring schedule.</div>}
+ <AccountForm title="Add account" submitLabel="Add protected account" form={newAccount} setForm={setNewAccount} models={models} visionModels={visionModels} visionPending={visionPending} onSubmit={createAccount} busy={busy === 'create-account'} showCredential />
</div>
);
@@ -331,7 +350,7 @@ function Field({ id, label, children }) {
return <div><label htmlFor={id} className="mb-1 block text-sm text-gray-300">{label}</label>{children}</div>;
}
-function AccountForm({ title, submitLabel, form, setForm, models, onSubmit, busy, showCredential = false, canClearCredential = false, extra = null }) {
+function AccountForm({ title, submitLabel, form, setForm, models, visionModels, visionPending, onSubmit, busy, showCredential = false, canClearCredential = false, extra = null }) {
const update = (key, value) => setForm((previous) => ({
...previous,
[key]: value,
@@ -339,7 +358,7 @@ function AccountForm({ title, submitLabel, form, setForm, models, onSubmit, busy
...(key === 'clearApiKey' && value ? { apiKey: '' } : {}),
}));
const prefix = showCredential ? 'new-account' : 'edit-account';
- return <form className="rounded border border-port-border bg-port-card p-4" onSubmit={onSubmit}><h2 className="font-semibold text-white">{title}</h2><p className="mt-1 text-sm text-gray-400">Credentials are encrypted separately and never sent to a model.</p><div className="mt-3 space-y-3"><Field id={`${prefix}-label`} label="Local label"><input id={`${prefix}-label`} required className={fieldClass} value={form.label} onChange={(event) => update('label', event.target.value)} /></Field><Field id={`${prefix}-username`} label="Stacker News username"><input id={`${prefix}-username`} required className={fieldClass} value={form.username} onChange={(event) => update('username', event.target.value)} /></Field><Field id={`${prefix}-api-key`} label={showCredential ? 'API key (optional)' : 'Replace API key (leave blank to keep)'}><input id={`${prefix}-api-key`} type="password" className={fieldClass} disabled={form.clearApiKey} value={form.apiKey} onChange={(event) => update('apiKey', event.target.value)} /></Field>{canClearCredential && <label className="flex gap-2 text-sm text-gray-300"><input type="checkbox" checked={form.clearApiKey} onChange={(event) => update('clearApiKey', event.target.checked)} /> Remove stored API key when saving</label>}<div className="grid grid-cols-2 gap-2"><Field id={`${prefix}-text-model`} label="Ollama text model"><ModelSelect id={`${prefix}-text-model`} value={form.textModel} models={models} onChange={(value) => update('textModel', value)} /></Field><Field id={`${prefix}-vision-model`} label="Ollama vision model"><ModelSelect id={`${prefix}-vision-model`} value={form.visionModel} models={models} onChange={(value) => update('visionModel', value)} /></Field></div><label className="flex gap-2 text-sm text-gray-300"><input type="checkbox" checked={form.enabled} onChange={(event) => update('enabled', event.target.checked)} /> Account enabled</label><label className="flex gap-2 text-sm text-gray-300"><input type="checkbox" checked={form.monitoringEnabled} onChange={(event) => update('monitoringEnabled', event.target.checked)} /> Enable scheduled monitoring</label><label className="flex gap-2 text-sm text-gray-300"><input type="checkbox" checked={form.analysisEnabled} onChange={(event) => update('analysisEnabled', event.target.checked)} /> Run configured local analysis during monitoring</label><Field id={`${prefix}-interval`} label="Monitoring interval (minutes)"><input id={`${prefix}-interval`} type="number" min="5" max="1440" className={fieldClass} value={form.monitoringIntervalMinutes} onChange={(event) => update('monitoringIntervalMinutes', event.target.value)} /></Field><Field id={`${prefix}-guidance`} label="Stewardship guidance"><textarea id={`${prefix}-guidance`} className={fieldClass} rows="3" value={form.guidance} onChange={(event) => update('guidance', event.target.value)} /></Field><Field id={`${prefix}-tone`} label="Tone"><input id={`${prefix}-tone`} className={fieldClass} value={form.tone} onChange={(event) => update('tone', event.target.value)} /></Field><Field id={`${prefix}-allowed`} label="Allowed themes"><input id={`${prefix}-allowed`} className={fieldClass} value={form.allowedThemes} onChange={(event) => update('allowedThemes', event.target.value)} /></Field><Field id={`${prefix}-disallowed`} label="Disallowed themes"><input id={`${prefix}-disallowed`} className={fieldClass} value={form.disallowedThemes} onChange={(event) => update('disallowedThemes', event.target.value)} /></Field><Field id={`${prefix}-escalation`} label="Escalation cues"><input id={`${prefix}-escalation`} className={fieldClass} value={form.escalationCues} onChange={(event) => update('escalationCues', event.target.value)} /></Field><Field id={`${prefix}-engagement`} label="Desired engagement"><input id={`${prefix}-engagement`} className={fieldClass} value={form.desiredEngagement} onChange={(event) => update('desiredEngagement', event.target.value)} /></Field><div className="grid grid-cols-3 gap-2"><Field id={`${prefix}-hour-budget`} label="Max/hour"><input id={`${prefix}-hour-budget`} type="number" min="1" max="50" className={fieldClass} value={form.maxPerHour} onChange={(event) => update('maxPerHour', event.target.value)} /></Field><Field id={`${prefix}-day-budget`} label="Max/day"><input id={`${prefix}-day-budget`} type="number" min="1" max="200" className={fieldClass} value={form.maxPerDay} onChange={(event) => update('maxPerDay', event.target.value)} /></Field><Field id={`${prefix}-spacing`} label="Spacing min"><input id={`${prefix}-spacing`} type="number" min="0" max="1440" className={fieldClass} value={form.minMinutesBetween} onChange={(event) => update('minMinutesBetween', event.target.value)} /></Field></div>{extra}<button className={buttonClass} disabled={busy}>{submitLabel}</button></div></form>;
+ return <form className="rounded border border-port-border bg-port-card p-4" onSubmit={onSubmit}><h2 className="font-semibold text-white">{title}</h2><p className="mt-1 text-sm text-gray-400">Credentials are encrypted separately and never sent to a model.</p><div className="mt-3 space-y-3"><Field id={`${prefix}-label`} label="Local label"><input id={`${prefix}-label`} required className={fieldClass} value={form.label} onChange={(event) => update('label', event.target.value)} /></Field><Field id={`${prefix}-username`} label="Stacker News username"><input id={`${prefix}-username`} required className={fieldClass} value={form.username} onChange={(event) => update('username', event.target.value)} /></Field><Field id={`${prefix}-api-key`} label={showCredential ? 'API key (optional)' : 'Replace API key (leave blank to keep)'}><input id={`${prefix}-api-key`} type="password" className={fieldClass} disabled={form.clearApiKey} value={form.apiKey} onChange={(event) => update('apiKey', event.target.value)} /></Field>{canClearCredential && <label className="flex gap-2 text-sm text-gray-300"><input type="checkbox" checked={form.clearApiKey} onChange={(event) => update('clearApiKey', event.target.checked)} /> Remove stored API key when saving</label>}<div className="grid grid-cols-2 gap-2"><Field id={`${prefix}-text-model`} label="Ollama text model"><ModelSelect id={`${prefix}-text-model`} value={form.textModel} models={models} onChange={(value) => update('textModel', value)} /></Field><Field id={`${prefix}-vision-model`} label="Ollama vision model"><ModelSelect id={`${prefix}-vision-model`} value={form.visionModel} models={visionModels} onChange={(value) => update('visionModel', value)} />{visionPending ? <p className="mt-1 text-xs text-gray-400">Checking which installed Ollama models can read an image…</p> : !visionModels.length ? <p className="mt-1 text-xs text-port-warning">No vision-capable Ollama model installed. Install one (e.g. a qwen-vl or llava model) to analyze images.</p> : null}</Field></div><label className="flex gap-2 text-sm text-gray-300"><input type="checkbox" checked={form.enabled} onChange={(event) => update('enabled', event.target.checked)} /> Account enabled</label><label className="flex gap-2 text-sm text-gray-300"><input type="checkbox" checked={form.monitoringEnabled} onChange={(event) => update('monitoringEnabled', event.target.checked)} /> Enable scheduled monitoring</label><label className="flex gap-2 text-sm text-gray-300"><input type="checkbox" checked={form.analysisEnabled} onChange={(event) => update('analysisEnabled', event.target.checked)} /> Run configured local analysis during monitoring</label><Field id={`${prefix}-interval`} label="Monitoring interval (minutes)"><input id={`${prefix}-interval`} type="number" min="5" max="1440" className={fieldClass} value={form.monitoringIntervalMinutes} onChange={(event) => update('monitoringIntervalMinutes', event.target.value)} /></Field><Field id={`${prefix}-guidance`} label="Stewardship guidance"><textarea id={`${prefix}-guidance`} className={fieldClass} rows="3" value={form.guidance} onChange={(event) => update('guidance', event.target.value)} /></Field><Field id={`${prefix}-tone`} label="Tone"><input id={`${prefix}-tone`} className={fieldClass} value={form.tone} onChange={(event) => update('tone', event.target.value)} /></Field><Field id={`${prefix}-allowed`} label="Allowed themes"><input id={`${prefix}-allowed`} className={fieldClass} value={form.allowedThemes} onChange={(event) => update('allowedThemes', event.target.value)} /></Field><Field id={`${prefix}-disallowed`} label="Disallowed themes"><input id={`${prefix}-disallowed`} className={fieldClass} value={form.disallowedThemes} onChange={(event) => update('disallowedThemes', event.target.value)} /></Field><Field id={`${prefix}-escalation`} label="Escalation cues"><input id={`${prefix}-escalation`} className={fieldClass} value={form.escalationCues} onChange={(event) => update('escalationCues', event.target.value)} /></Field><Field id={`${prefix}-engagement`} label="Desired engagement"><input id={`${prefix}-engagement`} className={fieldClass} value={form.desiredEngagement} onChange={(event) => update('desiredEngagement', event.target.value)} /></Field><div className="grid grid-cols-3 gap-2"><Field id={`${prefix}-hour-budget`} label="Max/hour"><input id={`${prefix}-hour-budget`} type="number" min="1" max="50" className={fieldClass} value={form.maxPerHour} onChange={(event) => update('maxPerHour', event.target.value)} /></Field><Field id={`${prefix}-day-budget`} label="Max/day"><input id={`${prefix}-day-budget`} type="number" min="1" max="200" className={fieldClass} value={form.maxPerDay} onChange={(event) => update('maxPerDay', event.target.value)} /></Field><Field id={`${prefix}-spacing`} label="Spacing min"><input id={`${prefix}-spacing`} type="number" min="0" max="1440" className={fieldClass} value={form.minMinutesBetween} onChange={(event) => update('minMinutesBetween', event.target.value)} /></Field></div>{extra}<button className={buttonClass} disabled={busy}>{submitLabel}</button></div></form>;
}
function TerritoryForm({ prefix, title, form, setForm, onSubmit, busy, submitLabel, onCancel = null }) {
diff --git a/client/src/pages/StackerNews.test.jsx b/client/src/pages/StackerNews.test.jsx
index ee397892b1..af99be3501 100644
--- a/client/src/pages/StackerNews.test.jsx
+++ b/client/src/pages/StackerNews.test.jsx
@@ -22,9 +22,23 @@ const api = {
executeStackerNewsAction: vi.fn(),
};
vi.mock('../services/api', () => api);
-vi.mock('../hooks/useLocalModels', () => ({ default: () => ({ ollama: ['example-text', 'example-vision'], loading: false }) }));
+// Mutable so a test can pose a still-loading capability fetch or a backend with
+// no VLM installed. `futuremodel:9b` is deliberately unrecognizable to the
+// `isVisionModel` id regex — only the server map can vouch for it.
+const local = vi.hoisted(() => ({
+ models: { ollama: ['example-text', 'example-embed', 'example-vision', 'futuremodel:9b'], loading: false },
+ vision: { idsByProvider: { ollama: new Set(['futuremodel:9b']) }, loaded: true },
+}));
+vi.mock('../hooks/useLocalModels', () => ({ default: () => local.models }));
+vi.mock('../hooks/useVisionModelIds', () => ({ default: () => local.vision }));
const { default: StackerNews } = await import('./StackerNews.jsx');
+const optionsOf = (select) => within(select).getAllByRole('option').map((option) => option.textContent);
+const modelSelects = () => ({
+ text: screen.getByLabelText('Ollama text model', { selector: '#new-account-text-model' }),
+ vision: screen.getByLabelText('Ollama vision model', { selector: '#new-account-vision-model' }),
+});
+
const accounts = [
{ id: 'a1', label: 'Art steward', username: 'art_steward', enabled: true, monitoringEnabled: true, monitoringIntervalMinutes: 15, analysisEnabled: true, textModel: 'example-text', visionModel: '', rules: { guidance: 'Curate visual work' }, apiKeyConfigured: true },
{ id: 'a2', label: 'Personal', username: 'personal_stacker', enabled: true, monitoringEnabled: false, monitoringIntervalMinutes: 60, analysisEnabled: false, textModel: '', visionModel: '', rules: { guidance: 'Personal rules' }, apiKeyConfigured: false },
@@ -43,6 +57,8 @@ function deferred() {
describe('StackerNews', () => {
beforeEach(() => {
vi.clearAllMocks();
+ local.models = { ollama: ['example-text', 'example-embed', 'example-vision', 'futuremodel:9b'], loading: false };
+ local.vision = { idsByProvider: { ollama: new Set(['futuremodel:9b']) }, loaded: true };
api.getStackerNewsAccounts.mockResolvedValue({ accounts });
api.getStackerNewsTerritories.mockResolvedValue({ territories: [] });
api.getStackerNewsItems.mockResolvedValue({ items: [] });
@@ -151,6 +167,58 @@ describe('StackerNews', () => {
expect(screen.getByLabelText('Monitoring interval (minutes)', { selector: '#edit-account-interval' })).toHaveValue(60);
});
+ it('offers only vision-capable models for the vision stage and every model for text', async () => {
+ renderPage('/stacker-news');
+ await screen.findByRole('heading', { name: 'Add account' });
+ const { text, vision } = modelSelects();
+ expect(optionsOf(text)).toEqual(['Disabled', 'example-text', 'example-embed', 'example-vision', 'futuremodel:9b']);
+ // Subset of the text list, with the text-only and embedding ids dropped.
+ expect(optionsOf(vision)).toEqual(['Disabled', 'example-vision', 'futuremodel:9b']);
+ for (const option of optionsOf(vision)) expect(optionsOf(text)).toContain(option);
+ expect(optionsOf(vision)).not.toContain('example-text');
+ expect(optionsOf(vision)).not.toContain('example-embed');
+ });
+
+ it('offers a server-classified vision model the id regex does not recognize', async () => {
+ local.vision = { idsByProvider: { ollama: new Set() }, loaded: true };
+ renderPage('/stacker-news');
+ await screen.findByRole('heading', { name: 'Add account' });
+ // Without the server map only the regex-recognizable id survives.
+ expect(optionsOf(modelSelects().vision)).toEqual(['Disabled', 'example-vision']);
+ });
+
+ it('keeps a stored vision model that is no longer offered and saves it unchanged', async () => {
+ const user = userEvent.setup();
+ const retired = { ...accounts[0], visionModel: 'retired-multimodal:7b' };
+ api.getStackerNewsAccounts.mockResolvedValue({ accounts: [retired, accounts[1]] });
+ api.updateStackerNewsAccount.mockResolvedValue(retired);
+ renderPage('/stacker-news/a1/accounts');
+ await screen.findByDisplayValue('Curate visual work');
+ const vision = screen.getByLabelText('Ollama vision model', { selector: '#edit-account-vision-model' });
+ expect(optionsOf(vision)).toContain('retired-multimodal:7b (configured)');
+ expect(vision).toHaveValue('retired-multimodal:7b');
+ await user.click(screen.getByRole('button', { name: 'Save account' }));
+ await waitFor(() => expect(api.updateStackerNewsAccount).toHaveBeenCalledWith('a1', expect.objectContaining({ visionModel: 'retired-multimodal:7b' }), { silent: true }));
+ });
+
+ it('does not claim there is no vision model while the capability fetch is in flight', async () => {
+ local.models = { ollama: ['example-text'], loading: false };
+ local.vision = { idsByProvider: null, loaded: false };
+ renderPage('/stacker-news');
+ await screen.findByRole('heading', { name: 'Add account' });
+ expect(screen.getByText(/Checking which installed Ollama models can read an image/)).toBeInTheDocument();
+ expect(screen.queryByText(/No vision-capable Ollama model installed/)).not.toBeInTheDocument();
+ });
+
+ it('says so explicitly once the capability fetch settles with no vision model installed', async () => {
+ local.models = { ollama: ['example-text'], loading: false };
+ local.vision = { idsByProvider: { ollama: new Set() }, loaded: true };
+ renderPage('/stacker-news');
+ await screen.findByRole('heading', { name: 'Add account' });
+ expect(screen.getByText(/No vision-capable Ollama model installed/)).toBeInTheDocument();
+ expect(optionsOf(modelSelects().vision)).toEqual(['Disabled']);
+ });
+
it('edits and deletes configured communities through inline controls', async () => {
const user = userEvent.setup();
const territory = { id: 't1', accountId: 'a1', slug: 'art', label: 'Art', isOwned: false, monitoringEnabled: null, inheritAccountRules: true, rules: {} };