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: compare reasoning efforts by task cost by default (#8245)
[._.]/673450f6e24c
diff --git a/client/src/components/models/ModelComparison.jsx b/client/src/components/models/ModelComparison.jsxindex 1ff1100cf7..7e4ad9c69a 100644--- a/client/src/components/models/ModelComparison.jsx+++ b/client/src/components/models/ModelComparison.jsx@@ -10,10 +10,10 @@ const STORAGE = 'portos-composite-comparison-v1';const COLORS = ['#2563eb', '#f97316', '#16a34a', '#9333ea', '#0891b2', '#db2777', '#ca8a04', '#dc2626'];const EFFORTS = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra', 'unspecified', 'reasoning'];const PRICES = [+ ['costPerTask', 'Cost per benchmark task (recommended)', 'USD / Intelligence Index task'],['blendedPerMillion', 'Blended token price (3:1 input/output)', 'USD / 1M total tokens'],['inputPerMillion', 'Input token price', 'USD / 1M input tokens'],['outputPerMillion', 'Output token price', 'USD / 1M output tokens'],- ['costPerTask', 'Sourced benchmark task cost', 'USD / Intelligence Index task'],];const buttonClass = 'rounded-lg border border-port-border px-3 py-2 text-xs disabled:opacity-50';const valueText = (metric, money = false) => metric ? `${metric.estimated ? '≈ ' : ''}${money ? formatUsd(metric.value, { maximumFractionDigits: 4 }) : formatCount(metric.value, { maximumFractionDigits: 1 })}` : 'Needs research';@@ -68,7 +68,11 @@ export default function ModelComparison() {models: Array.isArray(saved?.models) ? saved.models : null,efforts: Array.isArray(saved?.efforts) ? saved.efforts : null,provider: typeof saved?.provider === 'string' ? saved.provider : '',- priceId: PRICES.some(([id]) => id === saved?.priceId) ? saved.priceId : 'blendedPerMillion',+ // Upgrade the old token-rate default once, retaining model/effort filters.+ axisVersion: 2,+ priceId: saved?.axisVersion !== 2 && saved?.priceId === 'blendedPerMillion'+ ? 'costPerTask'+ : PRICES.some(([id]) => id === saved?.priceId) ? saved.priceId : 'costPerTask',height: [420, 600, 720].includes(saved?.height) ? saved.height : 600,log: saved?.log === true,};@@ -106,7 +110,7 @@ export default function ModelComparison() {const selected = scoped.filter(row => (settings.models === null || settings.models.includes(row.model)) && (settings.efforts === null || settings.efforts.includes(row.effort)));const price = PRICES.find(([id]) => id === settings.priceId) || PRICES[0];const plotCandidates = selected.filter(row => row.quality && row[price[0]] && (showEstimates || (!row.quality.estimated && !row[price[0]].estimated)) && (!settings.log || row[price[0]].value > 0))- .map(row => ({ ...row, x: row[price[0]].value, y: row.quality.value, label: `${row.model} (${row.effort})${row.quality.estimated ? ' ≈' : ''}` }));+ .map(row => ({ ...row, x: row[price[0]].value, y: row.quality.value, label: `${row.model} (${row.effort})${row.quality.estimated || row[price[0]].estimated ? ' ≈' : ''}` }));const plotted = [...plotCandidates.reduce((unique, row) => {const key = `${row.model}:${row.effort}:${row.x}:${row.y}:${row.quality.estimated}:${row[price[0]].estimated}`;const prior = unique.get(key);@@ -159,7 +163,9 @@ export default function ModelComparison() {</ScatterChart></ResponsiveContainer></div> : <p className="p-10 text-center text-sm text-port-text-muted">{loading ? 'Loading comparison…' : 'No points match these choices. Select models and efforts, change the cost axis, or research missing evidence.'}</p>}<div className="flex flex-wrap gap-3 text-xs" aria-label="Chart legend">{[...new Set(plotted.map(row => row.model))].map(model => <span key={model} className="break-all" style={{ color: COLORS[models.indexOf(model) % COLORS.length] }}>● {model}</span>)}</div>- <p className="mt-3 text-xs text-port-text-muted">Token prices are API references, not subscription charges or local operating costs. Effort usually changes token usage, not the per-token rate. Use sourced task cost to compare reasoning expense where published.</p>+ <p className="mt-3 text-xs text-port-text-muted">{price[0] === 'costPerTask'+ ? 'Task cost includes the token usage of each model and effort on the same benchmark. It is an API reference cost, not a quote for your workload or subscription. Missing task costs stay unplotted until researched; token rates are never substituted.'+ : 'Token price is the rate per token, not cost per task. Higher effort can use more reasoning tokens at the same rate, so vertical effort curves do not mean equal task cost. Choose Cost per benchmark task to compare reasoning expense.'}</p></section><ComparisonValueGuide rows={selected} /><GenerationDelta rows={selected} priceId={price[0]} />diff --git a/client/src/components/models/ModelComparison.test.jsx b/client/src/components/models/ModelComparison.test.jsxindex 54f61871ac..c039cb9b77 100644--- a/client/src/components/models/ModelComparison.test.jsx+++ b/client/src/components/models/ModelComparison.test.jsx@@ -11,7 +11,7 @@ vi.mock('recharts', () => ({XAxis: ({ label }) => <div data-testid="xaxis" data-label={label?.value} />, YAxis: () => null,}));const metric = (value, estimated = false) => ({ value, estimated, method: 'Example source', sources: [{ url: 'https://example.com', retrievedAt: '2026-09-01T00:00:00Z', methodology: 'Published' }] });-const row = (model, effort, quality, price, estimated = false) => ({ id: `${model}:${effort}`, providerId: 'example', provider: 'Example', model, modelKey: `example:${model}`, effort, quality: quality === null ? null : metric(quality, estimated), blendedPerMillion: metric(price), inputPerMillion: metric(price / 2), outputPerMillion: metric(price * 2), costPerTask: null, needsResearch: quality === null || estimated });+const row = (model, effort, quality, price, estimated = false) => ({ id: `${model}:${effort}`, providerId: 'example', provider: 'Example', model, modelKey: `example:${model}`, effort, quality: quality === null ? null : metric(quality, estimated), blendedPerMillion: metric(price), inputPerMillion: metric(price / 2), outputPerMillion: metric(price * 2), costPerTask: metric(price * (effort === 'high' ? 3 : 1)), needsResearch: quality === null || estimated });const rows = [row('gpt-6-luna', 'low', 21, 0.2), row('gpt-6-luna', 'high', 32, 0.2), row('gpt-5.6-luna', 'low', 20, 0.45), row('claude-opus-5-5', 'high', 56, 8), row('unknown-model', 'high', null, 0)];beforeEach(() => { localStorage.clear(); vi.clearAllMocks(); api.getModelComparison.mockResolvedValue({ composite: { anchor: 'Reference v1', rows } }); });@@ -21,7 +21,7 @@ it('compares generations and vendors together with quick model and effort toggleexpect(screen.queryByLabelText('Benchmark')).toBeNull();fireEvent.change(screen.getByLabelText('Filter models'), { target: { value: 'gpt-6-luna,opus' } });fireEvent.click(screen.getByRole('button', { name: 'Compare matching' }));- expect(screen.getByTestId('scatter-example:gpt-6-luna')).toHaveAttribute('data-values', '[[0.2,21],[0.2,32]]');+ expect(screen.getByTestId('scatter-example:gpt-6-luna')).toHaveAttribute('data-values', '[[0.2,21],[0.6000000000000001,32]]');expect(screen.getByTestId('scatter-example:claude-opus-5-5')).toBeTruthy();expect(screen.getByRole('region', { name: 'Pair comparison' })).toHaveTextContent('-24 points');expect(screen.queryByTestId('scatter-example:gpt-5.6-luna')).toBeNull();@@ -70,3 +70,34 @@ it('filters loaded chart evidence by provider and restores all providers withoutexpect(screen.getByTestId('scatter-peer:claude-opus-5-5')).toBeTruthy();expect(api.getModelComparison).toHaveBeenCalledTimes(1);});++it('upgrades the legacy token-rate default without losing filters and remembers an explicit token-rate choice', async () => {+ localStorage.setItem('portos-composite-comparison-v1', JSON.stringify({ priceId: 'blendedPerMillion', models: ['gpt-6-luna'], efforts: ['low', 'high'] }));+ const { unmount } = render(<ModelComparison />);+ await screen.findByTestId('scatter-example:gpt-6-luna');+ expect(screen.getByLabelText('Cost axis')).toHaveValue('costPerTask');+ expect(screen.queryByTestId('scatter-example:claude-opus-5-5')).toBeNull();+ expect(screen.getByTestId('scatter-example:gpt-6-luna')).toHaveAttribute('data-values', '[[0.2,21],[0.6000000000000001,32]]');+ fireEvent.change(screen.getByLabelText('Cost axis'), { target: { value: 'blendedPerMillion' } });+ expect(screen.getByTestId('scatter-example:gpt-6-luna')).toHaveAttribute('data-values', '[[0.2,21],[0.2,32]]');+ expect(screen.getByText(/vertical effort curves do not mean equal task cost/)).toBeTruthy();+ unmount();+ render(<ModelComparison />);+ await screen.findByTestId('scatter-example:gpt-6-luna');+ expect(screen.getByLabelText('Cost axis')).toHaveValue('blendedPerMillion');+});++it('never substitutes a token rate for missing task cost and lets users exclude estimated task costs', async () => {+ api.getModelComparison.mockResolvedValue({ composite: { rows: [+ { ...rows[0], costPerTask: null },+ { ...rows[1], costPerTask: metric(0.6, true) },+ { ...rows[3], costPerTask: metric(0) },+ ] } });+ render(<ModelComparison />);+ await screen.findByTestId('scatter-example:gpt-6-luna');+ expect(screen.getByTestId('scatter-example:gpt-6-luna')).toHaveAttribute('data-values', '[[0.6,32]]');+ expect(screen.getByTestId('scatter-example:claude-opus-5-5')).toHaveAttribute('data-values', '[[0,56]]');+ fireEvent.click(screen.getByLabelText('Include estimates'));+ expect(screen.queryByTestId('scatter-example:gpt-6-luna')).toBeNull();+ expect(screen.getByTestId('scatter-example:claude-opus-5-5')).toBeTruthy();+});