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
address review (codex): gate Run Now on the in-flight label save; widen GitLab label cap
[._.]/ Adam Eivy4f40ca83dcea
diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsxindex a0b55bec17..51ee0b2960 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx@@ -56,12 +56,19 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTriconst [editingPrompt, setEditingPrompt] = useState(false);const [promptValue, setPromptValue] = useState(config.prompt || '');// Comma-separated free text, committed to taskMetadata.issueExcludeLabels- // (an array) on blur.+ // (an array) on blur. Routes through setUpdating like every other handler+ // in this file so RunTaskButton (client/src/CLAUDE.md's "gate on in-flight+ // saves, not just the form" rule) can't fire against the pre-edit list+ // while this PATCH is still in flight.const excludeLabelsDraft = useFieldDraft((config.taskMetadata?.issueExcludeLabels || []).join(', '),- (next) => onUpdate(taskType, {- taskMetadata: { ...(config.taskMetadata || {}), issueExcludeLabels: next.split(',').map((s) => s.trim()).filter(Boolean) }- })+ async (next) => {+ setUpdating(true);+ await onUpdate(taskType, {+ taskMetadata: { ...(config.taskMetadata || {}), issueExcludeLabels: next.split(',').map((s) => s.trim()).filter(Boolean) }+ });+ setUpdating(false);+ });// Provider/model/effort pins are shared with the schedule card's quick// controls — same optimistic write + rollback, one implementation.diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsxindex 6fb73f2786..479696cb67 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, afterEach } from 'vitest';-import { render, screen, fireEvent, cleanup } from '@testing-library/react';+import { render, screen, fireEvent, cleanup, act } from '@testing-library/react';// The two hooks are the component's only API callers — stub them so the test// exercises the config controls, not the network.@@ -32,7 +32,7 @@ const BASE_CONFIG = {status: {},};-function renderControls({ taskMetadata, onUpdate = vi.fn(), taskType = 'feature-ideas', config: extraConfig = {} } = {}) {+function renderControls({ taskMetadata, onUpdate = vi.fn(), taskType = 'feature-ideas', config: extraConfig = {}, setUpdating = () => {} } = {}) {render(<GlobalConfigControlstaskType={taskType}@@ -43,7 +43,7 @@ function renderControls({ taskMetadata, onUpdate = vi.fn(), taskType = 'feature-providers={[]}apps={[]}updating={false}- setUpdating={() => {}}+ setUpdating={setUpdating}allTaskTypes={['feature-ideas']}/>);@@ -187,6 +187,31 @@ describe('GlobalConfigControls — issue exclude labels', () => {taskMetadata: { issueExcludeLabels: [] }});});++ it('gates RunTaskButton on the in-flight save (setUpdating around the commit)', async () => {+ let resolveUpdate;+ const onUpdate = vi.fn(() => new Promise((resolve) => { resolveUpdate = resolve; }));+ const setUpdating = vi.fn();+ renderControls({+ taskType: 'claim-issue',+ taskMetadata: { issueExcludeLabels: [] },+ onUpdate,+ setUpdating,+ });+ const input = screen.getByLabelText('Leave issues with these labels for humans');++ fireEvent.change(input, { target: { value: 'good first issue' } });+ fireEvent.blur(input);++ // setUpdating(true) must fire BEFORE the PATCH resolves, not after — a+ // caller that gates RunTaskButton on it needs the disable to take effect+ // while onUpdate is still in flight.+ expect(setUpdating).toHaveBeenCalledWith(true);+ expect(setUpdating).not.toHaveBeenCalledWith(false);++ await act(async () => { resolveUpdate(); await Promise.resolve(); });+ expect(setUpdating).toHaveBeenLastCalledWith(false);+ });});describe('GlobalConfigControls — require approval', () => {diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.jsindex b42545e645..29eacc8866 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -1536,12 +1536,20 @@ export const ISSUE_AUTHOR_FILTERS = ['self', 'collaborators', 'owner', 'any'];// an arbitrary label dump.export const MAX_ISSUE_EXCLUDE_LABELS = 20;+// Per-entry length cap. GitHub caps a label name at 50 chars; GitLab allows up+// to 255. Cap at GitLab's (larger) limit rather than GitHub's — a GitHub+// label can never exceed 50 anyway, so the wider cap is a no-op there, while+// capping at 50 would silently truncate a valid long GitLab label to a prefix+// that never matches the real label, making the exclusion silently no-op.+const MAX_ISSUE_EXCLUDE_LABEL_LENGTH = 255;+/*** Normalize a raw `issueExcludeLabels` list: keep only non-empty strings,- * trim, cap length per entry (GitHub's own label name limit), case-- * insensitively dedupe (labels are compared lowercased at read time), and cap- * the list at MAX_ISSUE_EXCLUDE_LABELS. Unlike reviewer usernames, label text- * is free-form ("good first issue") so no character-class restriction is+ * trim, cap length per entry (GitLab's label name limit — the larger of the+ * two forges', see MAX_ISSUE_EXCLUDE_LABEL_LENGTH), case-insensitively+ * dedupe (labels are compared lowercased at read time), and cap the list at+ * MAX_ISSUE_EXCLUDE_LABELS. Unlike reviewer usernames, label text is+ * free-form ("good first issue") so no character-class restriction is* applied beyond trimming. Non-array input → [].*/export function normalizeIssueExcludeLabels(list) {@@ -1550,7 +1558,7 @@ export function normalizeIssueExcludeLabels(list) {const out = [];for (const raw of list) {if (typeof raw !== 'string') continue;- const trimmed = raw.trim().slice(0, 50);+ const trimmed = raw.trim().slice(0, MAX_ISSUE_EXCLUDE_LABEL_LENGTH);if (!trimmed) continue;const key = trimmed.toLowerCase();if (seen.has(key)) continue;diff --git a/server/lib/validation.test.js b/server/lib/validation.test.jsindex e9a78ed7fa..04ea4da2a9 100644--- a/server/lib/validation.test.js+++ b/server/lib/validation.test.js@@ -955,6 +955,15 @@ describe('validation.js', () => {// Caps at MAX_ISSUE_EXCLUDE_LABELS (20).const many = Array.from({ length: 25 }, (_, i) => `label-${i}`);expect(sanitizeTaskMetadata({ issueExcludeLabels: many }).issueExcludeLabels).toHaveLength(20);+ // Per-entry length cap is GitLab's 255-char label limit, not GitHub's+ // narrower 50 — a valid long GitLab label must survive intact rather+ // than being truncated to a prefix that can never match the real label.+ const longLabel = 'x'.repeat(200);+ expect(sanitizeTaskMetadata({ issueExcludeLabels: [longLabel] }))+ .toEqual({ issueExcludeLabels: [longLabel] });+ const overLong = 'y'.repeat(300);+ expect(sanitizeTaskMetadata({ issueExcludeLabels: [overLong] }).issueExcludeLabels[0])+ .toHaveLength(255);});it('should accept swarmCount 0 + 2..6 and drop 1/out-of-range/non-integer', () => {