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
identify a run by its whole configuration, and label the button honestly
Adam Eivy1d5b07e6ee47
diff --git a/client/src/components/cos/JobCard.jsx b/client/src/components/cos/JobCard.jsxindex d05b13135e..c285e1974e 100644--- a/client/src/components/cos/JobCard.jsx+++ b/client/src/components/cos/JobCard.jsx@@ -728,13 +728,15 @@ export default function JobCard({three unlabeled glyphs. `mt-auto` keeps the row on the bottom edgewhen cards of unequal height share a grid row. */}<div className="flex items-center gap-2 mt-auto px-4 py-2.5 border-t border-port-border">+ {/* No aria-label on this one: it has visible text, and an aria-label would+ override it — leaving a speech-input user unable to activate "Run now"+ by saying what is written on it. Why it's disabled stays in the title. */}<buttontype="button"onClick={handleTrigger}disabled={editing || triggering}className={triggerButtonClass(editing || triggering)}title={editing ? 'Save changes before running job' : triggering ? 'Triggering job' : 'Run now'}- aria-label={editing ? 'Save changes before running job' : triggering ? 'Triggering job' : 'Run now'}><Play size={14} />{triggering ? 'Sending…' : 'Run now'}diff --git a/client/src/components/cos/tabs/JobsTab.jsx b/client/src/components/cos/tabs/JobsTab.jsxindex 1d6924021a..2200b8ba3f 100644--- a/client/src/components/cos/tabs/JobsTab.jsx+++ b/client/src/components/cos/tabs/JobsTab.jsx@@ -48,6 +48,8 @@ const INITIAL_JOB = {export default function JobsTab() {const timezone = useUserTimezone();const [jobs, setJobs] = useState([]);+ // The job whose trigger is in flight, so its card can disable Run now.+ const [triggering, setTriggering] = useState(null);const [apps, setApps] = useState([]);const [rawProviders, setRawProviders] = useState([]);const [activeProviderId, setActiveProviderId] = useState('');@@ -138,10 +140,15 @@ export default function JobsTab() {// declares one — the values apply to this run only and are not saved.const handleTrigger = async (jobId, runOptions) => {toast.loading('Triggering job...', { id: 'job-trigger' });+ // Held so the card can disable its own button: without it a second click+ // fires a second trigger, which for a re-aimed run comes back as a+ // confusing duplicate-skipped success.+ setTriggering(jobId);const result = await api.triggerCosJob(jobId, { ...runOptions, silent: true }).catch(err => {toast.error(err.message, { id: 'job-trigger' });return null;});+ setTriggering(null);if (result) {if (result.status === 'skipped') {const notify = result.duplicate ? toast.success : toast.error;@@ -374,6 +381,7 @@ export default function JobsTab() {dataInputCatalog={dataInputCatalog}onToggle={handleToggle}onTrigger={handleTrigger}+ triggering={triggering === job.id}onDelete={handleDelete}onUpdate={fetchJobs}/>diff --git a/client/src/components/cos/tabs/JobsTab.test.jsx b/client/src/components/cos/tabs/JobsTab.test.jsxindex 0765738bd8..6f92d513e5 100644--- a/client/src/components/cos/tabs/JobsTab.test.jsx+++ b/client/src/components/cos/tabs/JobsTab.test.jsx@@ -79,8 +79,9 @@ describe('JobsTab / JobCard Run Now disable behavior (#4036)', () => {const editButton = screen.getByRole('button', { name: 'Edit' });fireEvent.click(editButton);- // Now Run now button should be disabled with updated title & aria-label- const disabledRunNowButton = screen.getByRole('button', { name: 'Save changes before running job' });+ // The name stays the visible "Run now" (an aria-label would hide it from a+ // speech-input user); the reason it is disabled lives in the title.+ const disabledRunNowButton = screen.getByRole('button', { name: 'Run now' });expect(disabledRunNowButton).toBeDisabled();expect(disabledRunNowButton).toHaveAttribute('title', 'Save changes before running job');@@ -103,7 +104,9 @@ describe('JobsTab / JobCard Run Now disable behavior (#4036)', () => {const editButton = screen.getByRole('button', { name: 'Edit' });fireEvent.click(editButton);- expect(screen.getByRole('button', { name: 'Save changes before running job' })).toBeDisabled();+ const editingRunNow = screen.getByRole('button', { name: 'Run now' });+ expect(editingRunNow).toBeDisabled();+ expect(editingRunNow).toHaveAttribute('title', 'Save changes before running job');// Click Cancel buttonconst cancelButton = screen.getByRole('button', { name: 'Cancel' });diff --git a/client/src/services/apiAgents.test.js b/client/src/services/apiAgents.test.jsindex b58694f3ba..b922892334 100644--- a/client/src/services/apiAgents.test.js+++ b/client/src/services/apiAgents.test.js@@ -1,5 +1,5 @@import { afterEach, expect, it, vi } from 'vitest';-import { startMaintenanceRun, getCosAgentDates, hydrateCosAgentDescription } from './apiAgents';+import { startMaintenanceRun, getCosAgentDates, hydrateCosAgentDescription, triggerCosJob } from './apiAgents';// Exercise the real API wrapper through HTTP serialization: mocking the wrapper// in the form test cannot catch a selected mode being dropped before POST.@@ -66,3 +66,22 @@ it('asks for the newest bucket alongside the bucket list when hydrating', asyncawait getCosAgentDates();expect(fetchMock.mock.calls[1][0]).not.toContain('hydrate');});++// The one place a card's ad-hoc values become a request body. Every component+// suite mocks this module, so a regression that let `formValues` fall through+// into the fetch init instead of the body would leave all of those green while+// no run was ever actually re-aimed.+it('puts a one-off run configuration in the trigger body, and sends none without one', async () => {+ const fetchMock = okJson({ success: true });+ vi.stubGlobal('fetch', fetchMock);++ await triggerCosJob('job-1', { formValues: { subject: 'x' } });+ const [url, withValues] = fetchMock.mock.calls[0];+ expect(url).toContain('/cos/jobs/job-1/trigger');+ expect(withValues.method).toBe('POST');+ expect(JSON.parse(withValues.body)).toEqual({ formValues: { subject: 'x' } });++ await triggerCosJob('job-1', { silent: true });+ const [, asSaved] = fetchMock.mock.calls[1];+ expect(asSaved.body).toBeUndefined();+});diff --git a/server/lib/jobFormFields.js b/server/lib/jobFormFields.jsindex 8ac25493af..3f52dd609d 100644--- a/server/lib/jobFormFields.js+++ b/server/lib/jobFormFields.js@@ -186,7 +186,10 @@ export function describeReaimedValues(fields, savedValues, runValues) {if (changed.length === 0) return '';const parts = changed.slice(0, REAIM_MAX_FIELDS).map((field) => {- const label = String(field.label || field.key).trim();+ // Collapsed like the value below: a label may legitimately contain a newline+ // (the schema only bounds its length), and one newline anywhere in the tag+ // pushes the digest onto line 2, where firstLine() drops it.+ const label = String(field.label || field.key).replace(/\s+/g, ' ').trim();const raw = comparableValue(field, runValues?.[field.key]).trim();// Collapse newlines: this rides on the description's FIRST line, and a// multi-line value would push the rest out of the dedupe key entirely.@@ -197,8 +200,12 @@ export function describeReaimedValues(fields, savedValues, runValues) {});if (changed.length > REAIM_MAX_FIELDS) parts.push(`+${changed.length - REAIM_MAX_FIELDS} more`);- // ALWAYS carry a digest of the full changed set — the readable part above is- // for the human, this is the identity. The dedupe key is+ // ALWAYS carry a digest of the WHOLE effective configuration — the readable+ // part above is for the human, this is the identity. The whole configuration+ // rather than just the delta, because the delta is relative to a baseline that+ // itself moves: re-aiming one field, then editing the job's saved value for a+ // DIFFERENT field and re-aiming the first the same way, yields an identical+ // changed set for two materially different runs. The dedupe key is// `firstLine(description).toLowerCase()`, and the readable form is a// case-folded, separator-ambiguous, clipped encoding: `Subject: acme` and// `Subject: Acme` collide, as do one value containing `, ` and two fields that@@ -209,7 +216,7 @@ export function describeReaimedValues(fields, savedValues, runValues) {// renderings happened to lose information.// JSON rather than a joined string: any separator character can itself occur// inside a value, which would let two different changed sets encode alike.- const full = JSON.stringify(changed.map((field) => [field.key, comparableValue(field, runValues?.[field.key])]));+ const full = JSON.stringify(fields.filter((field) => field?.key).map((field) => [field.key, comparableValue(field, runValues?.[field.key])]));parts.push(createHash('sha1').update(full).digest('hex').slice(0, 8));return parts.join(', ');}diff --git a/server/lib/jobFormFields.test.js b/server/lib/jobFormFields.test.jsindex 8107f09c4a..eb4374f5b3 100644--- a/server/lib/jobFormFields.test.js+++ b/server/lib/jobFormFields.test.js@@ -165,6 +165,20 @@ describe('describeReaimedValues', () => {expect(first.toLowerCase()).not.toBe(second.toLowerCase());});+ it('stays distinct when the same delta sits on a different saved baseline', () => {+ const two = [subject, { key: 'depth', label: 'Depth', type: 'text' }];+ // Same changed field, same new value — but the run genuinely differs,+ // because the value it inherits for the other field has moved.+ const first = describeReaimedValues(two, { subject: 'x', depth: 'shallow' }, { subject: 'A', depth: 'shallow' });+ const second = describeReaimedValues(two, { subject: 'x', depth: 'deep' }, { subject: 'A', depth: 'deep' });+ expect(first.toLowerCase()).not.toBe(second.toLowerCase());+ });++ it('keeps the tag on one line even when a label contains a newline', () => {+ const odd = { key: 'subject', label: 'Sub\nject', type: 'text' };+ expect(describeReaimedValues([odd], { subject: 'x' }, { subject: 'A' })).not.toContain('\n');+ });+it('stays distinct when the readable form clips a long value', () => {const shared = 'x'.repeat(60);const first = describeReaimedValues([brief], { brief: '' }, { brief: `${shared}AAA` });