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

add a "ux" scheduled CoS task that audits the running UI and files issues (#3273)

[._.]/ Adam Eivy5510d26add56
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 633160ed2c..a8fa762d51 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -41,6 +41,8 @@
## Agents
- **[issue-3246] Completed direct-CLI agents now survive a PortOS restart without repeating their work.** When an agent has already written its completion sentinel, shutdown finalizes that result and dispatches its output instead of requeuing the task and potentially opening a duplicate pull request.
+- **[issue-3273] A new "UX/design audit" scheduled task reviews whether your screens are actually usable — and proposes, rather than rewrites.** The existing UI tasks are all narrow and all fix-and-commit: broken elements, viewport breakage, ARIA and contrast. None of them ask whether a primary action is buried below the fold, whether an empty state tells you what to do next, or whether two sibling screens confirm a delete two different ways. The `ux` task walks the running app against a seven-point checklist at desktop and mobile widths and files one issue per finding into whichever tracker the app uses — PLAN.md, GitHub, GitLab or JIRA — with the route, what the user was trying to do, why the design got in the way, the component file to change, and a size estimate. It touches no source code and opens no pull requests, because design judgment should be triaged by a human, not auto-merged. Off by default, like every other scheduled task.
+- **Tracker-filing tasks no longer score every successful run as a failure.** A task whose whole job is to file issues makes no commit, so the commit check that grades autonomous runs marked each correct run a miss and drove the task type's measured success rate toward zero — which in turn slowed its schedule. Runs that are expected to leave the working tree clean are now graded on whether they finished, not on whether they committed. This also fixes the same latent problem for reference-repo watching on GitHub, GitLab and JIRA projects.
## POST
diff --git a/client/src/components/UpcomingTasksWidget.jsx b/client/src/components/UpcomingTasksWidget.jsx
index 7f024ef0dd..bf5636f165 100644
--- a/client/src/components/UpcomingTasksWidget.jsx
+++ b/client/src/components/UpcomingTasksWidget.jsx
@@ -49,6 +49,7 @@ const UpcomingTasksWidget = memo(function UpcomingTasksWidget() {
'security': '🔒',
'ui-bugs': '🐛',
'mobile-responsive': '📱',
+ 'ux': '🎨',
'code-quality': '✨',
'console-errors': '🔧',
'performance': '⚡',
diff --git a/client/src/lib/cosTaskType.test.js b/client/src/lib/cosTaskType.test.js
index 30b7647170..0a6718791a 100644
--- a/client/src/lib/cosTaskType.test.js
+++ b/client/src/lib/cosTaskType.test.js
@@ -25,6 +25,33 @@ describe('extractCosTaskType', () => {
})).toBe('user-task');
});
+ // The `ux` audit (#3273) is a scheduled self-improvement type like any other:
+ // TaskItem/AgentCard classify it through this resolver, which is metadata-first
+ // and type-agnostic — so the new type needs no per-type heuristic, and adding
+ // one could only shadow a sibling. These pin that: a `ux` task lands in its own
+ // bucket even though its description is full of words the untyped classifiers
+ // key on ("review", "audit"), and the sibling viewport type is unaffected.
+ it('buckets scheduled ux audits and mobile-responsive runs by their own analysis type', () => {
+ expect(extractCosTaskType({
+ description: '[Self-Improvement] ux: review the design of each route',
+ taskType: 'internal',
+ metadata: { analysisType: 'ux' }
+ })).toBe('self-improve:ux');
+
+ expect(extractCosTaskType({
+ description: '[Self-Improvement] mobile-responsive: check each viewport',
+ taskType: 'internal',
+ metadata: { analysisType: 'mobile-responsive' }
+ })).toBe('self-improve:mobile-responsive');
+
+ // Archived-agent projection of the same run.
+ expect(extractCosTaskType({
+ description: 'UX/design audit',
+ taskType: 'internal',
+ metadata: { taskAnalysisType: 'ux' }
+ })).toBe('self-improve:ux');
+ });
+
it('supports tagged legacy tasks and safe untyped fallbacks', () => {
expect(extractCosTaskType({ description: '[self-improvement] accessibility - fix labels' }))
.toBe('self-improve:accessibility');
diff --git a/server/lib/README.md b/server/lib/README.md
index f0f53cfca5..47d3b9d615 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -306,7 +306,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `uploadLimits.js` | Single source of truth for upload size caps — `JSON_BODY_LIMIT`/`JSON_BODY_LIMIT_BYTES` (the express.json limit applied in `index.js`), `MAX_BASE64_UPLOAD_BYTES` derived from it (base64 ×4/3, so a bigger per-route cap is unreachable), `MAX_SCREENSHOT_BYTES`. Mirrored client-side as `JSON_UPLOAD_MAX_FILE_SIZE`. |
| `uuid.js` | `v4()` thin wrapper over `crypto.randomUUID()`. |
| `versionUtils.js` | `compareSemver(a, b)` — semver ordering (-1/0/1) with pre-release precedence and build-metadata stripping. Shared by the self-update checker (`updateChecker.js`) and the local-LLM Ollama update detector (`localLlm.js`). Inputs must be `v`-stripped. |
-| `workTracker.js` | `WORK_TRACKERS`/`CONCRETE_WORK_TRACKERS`/`DEFAULT_WORK_TRACKER`, `workTrackerLabel`, `hostToWorkTracker`, `isGithubHost` (GitHub-family host test — github.com + enterprise github.*; enterprise-aware replacement for the github.com-only `isGithub` gate), `githubRepoSpec(origin)` (host-qualified `HOST/OWNER/REPO` selector for `gh --repo`, or null for a non-GitHub origin — pairs the isGithubHost gate with the selector so prWatcher/branchReconcile/issueReconcile share one "resolvable GitHub repo" definition), `forgeCliForTracker`, `isFileTracker` (true when the tracker records work as repo files — PLAN.md — so an agent's proposal necessarily dirties the worktree; false for github/gitlab/jira), `trackerToClaimTaskType`, `hostFromOriginUrl` (subgroup-tolerant host parse), pure `resolveWorkTracker({configured,host})`, async `resolveAppWorkTracker(app)` — resolves a managed app's autonomous work source (PLAN.md / GitHub / GitLab / JIRA), defaulting `'auto'` to the git origin host. Consumed by the `claim-work` router in `cosTaskGenerator.js` and `routes/apps.js`. |
+| `workTracker.js` | `WORK_TRACKERS`/`CONCRETE_WORK_TRACKERS`/`DEFAULT_WORK_TRACKER`, `workTrackerLabel`, `hostToWorkTracker`, `isGithubHost` (GitHub-family host test — github.com + enterprise github.*; enterprise-aware replacement for the github.com-only `isGithub` gate), `githubRepoSpec(origin)` (host-qualified `HOST/OWNER/REPO` selector for `gh --repo`, or null for a non-GitHub origin — pairs the isGithubHost gate with the selector so prWatcher/branchReconcile/issueReconcile share one "resolvable GitHub repo" definition), `forgeCliForTracker`, `isFileTracker` (true when the tracker records work as repo files — PLAN.md — so an agent's proposal necessarily dirties the worktree; false for github/gitlab/jira), `trackerToClaimTaskType`, `hostFromOriginUrl` (subgroup-tolerant host parse), pure `resolveWorkTracker({configured,host})`, async `resolveAppWorkTracker(app)` — resolves a managed app's autonomous work source (PLAN.md / GitHub / GitLab / JIRA), defaulting `'auto'` to the git origin host. Also owns the `{trackerInstructions}` prompt block shared by the TRACKER-FILING task types (types that read the app read-only and deliver findings as tracker items, not a commit): `TRACKER_FILING_PRESETS` (per-task-type slug prefix / label / body requirements — `reference-watch`, `ux`), `TRACKER_FILING_TASK_TYPES` (derived from the presets, so a gated type always has wording), and `formatTrackerInstructions(tracker, options)` which renders the plan/github/gitlab/jira block (reference-watch is the default option set, so a bare call stays byte-identical for it). Consumed by the `claim-work` router in `cosTaskGenerator.js`, `referenceRepos.js`, and `routes/apps.js`. |
| `workspaceRoots.js` | Shared allow-list for routes that take a caller-supplied filesystem path. `ALLOWED_WORKSPACE_ROOTS` (defaults + `PORTOS_WORKSPACE_ROOTS`, symlink-resolved), `isWithinRoot(resolvedPath, root)` (separator-safe containment), `isWithinAllowedRoots(realPath)`, and `WORKSPACE_ROOTS_CONFIGURED` (true when the operator set the env var — lets a permissive-by-default route like `routes/detect.js` opt into confinement). Used by `routes/commands.js` (always scoped) and `routes/detect.js` (scoped only when configured). |
| `zodCompat.js` | Zod 4 compatibility helpers. `partialWithoutDefaults(objectSchema)` — like `.partial()` but strips inner field defaults first, so a PATCH/update schema doesn't inject (and clobber) the stored values of fields the caller didn't send. Use for any update schema derived from a defaulted base. |
diff --git a/server/lib/workTracker.js b/server/lib/workTracker.js
index 31f2f71892..34b25300b0 100644
--- a/server/lib/workTracker.js
+++ b/server/lib/workTracker.js
@@ -139,6 +139,126 @@ export function isFileTracker(tracker) {
return !['github', 'gitlab', 'jira'].includes(tracker);
}
+// ── {trackerInstructions} — the shared "where to file what you found" block ──
+//
+// A TRACKER-FILING task type reads the app read-only and delivers its findings
+// as ITEMS IN THE APP'S TRACKER (PLAN.md checklist items / GitHub / GitLab
+// issues / JIRA tickets) rather than as a commit. `reference-watch` was the
+// first; `ux` is the second. The mechanics of "inventory existing items, record
+// one per finding, finalize" are identical across them — only the slug prefix,
+// the label, and the per-item body requirements differ — so the blocks live
+// here (next to the tracker resolution they key off) and are parameterized
+// rather than copied per task type.
+//
+// The blocks carry {appName}/{repoPath} placeholders that each dispatch path's
+// replace chain expands — every caller MUST substitute {trackerInstructions}
+// FIRST so these inner placeholders are filled too (see
+// referenceRepos.js#triggerReferenceAnalysis and
+// cosTaskGenerator.js#buildImprovementTaskDescription).
+
+/**
+ * Per-task-type wording for `formatTrackerInstructions`. Keyed by CoS task type;
+ * every key of `TRACKER_FILING_TASK_TYPES` (cosTaskGenerator.js) has an entry.
+ *
+ * `reference-watch` is ALSO the default option set, so a bare
+ * `formatTrackerInstructions(tracker)` still returns byte-identical output to the
+ * pre-generalization blocks that lived in referenceRepos.js (asserted in
+ * workTracker.trackerInstructions.test.js).
+ */
+export const TRACKER_FILING_PRESETS = {
+ 'reference-watch': {
+ // Every recorded item's title carries `[<slugPrefix>…]` so the inventory
+ // step can grep prior items in bulk and skip duplicates.
+ slugPrefix: 'ref-watch-',
+ // How the prose names this task's items ("list existing <label> issues").
+ label: 'reference-watch',
+ // The forge label applied to each filed issue (created if absent).
+ issueLabel: 'reference-watch',
+ labelDescription: 'Proposed from a reference-repo watch',
+ // Everything after `**<Short title.>** ` in the PLAN.md checklist item.
+ planItemBody: 'From `reference-watch` review of <ref name> (commit(s) `<sha>` [+ `<sha>` …], <today\'s date>). <1–2 sentences.> Fix: <files + functions in {appName}>. <Estimated scope.>',
+ // What the forge issue / JIRA description body must contain.
+ bodyRequirements: 'the provenance (ref + commit SHA(s) + today\'s date), the 1–2 sentence rationale, the `Fix:` line naming the {appName} files/functions to change, and the estimated scope',
+ planCommitMessage: 'docs(reference-watch): propose <N> item(s) from <ref names>',
+ },
+ ux: {
+ slugPrefix: 'ux-',
+ label: 'UX-audit',
+ issueLabel: 'ux',
+ labelDescription: 'Proposed from a UX/design audit',
+ planItemBody: 'From the `ux` audit of <route> (<today\'s date>). <What the user is trying to do and why the current design impedes it, 1–2 sentences.> Fix: <proposed change + the component file(s) in {appName}>. Scope: <small/medium/large>.',
+ bodyRequirements: 'the screen/route audited and the date, what the user is trying to do there, why the current design impedes it, a concrete proposed change naming the component file(s) in {appName}, and a `Scope:` of small/medium/large',
+ planCommitMessage: 'docs(ux): propose <N> UX finding(s)',
+ },
+};
+
+/**
+ * The CoS task types that file their findings into the app's work tracker.
+ * DERIVED from the preset table so the gate and the wording can never drift: a
+ * type in the gate with no preset would silently render reference-watch's slug
+ * and label into a different task's prompt.
+ */
+export const TRACKER_FILING_TASK_TYPES = new Set(Object.keys(TRACKER_FILING_PRESETS));
+
+/**
+ * Pick the {trackerInstructions} block for a resolved work tracker, falling back
+ * to the PLAN.md block for an unknown/missing tracker (matching `isFileTracker`,
+ * so the block a caller renders and the `worktreeChangesExpected` flag it stamps
+ * always agree). Exported for tests.
+ *
+ * @param {string} tracker resolved tracker ('plan' | 'github' | 'gitlab' | 'jira')
+ * @param {object} [options] wording overrides — see TRACKER_FILING_PRESETS
+ */
+export function formatTrackerInstructions(tracker, options = {}) {
+ const {
+ slugPrefix, label, issueLabel, labelDescription,
+ planItemBody, bodyRequirements, planCommitMessage,
+ } = { ...TRACKER_FILING_PRESETS['reference-watch'], ...options };
+ // `ref-watch-` → `ref-watch`: the forge title search wants the stem, not the
+ // trailing separator (`--search "ref-watch in:title"`).
+ const slugStem = slugPrefix.replace(/-+$/, '');
+
+ const blocks = {
+ plan: `This app records autonomous work in **PLAN.md** at the repo root ({repoPath}).
+
+- **Inventory:** Read PLAN.md from {repoPath}. Every existing checkbox carries a \`[<slug>]\` ID — collect the \`[${slugPrefix}…]\` ones so you don't duplicate. If PLAN.md does not exist, create it with a single top-level heading (\`# {appName} — Development Plan\`) and a \`## Next Up\` section before appending.
+- **Record** each proposal as a slug-tagged checklist item appended to the \`## Next Up\` section:
+ \`\`\`markdown
+ - [ ] [<slug>] **<Short title.>** ${planItemBody}
+ \`\`\`
+ Place **Maybe — needs human call** items in a \`### Trigger-gated (waiting for a precondition)\` subsection if one exists; otherwise append them under \`## Next Up\`.
+- **Finalize:** Commit the PLAN.md edit with message \`${planCommitMessage}\`. Do NOT create branches or PRs — \`/claim\` (or the \`plan-task\` agent) picks the slugs up later.`,
+
+ github: `This app tracks autonomous work in **GitHub Issues** (via the \`gh\` CLI), NOT PLAN.md — do NOT edit PLAN.md.
+
+- **Inventory:** From {repoPath}, resolve the repo (\`gh repo view --json nameWithOwner -q .nameWithOwner\`) and list existing ${label} issues so you don't duplicate: \`gh issue list --state all --search "${slugStem} in:title" --limit 100 --json number,title\`. Each carries a \`[${slugPrefix}…]\` slug in its title — collect them. If \`gh\` is not authenticated or the remote is not GitHub, exit cleanly.
+- **Record** each proposal as a new GitHub issue. Ensure the label exists first (\`gh label create ${issueLabel} --description "${labelDescription}" --force\`), then:
+ \`\`\`bash
+ gh issue create --title "[<slug>] <Short title>" --label ${issueLabel} --body "<body>"
+ \`\`\`
+ The body must contain ${bodyRequirements}. For **Maybe — needs human call** items, also add \`--label needs-decision\` (create it the same way if absent) and end the body with \`**Decision needed:** <one sentence>.\`.
+- **Finalize:** No source-code edits, no PLAN.md, no branches, no PRs — the issues ARE the deliverable. \`/claim --issues\` (the \`claim-issue\` flow) picks them up later.`,
+
+ gitlab: `This app tracks autonomous work in **GitLab Issues** (via the \`glab\` CLI), NOT PLAN.md — do NOT edit PLAN.md.
+
+- **Inventory:** From {repoPath}, confirm the forge (\`glab repo view\`) and list existing ${label} issues so you don't duplicate: \`glab issue list --label ${issueLabel} --per-page 100 -F json\` (also scan titles for the \`[${slugPrefix}…]\` slug). Collect the existing slugs. If \`glab\` is not authenticated or the remote is not GitLab, exit cleanly.
+- **Record** each proposal as a new GitLab issue:
+ \`\`\`bash
+ glab issue create --title "[<slug>] <Short title>" --label ${issueLabel} --description "<body>"
+ \`\`\`
+ (Run \`glab issue create --help\` if a flag is rejected — glab's flags evolve.) The body must contain ${bodyRequirements}. For **Maybe — needs human call** items, also add \`--label needs-decision\` and end the body with \`**Decision needed:** <one sentence>.\`.
+- **Finalize:** No source-code edits, no PLAN.md, no branches, no MRs — the issues ARE the deliverable. \`/claim --issues\` (the \`claim-issue-gitlab\` flow) picks them up later.`,
+
+ jira: `This app tracks autonomous work in **JIRA**. Create one JIRA issue per proposal in the app's configured project using whatever JIRA CLI/REST this environment provides. **If no JIRA credentials are available, fall back to recording proposals in PLAN.md at {repoPath} (slug-tagged \`- [ ] [<slug>] …\` checklist items under \`## Next Up\`, committed) and say so in your final summary.**
+
+- **Inventory:** Search existing JIRA issues (and PLAN.md, if you fall back) for the \`[${slugPrefix}…]\` slug so you don't duplicate; collect the existing slugs.
+- **Record** each proposal as a new JIRA issue whose summary starts with the \`[<slug>]\` tag. The description must contain ${bodyRequirements}. For **Maybe — needs human call** items, end the description with \`**Decision needed:** <one sentence>.\`.
+- **Finalize:** No source-code edits, no branches, no PRs — the tickets (or the committed PLAN.md fallback) ARE the deliverable. The \`claim-issue-jira\` flow picks them up later.`,
+ };
+
+ return blocks[tracker] || blocks.plan;
+}
+
/**
* The CoS claim task type that ships work from a concrete tracker. The
* claim-work router (cosTaskGenerator) delegates to one of these prompt bodies
diff --git a/server/lib/workTracker.trackerInstructions.test.js b/server/lib/workTracker.trackerInstructions.test.js
new file mode 100644
index 0000000000..be8e93bbba
--- /dev/null
+++ b/server/lib/workTracker.trackerInstructions.test.js
@@ -0,0 +1,125 @@
+/**
+ * {trackerInstructions} regression guard (#3273).
+ *
+ * `formatTrackerInstructions` was generalized out of referenceRepos.js so the
+ * `ux` task type can reuse the same "inventory / record / finalize" mechanics.
+ * The reference-watch prompt is at PROMPT_VERSIONS 3 and its stored copies on
+ * other installs are keyed to that version, so the generalization must be a
+ * pure refactor for reference-watch: these four expected strings are the blocks
+ * exactly as they shipped before the extraction. If a change here is
+ * intentional, it needs a reference-watch PROMPT_VERSIONS bump, not a test edit.
+ */
+
+import { describe, it, expect } from 'vitest';
+import { formatTrackerInstructions, TRACKER_FILING_PRESETS } from './workTracker.js';
+
+const REF_WATCH = { slugPrefix: 'ref-watch-', label: 'reference-watch', issueLabel: 'reference-watch' };
+
+const EXPECTED = {
+ plan: `This app records autonomous work in **PLAN.md** at the repo root ({repoPath}).
+
+- **Inventory:** Read PLAN.md from {repoPath}. Every existing checkbox carries a \`[<slug>]\` ID — collect the \`[ref-watch-…]\` ones so you don't duplicate. If PLAN.md does not exist, create it with a single top-level heading (\`# {appName} — Development Plan\`) and a \`## Next Up\` section before appending.
+- **Record** each proposal as a slug-tagged checklist item appended to the \`## Next Up\` section:
+ \`\`\`markdown
+ - [ ] [<slug>] **<Short title.>** From \`reference-watch\` review of <ref name> (commit(s) \`<sha>\` [+ \`<sha>\` …], <today's date>). <1–2 sentences.> Fix: <files + functions in {appName}>. <Estimated scope.>
+ \`\`\`
+ Place **Maybe — needs human call** items in a \`### Trigger-gated (waiting for a precondition)\` subsection if one exists; otherwise append them under \`## Next Up\`.
+- **Finalize:** Commit the PLAN.md edit with message \`docs(reference-watch): propose <N> item(s) from <ref names>\`. Do NOT create branches or PRs — \`/claim\` (or the \`plan-task\` agent) picks the slugs up later.`,
+
+ github: `This app tracks autonomous work in **GitHub Issues** (via the \`gh\` CLI), NOT PLAN.md — do NOT edit PLAN.md.
+
+- **Inventory:** From {repoPath}, resolve the repo (\`gh repo view --json nameWithOwner -q .nameWithOwner\`) and list existing reference-watch issues so you don't duplicate: \`gh issue list --state all --search "ref-watch in:title" --limit 100 --json number,title\`. Each carries a \`[ref-watch-…]\` slug in its title — collect them. If \`gh\` is not authenticated or the remote is not GitHub, exit cleanly.
+- **Record** each proposal as a new GitHub issue. Ensure the label exists first (\`gh label create reference-watch --description "Proposed from a reference-repo watch" --force\`), then:
+ \`\`\`bash
+ gh issue create --title "[<slug>] <Short title>" --label reference-watch --body "<body>"
+ \`\`\`
+ The body must contain the provenance (ref + commit SHA(s) + today's date), the 1–2 sentence rationale, the \`Fix:\` line naming the {appName} files/functions to change, and the estimated scope. For **Maybe — needs human call** items, also add \`--label needs-decision\` (create it the same way if absent) and end the body with \`**Decision needed:** <one sentence>.\`.
+- **Finalize:** No source-code edits, no PLAN.md, no branches, no PRs — the issues ARE the deliverable. \`/claim --issues\` (the \`claim-issue\` flow) picks them up later.`,
+
+ gitlab: `This app tracks autonomous work in **GitLab Issues** (via the \`glab\` CLI), NOT PLAN.md — do NOT edit PLAN.md.
+
+- **Inventory:** From {repoPath}, confirm the forge (\`glab repo view\`) and list existing reference-watch issues so you don't duplicate: \`glab issue list --label reference-watch --per-page 100 -F json\` (also scan titles for the \`[ref-watch-…]\` slug). Collect the existing slugs. If \`glab\` is not authenticated or the remote is not GitLab, exit cleanly.
+- **Record** each proposal as a new GitLab issue:
+ \`\`\`bash
+ glab issue create --title "[<slug>] <Short title>" --label reference-watch --description "<body>"
+ \`\`\`
+ (Run \`glab issue create --help\` if a flag is rejected — glab's flags evolve.) The body must contain the provenance (ref + commit SHA(s) + today's date), the 1–2 sentence rationale, the \`Fix:\` line naming the {appName} files/functions to change, and the estimated scope. For **Maybe — needs human call** items, also add \`--label needs-decision\` and end the body with \`**Decision needed:** <one sentence>.\`.
+- **Finalize:** No source-code edits, no PLAN.md, no branches, no MRs — the issues ARE the deliverable. \`/claim --issues\` (the \`claim-issue-gitlab\` flow) picks them up later.`,
+
+ jira: `This app tracks autonomous work in **JIRA**. Create one JIRA issue per proposal in the app's configured project using whatever JIRA CLI/REST this environment provides. **If no JIRA credentials are available, fall back to recording proposals in PLAN.md at {repoPath} (slug-tagged \`- [ ] [<slug>] …\` checklist items under \`## Next Up\`, committed) and say so in your final summary.**
+
+- **Inventory:** Search existing JIRA issues (and PLAN.md, if you fall back) for the \`[ref-watch-…]\` slug so you don't duplicate; collect the existing slugs.
+- **Record** each proposal as a new JIRA issue whose summary starts with the \`[<slug>]\` tag. The description must contain the provenance (ref + commit SHA(s) + today's date), the 1–2 sentence rationale, the \`Fix:\` line naming the {appName} files/functions to change, and the estimated scope. For **Maybe — needs human call** items, end the description with \`**Decision needed:** <one sentence>.\`.
+- **Finalize:** No source-code edits, no branches, no PRs — the tickets (or the committed PLAN.md fallback) ARE the deliverable. The \`claim-issue-jira\` flow picks them up later.`,
+};
+
+describe('formatTrackerInstructions — reference-watch byte-identity (#3273)', () => {
+ for (const tracker of ['plan', 'github', 'gitlab', 'jira']) {
+ it(`renders the pre-extraction ${tracker} block byte-for-byte`, () => {
+ expect(formatTrackerInstructions(tracker, REF_WATCH)).toBe(EXPECTED[tracker]);
+ });
+
+ it(`renders the same ${tracker} block with no options (referenceRepos back-compat)`, () => {
+ expect(formatTrackerInstructions(tracker)).toBe(EXPECTED[tracker]);
+ });
+
+ it(`renders the same ${tracker} block from the reference-watch preset`, () => {
+ expect(formatTrackerInstructions(tracker, TRACKER_FILING_PRESETS['reference-watch']))
+ .toBe(EXPECTED[tracker]);
+ });
+ }
+
+ it('falls back to the PLAN.md block for an unknown/missing tracker', () => {
+ expect(formatTrackerInstructions('nope')).toBe(EXPECTED.plan);
+ expect(formatTrackerInstructions(undefined)).toBe(EXPECTED.plan);
+ });
+});
+
+describe('formatTrackerInstructions — ux preset (#3273)', () => {
+ const ux = TRACKER_FILING_PRESETS.ux;
+
+ it('carries the ux slug prefix + label into every tracker block', () => {
+ for (const tracker of ['plan', 'github', 'gitlab', 'jira']) {
+ const block = formatTrackerInstructions(tracker, ux);
+ expect(block).toContain('[ux-…]');
+ expect(block).not.toContain('ref-watch');
+ expect(block).not.toContain('reference-watch');
+ }
+ });
+
+ it('labels filed forge issues `ux` and searches titles by the slug stem', () => {
+ const github = formatTrackerInstructions('github', ux);
+ expect(github).toContain('gh label create ux --description "Proposed from a UX/design audit" --force');
+ expect(github).toContain('--label ux --body');
+ expect(github).toContain('--search "ux in:title"');
+ expect(formatTrackerInstructions('gitlab', ux)).toContain('glab issue list --label ux');
+ });
+
+ it('keeps the read-only-on-source contract in every block', () => {
+ for (const tracker of ['github', 'gitlab', 'jira']) {
+ expect(formatTrackerInstructions(tracker, ux)).toContain('No source-code edits');
+ }
+ });
+
+ it('leaves {appName}/{repoPath} unexpanded for the caller replace chain', () => {
+ expect(formatTrackerInstructions('plan', ux)).toContain('{repoPath}');
+ expect(formatTrackerInstructions('github', ux)).toContain('{appName}');
+ });
+
+ // The SHIPPED prompt (not the generator's mocked stand-in) must fully expand:
+ // the tracker block is injected FIRST precisely because it carries {appName}/
+ // {repoPath} of its own, and a token that survives reaches the agent literally.
+ it('leaves no unexpanded {token} in the shipped ux prompt on any tracker', async () => {
+ const { DEFAULT_TASK_PROMPTS } = await import('../services/taskPromptDefaults.js');
+ const template = DEFAULT_TASK_PROMPTS['ux'];
+ expect(template).toContain('{trackerInstructions}');
+
+ for (const tracker of ['plan', 'github', 'gitlab', 'jira']) {
+ const rendered = template
+ .replace(/\{trackerInstructions\}/g, () => formatTrackerInstructions(tracker, ux))
+ .replace(/\{appName\}/g, () => 'Example App')
+ .replace(/\{repoPath\}/g, () => '/tmp/example-repo');
+ expect(rendered.match(/\{[a-zA-Z][a-zA-Z0-9_]*\}/g)).toBeNull();
+ }
+ });
+});
diff --git a/server/services/agentFinalization.js b/server/services/agentFinalization.js
index 0d1d8ac9ed..6565dba0f0 100644
--- a/server/services/agentFinalization.js
+++ b/server/services/agentFinalization.js
@@ -27,7 +27,7 @@ import { release } from './executionLanes.js';
import { completeExecution, errorExecution } from './toolStateMachine.js';
import { resolveFailedTaskUpdate, resolveTypeFailureSignal } from './agentErrorAnalysis.js';
import { completeAgentRun, checkForTaskCommit } from './agentRunTracking.js';
-import { canRunTaskOutputHookWithoutPayload, isProgrammaticIoTaskType, resolveTaskHookType, isNonCommittingCoordinatorTask } from './taskTypeHooks.js';
+import { canRunTaskOutputHookWithoutPayload, isProgrammaticIoTaskType, resolveTaskHookType, declaresNoCommitCriterion } from './taskTypeHooks.js';
import { processAgentCompletion } from './agentCompletion.js';
import { extractSimplifySummaries } from './agentSummaryExtraction.js';
@@ -114,7 +114,15 @@ export async function evaluateSuccessCriteria({ task, terminatedByUser, workspac
// by; fall back to the exit code (null = criterion undeclared). Uses the predicate (not a
// bare `scheduledType` lookup) so the archived `taskAnalysisType` shape resolves the same
// way the learning bucket does — see isNonCommittingCoordinatorTask.
- if (isNonCommittingCoordinatorTask(task)) return null;
+ //
+ // ALSO covers the per-task `worktreeChangesExpected: false` signal the
+ // tracker-filing types (reference-watch / ux) stamp at dispatch: on a
+ // github/gitlab/jira app they file issues/tickets out of band and make no
+ // commit at all, so the commit check would score every SUCCESSFUL run as a
+ // failure — the #2696 artifact again. The flag is per-task, not type-keyed,
+ // so the same type still gets its commit criterion on a `plan`-tracker app
+ // where it legitimately commits PLAN.md items (#3273).
+ if (declaresNoCommitCriterion(task)) return null;
return await checkForTaskCommit(task.id, workspacePath);
}
diff --git a/server/services/agentFinalization.outputHooks.test.js b/server/services/agentFinalization.outputHooks.test.js
index 2c69b1829e..d7b05438bb 100644
--- a/server/services/agentFinalization.outputHooks.test.js
+++ b/server/services/agentFinalization.outputHooks.test.js
@@ -12,7 +12,7 @@ vi.mock('./cosAgents.js', () => ({
vi.mock('./taskTypeHooks.js', () => ({
canRunTaskOutputHookWithoutPayload: vi.fn(() => true),
getTaskOutputHook: vi.fn(),
- isNonCommittingCoordinatorTask: vi.fn(() => false),
+ declaresNoCommitCriterion: vi.fn(() => false),
isProgrammaticIoTaskType: vi.fn(() => true),
resolveTaskHookType: vi.fn(task => task?.metadata?.analysisType || null),
}));
diff --git a/server/services/agentFinalization.successCriteria.test.js b/server/services/agentFinalization.successCriteria.test.js
index 3fbc6fd217..c810c7920f 100644
--- a/server/services/agentFinalization.successCriteria.test.js
+++ b/server/services/agentFinalization.successCriteria.test.js
@@ -57,6 +57,51 @@ describe('evaluateSuccessCriteria (#2344)', () => {
});
});
+/**
+ * Tracker-filing types (#3273). `reference-watch` and `ux` deliver their findings
+ * as tracker items, not as a commit — but only on a FORGE tracker: on a
+ * `plan`-tracker app the same type appends + commits PLAN.md checklist items. The
+ * static NON_COMMITTING_COORDINATOR_TASK_TYPES set cannot express "sometimes", so
+ * the criterion keys on the per-task `worktreeChangesExpected` flag the generator
+ * already derives from the resolved tracker.
+ */
+describe('evaluateSuccessCriteria — tracker-filing tasks (#3273)', () => {
+ beforeEach(() => vi.clearAllMocks());
+
+ const uxTask = (worktreeChangesExpected) => ({
+ id: 't1', taskType: 'internal',
+ metadata: { analysisType: 'ux', ...(worktreeChangesExpected === undefined ? {} : { worktreeChangesExpected }) },
+ });
+
+ it('declares NO criterion when worktreeChangesExpected is false (forge tracker)', async () => {
+ expect(await evaluateSuccessCriteria({ task: uxTask(false), workspacePath: '/w' })).toBeNull();
+ expect(checkForTaskCommit).not.toHaveBeenCalled();
+ });
+
+ it('accepts the string form the TASKS.md round-trip produces', async () => {
+ expect(await evaluateSuccessCriteria({ task: uxTask('false'), workspacePath: '/w' })).toBeNull();
+ expect(checkForTaskCommit).not.toHaveBeenCalled();
+ });
+
+ it('still applies the commit criterion when the flag is TRUE (plan tracker)', async () => {
+ checkForTaskCommit.mockResolvedValue(true);
+ expect(await evaluateSuccessCriteria({ task: uxTask(true), workspacePath: '/w' })).toBe(true);
+ expect(checkForTaskCommit).toHaveBeenCalledWith('t1', '/w');
+ });
+
+ it('still applies the commit criterion when the flag is ABSENT', async () => {
+ checkForTaskCommit.mockResolvedValue(false);
+ expect(await evaluateSuccessCriteria({ task: uxTask(undefined), workspacePath: '/w' })).toBe(false);
+ expect(checkForTaskCommit).toHaveBeenCalledWith('t1', '/w');
+ });
+
+ it('retro-fixes reference-watch on a forge tracker (the same latent artifact)', async () => {
+ const task = { id: 't2', taskType: 'internal', metadata: { analysisType: 'reference-watch', worktreeChangesExpected: false } };
+ expect(await evaluateSuccessCriteria({ task, workspacePath: '/w' })).toBeNull();
+ expect(checkForTaskCommit).not.toHaveBeenCalled();
+ });
+});
+
/**
* The programmatic-I/O criterion (#2727): these tasks declare their OWN success
* criterion — "the sentinel parsed and the output hook accepted it" — instead of
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index 28eb1ecf17..70a20d1e54 100644
--- a/server/services/cosTaskGenerator.js
+++ b/server/services/cosTaskGenerator.js
@@ -42,6 +42,7 @@ import { getCodeReviewDefaults } from './codeReview.js';
import { isHeldByOther, getClaimOwner } from './cosTaskClaim.js';
import { ensureInstanceId } from './instances.js';
import { PR_COMPLETION_VALUES } from '../lib/prDisposition.js';
+import { resolveAppWorkTracker, isFileTracker, formatTrackerInstructions, TRACKER_FILING_PRESETS, TRACKER_FILING_TASK_TYPES } from '../lib/workTracker.js';
/**
* Block a task that has exceeded the max spawn limit. Returns true if blocked.
@@ -2085,25 +2086,49 @@ async function resolveIssueReconcileBlock(app, taskType, metadata, taskSchedule)
return { skip: false, block };
}
+/**
+ * Resolve the {trackerInstructions} block naming where a tracker-filing task
+ * records what it found, plus the two metadata signals derived from the SAME
+ * resolved tracker so they can never disagree with the instructions the agent
+ * actually got (#3140, #3102):
+ * - `workTracker` — traceability
+ * - `worktreeChangesExpected` — the PLAN.md path commits checklist items
+ * (dirty tree); the github/gitlab/jira paths file issues/tickets out of band
+ * and legitimately leave the tree CLEAN.
+ *
+ * Mirrors `triggerReferenceAnalysis` (referenceRepos.js, the on-commit path)
+ * rather than restating its block table — both run `resolveAppWorkTracker` →
+ * `formatTrackerInstructions` / `isFileTracker`.
+ *
+ * A TRACKER-FILING type reads the app read-only and delivers its findings as
+ * items in the app's tracker rather than as a commit. The set is derived from
+ * `TRACKER_FILING_PRESETS`, so a type is gated in exactly when it has wording.
+ *
+ * Returns `{ trackerInstructions: '', workTracker: null }` for every other type.
+ */
+async function resolveTrackerFilingBlock(app, taskType) {
+ if (!TRACKER_FILING_TASK_TYPES.has(taskType)) return { trackerInstructions: '', workTracker: null };
+ // Never throws — degrades to the PLAN.md block, same as the on-commit path.
+ const workTracker = await resolveAppWorkTracker(app).catch(() => ({ resolved: 'plan' }));
+ return {
+ trackerInstructions: formatTrackerInstructions(workTracker.resolved, TRACKER_FILING_PRESETS[taskType]),
+ workTracker: workTracker.resolved,
+ worktreeChangesExpected: isFileTracker(workTracker.resolved),
+ };
+}
+
/**
* reference-watch: dynamically build {referenceData} — a Markdown chunk per ref
- * configured on the app + commits since lastReviewedSha — AND the
- * {trackerInstructions} block naming where the agent files its proposals. The
- * check persists status/lastError so a bad URL surfaces in the UI even when
- * dispatch is skipped.
+ * configured on the app + commits since lastReviewedSha. The check persists
+ * status/lastError so a bad URL surfaces in the UI even when dispatch is
+ * skipped. (The {trackerInstructions} half is shared with the other
+ * tracker-filing types — see `resolveTrackerFilingBlock` above.)
*
* Returns `{ skip }` when no ref produced reviewable commits, else
- * `{ skip: false, block, trackerInstructions, workTracker }`. Empty
- * block/instructions (and a null tracker) for every non-reference-watch type.
- *
- * The tracker resolution mirrors `triggerReferenceAnalysis` (the on-commit
- * trigger path) rather than restating its block table: both paths run
- * `resolveAppWorkTracker` → `formatTrackerInstructions` / `isFileTracker`, so
- * the prompt the agent gets and the `worktreeChangesExpected` flag stamped on
- * its task can never disagree (#3140, #3102).
+ * `{ skip: false, block }`. Empty block for every non-reference-watch type.
*/
async function resolveReferenceWatchBlock(app, taskType) {
- if (taskType !== 'reference-watch') return { skip: false, block: '', trackerInstructions: '', workTracker: null };
+ if (taskType !== 'reference-watch') return { skip: false, block: '' };
const refs = Array.isArray(app.referenceRepos) ? app.referenceRepos : [];
if (refs.length === 0) {
emitLog('info', `Skipping reference-watch for ${app.name}: no reference repos configured`, { appId: app.id });
@@ -2131,19 +2156,7 @@ async function resolveReferenceWatchBlock(app, taskType) {
emitLog('info', `Skipping reference-watch for ${app.name}: no refs produced reviewable commits`, { appId: app.id });
return { skip: true };
}
- // Where THIS app records autonomous work (PLAN.md / GitHub / GitLab / JIRA).
- // Never throws — degrades to the PLAN.md block, same as the on-commit path.
- const { resolveAppWorkTracker, isFileTracker } = await import('../lib/workTracker.js');
- const workTracker = await resolveAppWorkTracker(app).catch(() => ({ resolved: 'plan' }));
- return {
- skip: false,
- block: blocks.join('\n\n---\n\n'),
- trackerInstructions: referenceRepos.formatTrackerInstructions(workTracker.resolved),
- workTracker: workTracker.resolved,
- // Derived here (not at the call site) so the flag and the instructions come
- // off the same resolved value in one place.
- worktreeChangesExpected: isFileTracker(workTracker.resolved),
- };
+ return { skip: false, block: blocks.join('\n\n---\n\n') };
}
/**
@@ -2388,23 +2401,26 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st
: await getTaskPrompt(promptKeyForBody));
// reference-watch: dynamically inject {referenceData} — a Markdown chunk
- // describing each ref configured on the app + commits since lastReviewedSha —
- // plus the {trackerInstructions} block for the app's resolved work tracker.
+ // describing each ref configured on the app + commits since lastReviewedSha.
const referenceWatch = await resolveReferenceWatchBlock(app, taskType);
if (referenceWatch.skip) return null;
const referenceDataBlock = referenceWatch.block;
- if (referenceWatch.workTracker) {
+
+ // Tracker-filing types (reference-watch / ux): the {trackerInstructions} block
+ // for the app's resolved work tracker.
+ const trackerFiling = await resolveTrackerFilingBlock(app, taskType);
+ if (trackerFiling.workTracker) {
// Traceability + the TUI idle-complete gate, derived from the SAME resolved
// tracker that selected the {trackerInstructions} block above so the flag
// can't drift from the instructions the agent actually got: the PLAN.md path
// commits checklist items (dirty tree), while github/gitlab/jira file
// issues/tickets and leave the tree CLEAN. Without this a scheduled
// forge-tracker run is recorded as an `idle-no-changes` failure (#3102).
- metadata.workTracker = referenceWatch.workTracker;
+ metadata.workTracker = trackerFiling.workTracker;
// Stamped unconditionally — a schedule/per-app `worktreeChangesExpected`
// override would let the flag disagree with the instructions the agent
// actually got, which is the exact drift this derivation exists to prevent.
- metadata.worktreeChangesExpected = referenceWatch.worktreeChangesExpected;
+ metadata.worktreeChangesExpected = trackerFiling.worktreeChangesExpected;
}
// pr-watcher: poll the app's GitHub repo for PRs newly opened against the
@@ -2429,7 +2445,7 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st
promptTemplate, app, promptTaskType, metadata,
blocks: {
referenceData: referenceDataBlock,
- trackerInstructions: referenceWatch.trackerInstructions,
+ trackerInstructions: trackerFiling.trackerInstructions,
prData: prDataBlock,
inFlightBranches: inFlightBranchesBlock,
zombieIssues: zombieIssuesBlock,
diff --git a/server/services/cosTaskGenerator.referenceWatch.test.js b/server/services/cosTaskGenerator.referenceWatch.test.js
index 8abe517142..744136c1c4 100644
--- a/server/services/cosTaskGenerator.referenceWatch.test.js
+++ b/server/services/cosTaskGenerator.referenceWatch.test.js
@@ -181,3 +181,52 @@ describe('scheduled reference-watch prompt assembly (#3140)', () => {
expect(await generate(makeApp())).toBeNull();
});
});
+
+/**
+ * The `ux` audit (#3273) is the second TRACKER-FILING task type: it shares the
+ * {trackerInstructions} injection + `workTracker`/`worktreeChangesExpected`
+ * derivation with reference-watch (resolveTrackerFilingBlock), but is worded
+ * from its own TRACKER_FILING_PRESETS entry and never touches reference repos.
+ */
+describe('scheduled ux prompt assembly (#3273)', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ checkReferenceRepoMock.mockResolvedValue(SNAPSHOT);
+ });
+
+ const generateUx = (app) => generate(app, 'ux');
+
+ it('injects the ux-worded tracker block and expands its inner placeholders', async () => {
+ const app = makeApp({ workTracker: 'github' });
+ const task = await generateUx(app);
+ expect(task).not.toBeNull();
+ expect(task.description).not.toContain('{trackerInstructions}');
+ // ux wording, not reference-watch's.
+ expect(task.description).toContain('[ux-…]');
+ expect(task.description).toContain('gh label create ux');
+ expect(task.description).not.toContain('ref-watch');
+ // Ordering guard: {trackerInstructions} expands BEFORE {appName}/{repoPath}.
+ expect(task.description).not.toContain('{appName}');
+ expect(task.description).not.toContain('{repoPath}');
+ expect(task.description).toContain(app.name);
+ expect(task.description).toContain(app.repoPath);
+ });
+
+ it.each([
+ ['github', false],
+ ['gitlab', false],
+ ['jira', false],
+ ['plan', true],
+ ])('stamps workTracker + worktreeChangesExpected off the same resolved tracker (%s → %s)', async (tracker, expected) => {
+ const task = await generateUx(makeApp({ workTracker: tracker }));
+ expect(task.metadata.workTracker).toBe(tracker);
+ expect(task.metadata.worktreeChangesExpected).toBe(expected);
+ });
+
+ it('never checks reference repos — and dispatches on an app that has none', async () => {
+ const task = await generateUx(makeApp({ referenceRepos: [] }));
+ expect(task).not.toBeNull();
+ expect(task.metadata.workTracker).toBe('plan');
+ expect(checkReferenceRepoMock).not.toHaveBeenCalled();
+ });
+});
diff --git a/server/services/referenceRepos.js b/server/services/referenceRepos.js
index 1b3d36236f..990265ef76 100644
--- a/server/services/referenceRepos.js
+++ b/server/services/referenceRepos.js
@@ -36,7 +36,7 @@ import {
updateApp,
} from './apps.js';
import { DEFAULT_REVIEWER } from '../lib/validation.js';
-import { resolveAppWorkTracker, isFileTracker } from '../lib/workTracker.js';
+import { resolveAppWorkTracker, isFileTracker, formatTrackerInstructions } from '../lib/workTracker.js';
const REFERENCE_REPOS_ROOT = join(PATHS.data, 'cos', 'reference-repos');
@@ -578,59 +578,12 @@ export function formatReferenceForPrompt(ref, snapshot) {
}
// The reference-watch prompt's {trackerInstructions} block — where the agent
-// records its Adopt/Maybe proposals. v3 of the prompt no longer hardcodes
-// PLAN.md: it injects the block matching the app's RESOLVED work tracker, so an
-// app configured for GitHub issues gets `gh issue create` proposals instead of
-// a PLAN.md checklist. The blocks carry {appName}/{repoPath} placeholders that
-// each dispatch path's replace chain expands — both triggerReferenceAnalysis
-// (below) and buildImprovementTaskDescription (cosTaskGenerator.js) substitute
-// {trackerInstructions} FIRST so these inner placeholders are filled too.
-const TRACKER_INSTRUCTIONS = {
- plan: `This app records autonomous work in **PLAN.md** at the repo root ({repoPath}).
-
-- **Inventory:** Read PLAN.md from {repoPath}. Every existing checkbox carries a \`[<slug>]\` ID — collect the \`[ref-watch-…]\` ones so you don't duplicate. If PLAN.md does not exist, create it with a single top-level heading (\`# {appName} — Development Plan\`) and a \`## Next Up\` section before appending.
-- **Record** each proposal as a slug-tagged checklist item appended to the \`## Next Up\` section:
- \`\`\`markdown
- - [ ] [<slug>] **<Short title.>** From \`reference-watch\` review of <ref name> (commit(s) \`<sha>\` [+ \`<sha>\` …], <today's date>). <1–2 sentences.> Fix: <files + functions in {appName}>. <Estimated scope.>
- \`\`\`
- Place **Maybe — needs human call** items in a \`### Trigger-gated (waiting for a precondition)\` subsection if one exists; otherwise append them under \`## Next Up\`.
-- **Finalize:** Commit the PLAN.md edit with message \`docs(reference-watch): propose <N> item(s) from <ref names>\`. Do NOT create branches or PRs — \`/claim\` (or the \`plan-task\` agent) picks the slugs up later.`,
-
- github: `This app tracks autonomous work in **GitHub Issues** (via the \`gh\` CLI), NOT PLAN.md — do NOT edit PLAN.md.
-
-- **Inventory:** From {repoPath}, resolve the repo (\`gh repo view --json nameWithOwner -q .nameWithOwner\`) and list existing reference-watch issues so you don't duplicate: \`gh issue list --state all --search "ref-watch in:title" --limit 100 --json number,title\`. Each carries a \`[ref-watch-…]\` slug in its title — collect them. If \`gh\` is not authenticated or the remote is not GitHub, exit cleanly.
-- **Record** each proposal as a new GitHub issue. Ensure the label exists first (\`gh label create reference-watch --description "Proposed from a reference-repo watch" --force\`), then:
- \`\`\`bash
- gh issue create --title "[<slug>] <Short title>" --label reference-watch --body "<body>"
- \`\`\`
- The body must contain the provenance (ref + commit SHA(s) + today's date), the 1–2 sentence rationale, the \`Fix:\` line naming the {appName} files/functions to change, and the estimated scope. For **Maybe — needs human call** items, also add \`--label needs-decision\` (create it the same way if absent) and end the body with \`**Decision needed:** <one sentence>.\`.
-- **Finalize:** No source-code edits, no PLAN.md, no branches, no PRs — the issues ARE the deliverable. \`/claim --issues\` (the \`claim-issue\` flow) picks them up later.`,
-
- gitlab: `This app tracks autonomous work in **GitLab Issues** (via the \`glab\` CLI), NOT PLAN.md — do NOT edit PLAN.md.
-
-- **Inventory:** From {repoPath}, confirm the forge (\`glab repo view\`) and list existing reference-watch issues so you don't duplicate: \`glab issue list --label reference-watch --per-page 100 -F json\` (also scan titles for the \`[ref-watch-…]\` slug). Collect the existing slugs. If \`glab\` is not authenticated or the remote is not GitLab, exit cleanly.
-- **Record** each proposal as a new GitLab issue:
- \`\`\`bash
- glab issue create --title "[<slug>] <Short title>" --label reference-watch --description "<body>"
- \`\`\`
- (Run \`glab issue create --help\` if a flag is rejected — glab's flags evolve.) The body must contain the provenance (ref + commit SHA(s) + today's date), the 1–2 sentence rationale, the \`Fix:\` line naming the {appName} files/functions to change, and the estimated scope. For **Maybe — needs human call** items, also add \`--label needs-decision\` and end the body with \`**Decision needed:** <one sentence>.\`.
-- **Finalize:** No source-code edits, no PLAN.md, no branches, no MRs — the issues ARE the deliverable. \`/claim --issues\` (the \`claim-issue-gitlab\` flow) picks them up later.`,
-
- jira: `This app tracks autonomous work in **JIRA**. Create one JIRA issue per proposal in the app's configured project using whatever JIRA CLI/REST this environment provides. **If no JIRA credentials are available, fall back to recording proposals in PLAN.md at {repoPath} (slug-tagged \`- [ ] [<slug>] …\` checklist items under \`## Next Up\`, committed) and say so in your final summary.**
-
-- **Inventory:** Search existing JIRA issues (and PLAN.md, if you fall back) for the \`[ref-watch-…]\` slug so you don't duplicate; collect the existing slugs.
-- **Record** each proposal as a new JIRA issue whose summary starts with the \`[<slug>]\` tag. The description must contain the provenance (ref + commit SHA(s) + today's date), the 1–2 sentence rationale, the \`Fix:\` line naming the {appName} files/functions to change, and the estimated scope. For **Maybe — needs human call** items, end the description with \`**Decision needed:** <one sentence>.\`.
-- **Finalize:** No source-code edits, no branches, no PRs — the tickets (or the committed PLAN.md fallback) ARE the deliverable. The \`claim-issue-jira\` flow picks them up later.`,
-};
-
-/**
- * Pick the {trackerInstructions} block for a resolved work tracker, falling back
- * to the PLAN.md block for an unknown/missing tracker (matches the v3 prompt's
- * read-only-on-source, write-to-tracker contract). Exported for tests.
- */
-export function formatTrackerInstructions(tracker) {
- return TRACKER_INSTRUCTIONS[tracker] || TRACKER_INSTRUCTIONS.plan;
-}
+// records its Adopt/Maybe proposals — now lives in lib/workTracker.js alongside
+// the tracker resolution it keys off, shared with the other tracker-filing task
+// types (`ux`). Re-exported here so existing `referenceRepos.formatTrackerInstructions`
+// callers keep working; the reference-watch wording is the function's DEFAULT
+// option set, so a bare call still returns the v3 blocks byte-for-byte.
+export { formatTrackerInstructions };
/**
* Trigger a CoS analysis task for a single reference repo after a successful
diff --git a/server/services/taskLearning/lifecycle.js b/server/services/taskLearning/lifecycle.js
index 57c0b812e5..4509ffd21a 100644
--- a/server/services/taskLearning/lifecycle.js
+++ b/server/services/taskLearning/lifecycle.js
@@ -9,7 +9,7 @@
import { cosEvents, emitLog } from './store.js';
import { recordTaskCompletion, recalculateModelTierMetrics } from './metrics.js';
-import { isNonCommittingCoordinatorTask } from '../taskTypeHooks.js';
+import { declaresNoCommitCriterion } from '../taskTypeHooks.js';
// A pre-#2696 gh/git coordinator run (branch-reconcile/issue-reconcile/branch-cleanup/
// jira-status-report) carries a FOSSIL `result.validationPassed` — a boolean the old
@@ -19,8 +19,13 @@ import { isNonCommittingCoordinatorTask } from '../taskTypeHooks.js';
// now declare NO commit criterion, so drop the fossil and let the exit-code success stand —
// exactly as finalize now records a live coordinator run. Non-coordinator agents (and those
// with no boolean verdict) pass through untouched.
+//
+// Keyed on the same `declaresNoCommitCriterion` predicate the live criterion uses, so the
+// backfill also drops the fossil off a tracker-filing run (`worktreeChangesExpected: false`,
+// e.g. a reference-watch run on a github-tracker app) — the identical artifact, just carried
+// on a per-task flag instead of the static type set (#3273).
function withoutStaleCoordinatorVerdict(agent, task) {
- if (!isNonCommittingCoordinatorTask(task)) return agent;
+ if (!declaresNoCommitCriterion(task)) return agent;
if (typeof agent?.result?.validationPassed !== 'boolean') return agent;
return { ...agent, result: { ...agent.result, validationPassed: null } };
}
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index 38659aeb84..9d5109beba 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -10,6 +10,7 @@
"documentation": "74aa8433896647e7815f9d6d9e4a56c8",
"ui-bugs": "def9ad96bd74ab397233f234d79a1974",
"mobile-responsive": "16d8e7f63a673a2de48994c0ac08ef3d",
+ "ux": "e03d03fc7c16faa5b5db93be2896b9ad",
"feature-ideas": "d3282f16da29efe2d53595b3b34778bc",
"plan-task": "8f5b69fd9336b17184e7f7989f97def5",
"claim-issue": "dc985be3422c9fdee07d92a059666f0a",
@@ -56,6 +57,7 @@
"documentation": 4,
"ui-bugs": 2,
"mobile-responsive": 2,
+ "ux": 1,
"release-check": 6
},
"REFERENCE_WATCH_AUDITED_VERSION": 3,
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index f47ec57426..568729afe2 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -228,6 +228,107 @@ Use Playwright MCP to test the app at different viewport sizes:
4. Fix CSS responsive classes as needed
5. Test fixes and commit changes`,
+ 'ux': `[Improvement: {appName}] UX / Design Audit
+
+You are reviewing {appName}'s running UI as a UX reviewer, not as an engineer
+fixing bugs. The question you are answering for every screen is **"can a user
+actually get their job done here, and does the design help or fight them?"**
+
+**Read-only on source.** You do NOT edit application code, CSS, or components,
+and you do NOT create branches or PRs. Your deliverable is one item per finding
+in {appName}'s task tracker (described under "Where to record findings" below),
+so a human — or a later \`/claim\`-style task runner — decides what actually gets
+built. Design judgment is proposed, never auto-merged.
+
+Repository: {repoPath}
+
+## Where to record findings
+
+{trackerInstructions}
+
+## Out of scope — sibling task types own these
+
+Duplicate findings are noise. Do NOT file:
+
+- **Raw console errors / broken elements / failed requests** — \`ui-bugs\` owns these.
+- **Viewport breakage** (overflow, sub-44px tap targets, horizontal scroll) — \`mobile-responsive\` owns these.
+- **ARIA labels, contrast ratios, keyboard traps** — \`accessibility\` owns these.
+
+Mention an overlap only when it is the *cause* of a UX failure you are filing
+(e.g. "the empty state is unreachable because the only trigger is a
+keyboard-inaccessible icon") — and file it as the UX finding, not as the a11y one.
+
+## What to do
+
+1. **Inventory existing findings so you don't duplicate.** Follow the
+ "Inventory" step under "Where to record findings" above for this app's
+ tracker. Every prior UX finding carries a \`[ux-…]\` slug — collect the
+ existing slugs and skip any screen/problem pair already filed.
+
+2. **Discover the running app's UI URL** the same way the \`ui-bugs\` and
+ \`mobile-responsive\` audits do — from the app's own config/README/dev-server
+ output. If the UI is not reachable, exit cleanly and say so in your summary;
+ do NOT file speculative findings from source alone.
+
+3. **Walk each main route** with Playwright MCP. For every route:
+ - \`browser_navigate\` to it, then \`browser_snapshot\` to read the structure.
+ - \`browser_resize\` to **1440x900** (desktop) and **375x812** (mobile) and
+ snapshot at each — the fold differs, and a buried primary action is the
+ single most common finding.
+
+4. **Evaluate each route against this named checklist.** Cite the checklist
+ number in the finding so results are reproducible rather than vibes:
+
+ 1. **Primary action visible above the fold** at both 1440x900 AND 375x812.
+ What is the one thing a user comes to this screen to do, and can they see
+ it without scrolling?
+ 2. **Empty / loading / error states name a next action.** A blank panel, a
+ bare spinner, or "Something went wrong" with no retry/create/back is a
+ finding.
+ 3. **Affordances are consistent with sibling screens** — button hierarchy
+ (one primary per view), drawer vs modal for the same class of task,
+ destructive actions confirmed the same way everywhere.
+ 4. **Copy states an outcome, not a mechanism.** "Sync now" beats "Execute
+ job"; "3 items couldn't be saved" beats "PATCH failed".
+ 5. **No dead ends.** Every state has a way forward or back — a completed
+ wizard, a filtered-to-zero list, a detail view reached by deep link.
+ 6. **Visual consistency** — spacing, typography, and color follow the app's
+ own design tokens rather than one-off values drifting per screen.
+ 7. **Information hierarchy matches the user's task** — what they came for is
+ the most prominent thing, not the densest table or the newest feature.
+
+5. **File ONE item per finding** using the "Record" mechanics under "Where to
+ record findings" above. Each finding must carry:
+
+ - **A slug-tagged title.** Lowercase kebab-case starting with \`ux-\`,
+ naming the screen and the problem (e.g.
+ \`ux-settings-save-below-fold-on-mobile\`); ≤80 chars total; unique against
+ every existing \`[ux-…]\` slug (re-check before each record).
+ - **The screen/route** you audited and which checklist item (1–7) it failed.
+ - **What the user is trying to do** on that screen.
+ - **Why the current design impedes it** — 1–2 sentences, concrete and
+ observable, referencing what you saw in the snapshot.
+ - **A concrete proposed change** naming the component file(s) in {appName}
+ that would carry it. Describe the BEHAVIOR/layout to change, not a diff.
+ - **\`Scope: small | medium | large\`.**
+
+ A finding that needs a product decision before it can be built (a real
+ problem, but the right answer is a judgment call the user owns) is a
+ **Maybe — needs human call** item: file it the same way and end with the
+ \`**Decision needed:** <one sentence>\` line described in the tracker
+ instructions.
+
+ Be selective — file the findings that would measurably change whether a user
+ succeeds, not every aesthetic preference. A handful of well-argued items
+ beats twenty nitpicks.
+
+6. **Finalize** per the "Finalize" step under "Where to record findings" above.
+ No source edits, no branches, no PRs.
+
+7. Your final assistant message must be a 2–3 sentence summary of: how many
+ routes you audited, how many findings you filed (and their slugs), and which
+ checklist items came up most often.`,
+
'feature-ideas': `[Improvement: {appName}] Implement Next Planned Feature
Your goal is to implement the next planned item from PLAN.md, or brainstorm a new feature if no plan exists.
diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.js
index 3f3402d226..e9b8bd0088 100644
--- a/server/services/taskPromptDefaults/versions.js
+++ b/server/services/taskPromptDefaults/versions.js
@@ -35,6 +35,7 @@ export const PROMPT_VERSIONS = {
'documentation': 4, // v4: generic {appName} body (v1 hardcoded "PortOS"; v2/v3 retired DONE.md wording)
'ui-bugs': 2, // v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)
'mobile-responsive': 2, // v2: generic {appName} app-UI body (older default hardcoded "PortOS" + http://localhost:5555)
+ 'ux': 1, // v1: walk the running UI with Playwright MCP against a 7-item named UX checklist and file ONE tracker item per finding via {trackerInstructions} — read-only on source, no branches/PRs. Net-new type (no PREVIOUS_DEFAULT_PROMPTS entry needed).
'release-check': 6, // v6: generic {appName} body (older defaults hardcoded "PortOS")
};
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index ea56312b3e..4d9f51e2b5 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -194,6 +194,16 @@ export const SELF_IMPROVEMENT_TASK_TYPES = [
// `[ref-watch-…]` checklist items to the app's PLAN.md for `/claim` /
// `plan-task` to pick up. No source-code edits, no separate review file.
'reference-watch',
+ // Walks the running app UI with a UX reviewer's eye (Playwright MCP) against a
+ // named checklist — buried primary actions, dead-end empty/error states,
+ // affordances that drift between sibling screens — and files ONE tracker issue
+ // per finding instead of committing a speculative redesign. Design judgment is
+ // proposed, never auto-merged: `ux` is a TRACKER-FILING type (see
+ // TRACKER_FILING_TASK_TYPES in cosTaskGenerator.js), read-only on source.
+ // Deliberately narrower than its siblings: raw console errors belong to
+ // `ui-bugs`, viewport breakage to `mobile-responsive`, ARIA/contrast/keyboard
+ // to `accessibility`.
+ 'ux',
// PortOS-only: researches the current best local LLMs per category and
// refreshes the bundled suggested-models catalog (server/lib/localLlmCatalog.js)
// + the editorial family ranking (server/lib/localModelHeuristics.js), opening a
@@ -327,6 +337,15 @@ export const DEFAULT_TASK_INTERVALS = {
// REFERENCE_WATCH_AUDITED_VERSION above; bumping the prompt version requires
// re-auditing this default (a guard test in taskSchedule.test.js enforces it).
'reference-watch': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { readOnly: false } },
+ // ux audits the RUNNING app UI and delivers findings as tracker issues, so a
+ // CoS-managed worktree/PR is the wrong shape for it entirely — both are LOCKED
+ // off (MANAGED_AGENT_OPTIONS). `readOnly: false` for the same reason
+ // reference-watch is writable: the prompt's PLAN.md path appends + commits
+ // `[ux-…]` checklist items and the forge paths shell out to `gh`/`glab issue
+ // create`; `readOnly: true` would inject the "do not modify or commit files"
+ // guard and the agent would refuse. Off by default (AI Provider Usage Policy —
+ // enabling it is the user's consent to a weekly browser-driving LLM run).
+ 'ux': { type: INTERVAL_TYPES.WEEKLY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: false, openPR: false, readOnly: false } },
// pr-watcher polls for newly-opened PRs, so it runs on a short custom
// interval rather than the loose rotation/daily cadence. 30 min keeps the
// gh polling cheap while still reacting to a PR within one cycle. Default
@@ -375,7 +394,10 @@ export const MANAGED_AGENT_OPTIONS = {
'claim-issue': ['useWorktree', 'openPR'],
// claim-work delegates to one of the above prompt bodies, each of which
// creates its own worktree + PR — so the same lock applies to the router.
- 'claim-work': ['useWorktree', 'openPR']
+ 'claim-work': ['useWorktree', 'openPR'],
+ // ux's deliverable is tracker issues, not code — it never edits source, so a
+ // worktree/PR would only produce an empty branch. Lock both off.
+ 'ux': ['useWorktree', 'openPR']
};
// Strip managed-agent fields from a per-app override map before merging on top
@@ -1870,6 +1892,7 @@ export const TASK_TYPE_DESCRIPTIONS = {
'jira-sprint-manager': 'Triage and implement JIRA sprint tickets',
'jira-status-report': 'Generate JIRA weekly status report',
'reference-watch': 'Watch reference repos and append PLAN.md items for new upstream work',
+ 'ux': 'UX/design audit — files issues, no code changes',
'refresh-local-llm-catalog': "Refresh PortOS's bundled suggested local-model catalog + editorial ranking (PortOS repo only)",
'layered-intelligence': "Read this app's goals + telemetry, ask a reasoning model for one improvement, and file one deduplicated tracker issue — no code, no agent",
'quota-burn': 'When enabled, spend configured provider subscription quota only near its reset window using that provider family\'s prompt'
diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.js
index 169db44be8..588e538fd9 100644
--- a/server/services/taskSchedule.test.js
+++ b/server/services/taskSchedule.test.js
@@ -1132,6 +1132,44 @@ describe('taskSchedule', () => {
})
})
+ describe('ux defaults (#3273)', () => {
+ it('is registered as a self-improvement task type with a description', () => {
+ expect(SELF_IMPROVEMENT_TASK_TYPES).toContain('ux')
+ expect(TASK_TYPE_DESCRIPTIONS['ux']).toBe('UX/design audit — files issues, no code changes')
+ })
+
+ it('defaults to weekly + disabled with worktree/PR locked off', () => {
+ const cfg = DEFAULT_TASK_INTERVALS['ux']
+ expect(cfg.type).toBe(INTERVAL_TYPES.WEEKLY)
+ // Off by default — enabling it is the user's consent to a weekly LLM run.
+ expect(cfg.enabled).toBe(false)
+ // The deliverable is tracker issues, so a CoS-managed worktree/PR is wrong.
+ expect(cfg.taskMetadata.useWorktree).toBe(false)
+ expect(cfg.taskMetadata.openPR).toBe(false)
+ expect(MANAGED_AGENT_OPTIONS['ux']).toEqual(['useWorktree', 'openPR'])
+ // Writable for the same reason reference-watch is: the agent commits
+ // PLAN.md items / shells out to `gh issue create`.
+ expect(cfg.taskMetadata.readOnly).toBe(false)
+ })
+
+ it('ships a prompt that files findings to the tracker and never edits source', async () => {
+ const prompt = await getTaskPrompt('ux')
+ // The tracker block is injected at dispatch, so the token must survive here.
+ expect(prompt).toContain('{trackerInstructions}')
+ expect(prompt).toContain('[ux-…]')
+ // Read-only on source; the issues ARE the deliverable.
+ expect(prompt).toContain('do NOT create branches or PRs')
+ // Named checklist, not vibes.
+ expect(prompt).toContain('above the fold')
+ expect(prompt).toContain('1440x900')
+ expect(prompt).toContain('375x812')
+ // Explicitly defers to the sibling task types it would otherwise duplicate.
+ expect(prompt).toContain('ui-bugs')
+ expect(prompt).toContain('mobile-responsive')
+ expect(prompt).toContain('accessibility')
+ })
+ })
+
describe('resetExecutionHistory', () => {
it('should reset global execution history', async () => {
mockSchedule({
diff --git a/server/services/taskTypeHooks.js b/server/services/taskTypeHooks.js
index 553f9f7e12..52dc43331a 100644
--- a/server/services/taskTypeHooks.js
+++ b/server/services/taskTypeHooks.js
@@ -42,6 +42,8 @@
* importing anything, so a normal task type pays ~zero cost.
*/
+import { isFalsyMeta } from './agentState.js';
+
// taskType → () => import('./path/to/hookModule.js'). A module may export either
// or both hooks; a missing export means "no hook of that kind for this type".
const HOOK_MODULES = {
@@ -159,6 +161,30 @@ export function isNonCommittingCoordinatorTask(task) {
return NON_COMMITTING_COORDINATOR_TASK_TYPES.has(type);
}
+/**
+ * Whether a task declares NO `[task-<id>]` commit criterion — the union of the
+ * static coordinator set above and the PER-TASK `worktreeChangesExpected: false`
+ * signal that the tracker-filing types (reference-watch / ux) stamp at dispatch
+ * (cosTaskGenerator.js#resolveTrackerFilingBlock, referenceRepos.js#triggerReferenceAnalysis).
+ *
+ * The type-keyed set cannot express the tracker-filing shape: the SAME task type
+ * legitimately commits on a `plan`-tracker app (it appends + commits PLAN.md
+ * checklist items) and legitimately commits NOTHING on a github/gitlab/jira app
+ * (it files issues/tickets out of band). Keying on the already-derived per-task
+ * flag gets both right, and retro-fixes the same latent #2696-class artifact
+ * `reference-watch` has on non-`plan` trackers today — every successful run
+ * scoring as a failure and pinning the type's learning bucket at ~0% (#3273).
+ *
+ * Accepts the `'false'` string form for parity with the spawn-side gate
+ * (agentTuiSpawning.js's `isFalsyMeta`), since task metadata round-trips
+ * through TASKS.md as text. `true`/absent falls through to the commit check
+ * unchanged.
+ */
+export function declaresNoCommitCriterion(task) {
+ if (isFalsyMeta(task?.metadata?.worktreeChangesExpected)) return true;
+ return isNonCommittingCoordinatorTask(task);
+}
+
/**
* Resolve the pre-agent input hook for a task type, or null if it has none.
* `buildTaskInput({ app, taskType })` → `{ prompt?, providerId?, model?, hookMetadata?, skip? }`
diff --git a/server/services/workflow.js b/server/services/workflow.js
index 1518ff7d54..58570ebe4e 100644
--- a/server/services/workflow.js
+++ b/server/services/workflow.js
@@ -75,6 +75,7 @@ export const WORKFLOW_STAGES = [
'typing',
'ui-bugs',
'mobile-responsive',
+ 'ux',
'refresh-local-llm-catalog'
],
jobIds: ['job-wiki-maintenance']