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: exempt programmatic-I/O tasks from the commit success criterion (#2700)

[._.]/ Adam Eivy8e1628f6f57b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 31a598895f..cb1e46d1ae 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -26,6 +26,8 @@
## Fixed
+- [issue-2700] **Layered Intelligence runs were being recorded as failures even when they succeeded.** An LI run is a *reasoning* run: it's explicitly told not to commit or open a PR, and hands its result back through a sentinel file instead. But the shared success check only knows how to look for a code commit, and its verdict overrides the run's actual exit code — so every correct LI run was filed as a failure, dragging the loop's success rate toward 0% and skewing anything built on it (task routing, the CoS Learning card, duration estimates). Task types that hand back results programmatically rather than as a commit are now exempt from the commit check, the same way pipeline and media jobs already were. Ordinary code tasks are still held to it.
+
- **The Scene evaluation model dropdown no longer comes up empty when you have vision models installed.** Picking Ollama for a Creative Director project's Scene evaluation showed an empty model list (and a bare text box) even with vision-capable models pulled, because the browser decided what counts as a vision model from a hard-coded list of model-name patterns that knew `gemma-3` but not `gemma4` — so `gemma4:e4b` and `qwen3.6:35b` were filtered out as if they were text-only. Vision pickers now ask the server, which reads each model's real capabilities from the backend itself (Ollama's `/api/show`, LM Studio's `vlm` tag), and union that with the old name matching — so a newer model family shows up without waiting for the pattern list to catch up, and nothing that used to be offered disappears. The AI Assignments table's vision rows get the same fix. Also, the Scene evaluation stage now explains that it needs an API provider (Ollama / LM Studio) and can't use an agent CLI/TUI provider such as Claude Ollama TUI — pinning one there was silently ignored at run time — and a provider with no vision model installed now says so, with a link to install one, instead of showing an empty dropdown.
- The Chief of Staff status panel's Learning card no longer spills its skipped-task count outside the card on mobile. The "(3 skipped)" note used to sit beside the success rate on one line, where it was too wide to fit a narrow card and rendered past the border; it now sits on its own line under the percentage and truncates if it can't fit.
- The Brain **Graph** tab is now usable on a phone. The graph canvas sizes itself to the viewport instead of a fixed 500px (which overflowed a landscape phone entirely and left no room to scroll past a canvas that swallows drags), the controls bar stacks into readable rows instead of cramming a breadcrumb, seven type filters, and both buttons into one line, and the type filters wrap with a proper tap target. The legend — ten rows that blanketed a phone-sized graph — now shows automatically only when there's room for it and collapses behind a "Legend" toggle everywhere else, including a landscape phone (which is wide enough to look like a desktop but far too short). The hover tooltip no longer flashes under your finger advertising a double-click that touch can't do (tap the node and use the detail panel's "Explore connections" instead), and it no longer runs off the right edge in a narrow window. "Explore connections" moved out of a cramped side column onto its own full-width row, above the record text so it stays reachable on a long entry.
diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.js
index 67e031e29f..5363e45b28 100644
--- a/server/services/agentLifecycle.js
+++ b/server/services/agentLifecycle.js
@@ -21,6 +21,7 @@ import { createToolExecution, startExecution, completeExecution, errorExecution
import { determineLane, acquire, release } from './executionLanes.js';
import { analyzeAgentFailure, resolveFailedTaskUpdate, resolveTypeFailureSignal } from './agentErrorAnalysis.js';
import { createAgentRun, completeAgentRun, checkForTaskCommit } from './agentRunTracking.js';
+import { isProgrammaticIoTaskType } from './taskTypeHooks.js';
import { buildAgentPrompt, getAppWorkspace } from './agentPromptBuilder.js';
import { isOllamaClaudeProvider, isClaudeCommand, providerSuppliesGithubToken } from '../lib/providerModels.js';
import { buildOpencodeEnvVars } from '../lib/opencodeConfig.js';
@@ -830,6 +831,15 @@ export async function evaluateSuccessCriteria({ task, terminatedByUser, workspac
// validation miss (which would also pollute the correlation window). null =
// no commit criterion declared for this task shape.
if (task?.metadata?.pipeline || task?.metadata?.mediaJob) return null;
+ // Programmatic-I/O tasks (taskTypeHooks.js) are the same story one step further:
+ // their deliverable is the `.agent-done` sentinel an output hook consumes, and
+ // their prompts explicitly FORBID committing or opening a PR (the worktree is
+ // discarded). Checking for a `[task-<id>]` commit would therefore mark every
+ // correctly-executed run a failure — and because a declared verdict OVERRIDES the
+ // runner's exit code in task-learning (`outcomeSuccess`), that poisons the type's
+ // success rate to ~0 and, through it, anything reading that rate back. null = no
+ // commit criterion declared for this task shape.
+ if (isProgrammaticIoTaskType(task?.metadata?.analysisType)) return null;
return await checkForTaskCommit(task.id, workspacePath);
}
diff --git a/server/services/agentLifecycle.successCriteria.test.js b/server/services/agentLifecycle.successCriteria.test.js
index 13acb0568d..033f70004b 100644
--- a/server/services/agentLifecycle.successCriteria.test.js
+++ b/server/services/agentLifecycle.successCriteria.test.js
@@ -44,6 +44,27 @@ describe('evaluateSuccessCriteria (#2344)', () => {
expect(checkForTaskCommit).not.toHaveBeenCalled();
});
+ it('returns null for a programmatic-I/O task — its deliverable is the sentinel, not a commit (#2700)', async () => {
+ // A layered-intelligence run is explicitly told NOT to commit or open a PR: it
+ // writes `.agent-done` and its output hook does the filing. Checking for a
+ // `[task-<id>]` commit would stamp validationPassed:false on every correct run —
+ // and since a declared verdict OVERRIDES the runner's exit code in task-learning,
+ // that recorded successful LI runs as failures and drove the type's success rate
+ // to ~0.
+ const task = { id: 't1', taskType: 'internal', metadata: { analysisType: 'layered-intelligence', selfImprovement: true } };
+ expect(await evaluateSuccessCriteria({ task, workspacePath: '/w' })).toBeNull();
+ expect(checkForTaskCommit).not.toHaveBeenCalled();
+ });
+
+ it('still applies the commit criterion to a NON-programmatic self-improvement task', async () => {
+ // The exemption is keyed on the taskTypeHooks registry, not on selfImprovement —
+ // an ordinary self-improve task still commits and must still be checked.
+ checkForTaskCommit.mockResolvedValueOnce(true);
+ const task = { id: 't1', taskType: 'internal', metadata: { analysisType: 'ui', selfImprovement: true } };
+ expect(await evaluateSuccessCriteria({ task, workspacePath: '/w' })).toBe(true);
+ expect(checkForTaskCommit).toHaveBeenCalledWith('t1', '/w');
+ });
+
it('returns the commit-check verdict for an autonomous code task (criterion declared)', async () => {
checkForTaskCommit.mockResolvedValueOnce(true);
expect(await evaluateSuccessCriteria({ task: { id: 't1', taskType: 'internal' }, workspacePath: '/w' })).toBe(true);
diff --git a/server/services/layeredIntelligence.js b/server/services/layeredIntelligence.js
index 8fcf814f8e..b1f3c36786 100644
--- a/server/services/layeredIntelligence.js
+++ b/server/services/layeredIntelligence.js
@@ -646,6 +646,32 @@ export function computeOutcomesReport({ outcomes = [], hasPlannedWork = false }
].join('\n');
}
+// How many closed-but-still-suppressed proposals selfEval names before it
+// summarizes the rest as a count. The block is a calibration aid, not a backlog
+// dump — an unbounded list would crowd out the sources it exists to be weighed
+// against, and past this many the reasoner has the pattern anyway.
+export const SELF_EVAL_MAX_SUPPRESSED_LISTED = 8;
+
+/**
+ * Identify a suppressed proposal for the prompt: its slug (the actual dedup key the
+ * reasoner must avoid re-using) plus its title for human-readable context. Returns
+ * null when neither is recoverable — an unidentifiable entry is left to the count
+ * rather than rendered as a mystery bullet the reasoner can't act on.
+ *
+ * Shapes vary by tracker: forge/jira rows carry `{ number, title, body }` (the slug
+ * lives in the body marker), while the `plan` filer yields bare `{ slug, state }`.
+ */
+export function describeSuppressedIssue(issue) {
+ const slug = issue?.slug
+ ? normalizeSlug(issue.slug)
+ : (extractSlugFromBody(issue?.body) || extractSlugFromBody(issue?.title));
+ const title = typeof issue?.title === 'string' ? issue.title.trim() : '';
+ if (!slug && !title) return null;
+ const ref = issue?.number ? `#${issue.number} ` : '';
+ if (!slug) return `${ref}${title}`.trim();
+ return `${ref}[${slug}]${title ? ` ${title}` : ''}`.trim();
+}
+
/**
* Format LI's self-evaluation block (#2700) — the loop's pre-filing quality check
* on its OWN reasoning. Pure + side-effect-free and NO LLM call: every line is
@@ -728,6 +754,23 @@ export function computeSelfEvalSummary({
? 'Re-proposing any of these is deterministically suppressed — the run is wasted. Propose something genuinely new.'
: 'Nothing is currently suppressed.'}`
);
+ // NAME the closed-but-suppressed ones. The open proposals are already listed in
+ // full elsewhere in the prompt, but a closed issue appears NOWHERE else — so
+ // without this the reasoner is told a number it cannot act on and can burn the
+ // whole run re-proposing something the dedup guard silently drops. Capped so a
+ // long tail can't crowd out the sources it is meant to be reasoning about.
+ if (closedSuppressed.length) {
+ const named = closedSuppressed
+ .map(i => describeSuppressedIssue(i))
+ .filter(Boolean)
+ .slice(0, SELF_EVAL_MAX_SUPPRESSED_LISTED);
+ if (named.length) {
+ lines.push(
+ ` Recently closed (do NOT re-propose): ${named.join('; ')}`
+ + `${closedSuppressed.length > named.length ? ` (+${closedSuppressed.length - named.length} more)` : ''}`
+ );
+ }
+ }
}
// --- Signal 3: is the LI machinery itself healthy? --------------------------
diff --git a/server/services/layeredIntelligence.test.js b/server/services/layeredIntelligence.test.js
index 8eb8dfa228..55f6e05c36 100644
--- a/server/services/layeredIntelligence.test.js
+++ b/server/services/layeredIntelligence.test.js
@@ -36,6 +36,8 @@ import {
readLiTaskMetrics,
LI_TASK_TYPE,
LI_SCHEDULED_TASK_TYPE,
+ SELF_EVAL_MAX_SUPPRESSED_LISTED,
+ describeSuppressedIssue,
LI_DEGRADED_SUCCESS_THRESHOLD,
LI_DEGRADED_MIN_SAMPLE,
PROPOSAL_OUTCOMES,
@@ -716,6 +718,46 @@ describe('computeSelfEvalSummary (#2700)', () => {
expect(report).toContain('deterministically suppressed');
});
+ it('NAMES the closed-but-suppressed proposals, not just their count', () => {
+ const now = Date.now();
+ const recent = new Date(now - 5 * 24 * 60 * 60 * 1000).toISOString();
+ const report = computeSelfEvalSummary({
+ existingIssues: [
+ { number: 12, title: 'Add telemetry', body: '<!-- lil-slug: add-telemetry -->', state: 'closed', closedAt: recent },
+ // The plan filer's bare shape carries a slug and nothing else.
+ { slug: 'fix-thing', state: 'closed' }
+ ],
+ now
+ });
+ // A closed issue appears nowhere else in the prompt — the reasoner can only
+ // avoid re-proposing it if selfEval names its dedup key.
+ expect(report).toContain('Recently closed (do NOT re-propose):');
+ expect(report).toContain('#12 [add-telemetry] Add telemetry');
+ expect(report).toContain('[fix-thing]');
+ });
+
+ it('caps the named list and counts the remainder', () => {
+ const now = Date.now();
+ const closedAt = new Date(now - 24 * 60 * 60 * 1000).toISOString();
+ const existingIssues = Array.from({ length: SELF_EVAL_MAX_SUPPRESSED_LISTED + 3 }, (_, i) => ({
+ slug: `item-${i}`, state: 'closed', closedAt
+ }));
+ const report = computeSelfEvalSummary({ existingIssues, now });
+ expect(report).toContain('[item-0]');
+ expect(report).toContain('(+3 more)');
+ expect(report).not.toContain(`[item-${SELF_EVAL_MAX_SUPPRESSED_LISTED}]`);
+ });
+
+ it('leaves an unidentifiable suppressed entry to the count rather than a mystery bullet', () => {
+ const now = Date.now();
+ const report = computeSelfEvalSummary({
+ existingIssues: [{ state: 'closed', closedAt: new Date(now - 1000).toISOString() }],
+ now
+ });
+ expect(report).toContain('plus 1 closed but still within the 30-day suppression window');
+ expect(report).not.toContain('Recently closed (do NOT re-propose):');
+ });
+
it('says so plainly when nothing is suppressed', () => {
const report = computeSelfEvalSummary({ existingIssues: [] });
expect(report).toContain('0 open');
diff --git a/server/services/taskTypeHooks.js b/server/services/taskTypeHooks.js
index 724e3c6ba6..5aa854d128 100644
--- a/server/services/taskTypeHooks.js
+++ b/server/services/taskTypeHooks.js
@@ -37,9 +37,24 @@ const HOOK_MODULES = {
};
async function loadHookModule(taskType) {
- const load = HOOK_MODULES[taskType];
- if (!load) return null;
- return load();
+ if (!isProgrammaticIoTaskType(taskType)) return null;
+ return HOOK_MODULES[taskType]();
+}
+
+/**
+ * Whether a task type routes through the programmatic-I/O path — i.e. its real
+ * output is the `.agent-done` sentinel an output hook consumes, NOT a
+ * `[task-<id>]` commit. Synchronous and import-free (a bare registry lookup), so
+ * it is safe to consult from hot paths like the agent finalize chain.
+ *
+ * This is what tells success-criteria validation that the commit criterion does
+ * not apply to these tasks (see evaluateSuccessCriteria): their prompts
+ * explicitly FORBID committing, so checking for a commit would mark every
+ * correct run a failure. `Object.hasOwn` — not a truthiness check — so an
+ * inherited key like 'constructor' can't masquerade as a registered type.
+ */
+export function isProgrammaticIoTaskType(taskType) {
+ return typeof taskType === 'string' && Object.hasOwn(HOOK_MODULES, taskType);
}
/**
diff --git a/server/services/taskTypeHooks.test.js b/server/services/taskTypeHooks.test.js
index 9d9a6d7e94..caae20ec56 100644
--- a/server/services/taskTypeHooks.test.js
+++ b/server/services/taskTypeHooks.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { getTaskInputHook, getTaskOutputHook } from './taskTypeHooks.js';
+import { getTaskInputHook, getTaskOutputHook, isProgrammaticIoTaskType } from './taskTypeHooks.js';
describe('taskTypeHooks registry', () => {
it('resolves both hooks for layered-intelligence to callables', async () => {
@@ -16,3 +16,19 @@ describe('taskTypeHooks registry', () => {
expect(await getTaskOutputHook('does-not-exist')).toBeNull();
});
});
+
+describe('isProgrammaticIoTaskType (#2700)', () => {
+ it('recognizes a registered programmatic-I/O task type', () => {
+ expect(isProgrammaticIoTaskType('layered-intelligence')).toBe(true);
+ });
+
+ it('rejects unregistered types, non-strings, and inherited Object keys', () => {
+ expect(isProgrammaticIoTaskType('ui')).toBe(false);
+ expect(isProgrammaticIoTaskType('')).toBe(false);
+ expect(isProgrammaticIoTaskType(undefined)).toBe(false);
+ expect(isProgrammaticIoTaskType(null)).toBe(false);
+ // A truthiness check on the registry object would let these through.
+ expect(isProgrammaticIoTaskType('constructor')).toBe(false);
+ expect(isProgrammaticIoTaskType('toString')).toBe(false);
+ });
+});