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

voice: announce a task's topic, not the raw swarm/claim prompt block

[._.]/ Adam Eivy8a584c575732
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 992f3234bb..d0da96bd36 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,8 @@
## CoS Agents
+- **The proactive voice agent now announces a task's topic, not the raw prompt block.** When a voice-dispatched CoS task became ready or finished, the spoken line read the first ~240 characters of the task's `description` — which for a scheduled swarm/claim run is the `# ⚡ SWARM MODE — claim and ship up to 3 independent issues in parallel. This run operates in slashdo /do:next --swarm=3 mode. …` prompt scaffolding, so the assistant recited the orchestration preamble instead of naming the work. Both the "new task is ready" and "task is done" lines now derive a short topical label via a shared `deriveTaskSpeechLabel` helper that prefers an explicit title or the post-run agent summary and otherwise strips the first meaningful description line down to its topic (leading markdown heading, emoji, `[Claim Issue: App]` tag, `**bold**` markers, and the `SWARM MODE —` label), clipped to one phrase — so the swarm task speaks "claim and ship up to 3 independent issues in parallel" and a plain claim task speaks "Claim and ship the next open GitHub issue". (`server/services/voice/proactiveTriggers.js`)
+
- **[issue-2259] `issue-reconcile` now heals JIRA zombie tickets as well as GitHub/GitLab issues.** Following the GitLab sibling (#2249), the zombie-scan is now JIRA-aware. JIRA has no `in-progress` label to release, so the zombie is STATUS-based: a ticket left **In Review** (the claim-issue-jira success end-state) whose MR/PR shipped with remaining scope and NO live `claim/<KEY>` branch anywhere. Detection flows through the PortOS JIRA API (`fetchMyCurrentSprintTickets` — a new non-swallowing variant of `getMyCurrentSprintTickets` so a transient API blip skips-without-parking instead of being misread as an empty sprint) + git-ref scan for `claim/<KEY>` / `cos/…/<KEY>/…` claim branches — no `gh`/`glab` equivalent. JIRA tickets normalize into the SAME common `{ number, title, url, status, hasMergedPr, hasLiveClaim, hasActiveAgent }` shape the forges use, so the pure classifier/signature stay shared: In-Review → ZOMBIE, plain In-Progress → STALLED, To Do / Done → excluded so the scan converges. Routing mirrors `resolveAppWorkTracker` — JIRA is NEVER auto-selected from the git host; it's chosen only when the app's resolved `workTracker` is `'jira'` with enabled `jira.instanceId`/`projectKey`. The coordinator prompt gains a JIRA arm (heal via ticket transitions + `POST /api/jira/instances/:id/tickets` rather than close+relabel), bumped to v3 with the v2 body preserved in `PREVIOUS_DEFAULT_PROMPTS`. (`server/services/issueReconcile.js`, `server/services/jira.js`, `server/services/cosTaskGenerator.js`, `server/services/taskPromptDefaults/`)
- **Claude Code TUI agents no longer fail `paste-not-rendered` on every multi-line prompt.** The #2192 paste-verification guard confirmed a paste had landed by looking for the prompt's literal text in the TUI buffer — but Claude Code collapses a multi-line bracketed paste into a `[Pasted text #N]` chip and *hides* the pasted body text, and it reflows single lines with cursor-positioning escapes instead of literal space bytes between words. Both made the text check false-negative, so every `claude-code-tui` CoS agent retried 3× and died with `paste-not-rendered` despite the paste landing perfectly (100% reproduction across real runs, 2026-07-05). The gate now treats the TUI's own paste-commit **marker** as authoritative proof of delivery (checked first, via a new `isPasteConfirmed` helper), and only falls back to text matching for the markerless path — where the match is now whitespace-insensitive so a space-less reflowed line still matches. Captured transcripts from the real incident are pinned as regression tests. (`server/lib/tuiHandshake.js`, `server/services/agentTuiSpawning.js`)
diff --git a/server/services/voice/proactiveTriggers.js b/server/services/voice/proactiveTriggers.js
index ecc6908a2c..ed7c4abce7 100644
--- a/server/services/voice/proactiveTriggers.js
+++ b/server/services/voice/proactiveTriggers.js
@@ -51,9 +51,52 @@ export const RATE_LIMIT_MS = {
// upstream, but for the ear a sentence or two is plenty. Trim long source text.
const SPEECH_CLIP_LEN = 240;
-const clip = (text) => {
+// A task label is one topical phrase, not a sentence or two — a much tighter
+// budget than a free-form error/notification line. Keeps the spoken title from
+// running past the topic into the prompt body even after scaffolding is stripped.
+const TASK_LABEL_CLIP_LEN = 90;
+
+const clip = (text, max = SPEECH_CLIP_LEN) => {
const s = (text || '').toString().trim().replace(/\s+/g, ' ');
- return s.length > SPEECH_CLIP_LEN ? `${s.slice(0, SPEECH_CLIP_LEN - 1)}…` : s;
+ return s.length > max ? `${s.slice(0, max - 1)}…` : s;
+};
+
+// Reduce a task to a short, topical spoken label. A CoS task's `description` is
+// the raw agent prompt — for a swarm/claim run it leads with the `# ⚡ SWARM
+// MODE — …` block, and the concrete claim/plan prompts open their first line
+// with a `[Claim Issue: App]` tag. Reading that verbatim makes the voice agent
+// recite prompt scaffolding ("SWARM MODE — claim and ship up to 3 independent
+// issues in parallel. This run operates in slashdo …") instead of naming the
+// topic. This helper strips that scaffolding down to the underlying topic.
+//
+// `cleanTaskTopicLine` peels, in order: a leading markdown heading (`# `), a
+// leading run of emoji / symbol characters (the swarm block opens with `⚡`), a
+// leading `[Tag: App]` bracket label, `**bold**` markers, and the `SWARM MODE —`
+// label — so `# ⚡ SWARM MODE — claim and ship up to 3 …` reads as "claim and
+// ship up to 3 …" and `[Claim Issue: PortOS] Claim and ship the next open GitHub
+// issue` reads as "Claim and ship the next open GitHub issue".
+const cleanTaskTopicLine = (line) => {
+ let s = (line || '').toString().trim();
+ s = s.replace(/^#+\s*/, ''); // markdown heading marker
+ s = s.replace(/^[^\p{L}\p{N}[]+/u, ''); // leading emoji / symbol run
+ s = s.replace(/^\[[^\]]*\]\s*/, ''); // [Claim Issue: App] tag
+ s = s.replace(/\*\*/g, ''); // bold emphasis markers
+ s = s.replace(/^SWARM MODE\s*[—–-]\s*/i, ''); // swarm block label
+ return s.replace(/\s+/g, ' ').trim();
+};
+
+// A short topical label for a task, preferring an explicit title / post-run
+// agent summary (a completed task speaks what it actually did) and otherwise
+// deriving one from the first meaningful, de-scaffolded line of the description.
+export const deriveTaskSpeechLabel = (task) => {
+ if (!task) return '';
+ const explicit = task.title || task.metadata?.taskSummary;
+ if (explicit && explicit.toString().trim()) return clip(explicit, TASK_LABEL_CLIP_LEN);
+ for (const raw of (task.description || '').toString().split('\n')) {
+ const cleaned = cleanTaskTopicLine(raw);
+ if (cleaned) return clip(cleaned, TASK_LABEL_CLIP_LEN);
+ }
+ return '';
};
// Pure rate-limit predicate — given a source, its last-spoken timestamp, and
@@ -78,7 +121,7 @@ export const formatErrorLine = (error) => {
};
export const formatTaskLine = (task) => {
- const label = clip(task?.title || task?.description);
+ const label = deriveTaskSpeechLabel(task);
return label ? `A new task is ready: ${label}.` : '';
};
@@ -100,20 +143,21 @@ const isMetaTrue = (v) => v === true || v === 'true';
// retries doesn't announce on every attempt, and a user-cancelled task is
// suppressed by the caller. The PR URL is NOT spoken — it isn't created until
// cleanup runs after completion, and a GitHub URL is poor speech anyway; the
-// user reviews the PR visually. Uses the first line of the description so a
-// multi-line task spec doesn't get read out.
+// user reviews the PR visually. Speaks a short topical label (via
+// deriveTaskSpeechLabel) rather than the raw prompt, so a swarm/claim task
+// announces its topic instead of reciting the "# ⚡ SWARM MODE — …" block.
export const formatTaskCompletionLine = (task) => {
if (!task) return '';
- const desc = clip((task.description || '').split('\n')[0]);
+ const label = deriveTaskSpeechLabel(task);
const success = task.status === 'completed';
- if (!desc) {
+ if (!label) {
return success
? 'Your coding task is done.'
: "Heads up — a coding task you dispatched didn't finish cleanly.";
}
return success
- ? `Your coding task is done: ${desc}.`
- : `Heads up — the coding task "${desc}" didn't finish cleanly.`;
+ ? `Your coding task is done: ${label}.`
+ : `Heads up — the coding task "${label}" didn't finish cleanly.`;
};
/**
diff --git a/server/services/voice/proactiveTriggers.test.js b/server/services/voice/proactiveTriggers.test.js
index ce0e3d808d..e92d720c57 100644
--- a/server/services/voice/proactiveTriggers.test.js
+++ b/server/services/voice/proactiveTriggers.test.js
@@ -22,10 +22,17 @@ import {
formatTaskLine,
formatNotificationLine,
formatTaskCompletionLine,
+ deriveTaskSpeechLabel,
wireProactiveTriggers,
RATE_LIMIT_MS,
} from './proactiveTriggers.js';
+// The swarm block a scheduled claim-issue task's description leads with — the
+// exact scaffolding the voice agent used to recite verbatim.
+const SWARM_DESCRIPTION = `# ⚡ SWARM MODE — claim and ship up to 3 independent issues in parallel
+
+**This run operates in slashdo \`/do:next --swarm=3\` mode.** The single-issue framing in the task body below is your PER-AGENT playbook, not the shape of the whole run.`;
+
// Let the fire-and-forget dispatch promise chain settle after a synchronous
// emit before asserting.
const flush = () => new Promise((r) => setTimeout(r, 0));
@@ -83,12 +90,49 @@ describe('formatTaskLine', () => {
expect(formatTaskLine({ description: 'Fix the bug' })).toBe('A new task is ready: Fix the bug.');
});
+ it('speaks the swarm topic, not the raw prompt block', () => {
+ expect(formatTaskLine({ description: SWARM_DESCRIPTION }))
+ .toBe('A new task is ready: claim and ship up to 3 independent issues in parallel.');
+ });
+
it('returns empty when neither title nor description present', () => {
expect(formatTaskLine({})).toBe('');
expect(formatTaskLine(null)).toBe('');
});
});
+describe('deriveTaskSpeechLabel', () => {
+ it('strips the swarm block down to its topic', () => {
+ expect(deriveTaskSpeechLabel({ description: SWARM_DESCRIPTION }))
+ .toBe('claim and ship up to 3 independent issues in parallel');
+ });
+
+ it('strips a leading [Tag: App] label from a claim/plan prompt', () => {
+ expect(deriveTaskSpeechLabel({
+ description: '[Claim Issue: PortOS] Claim and ship the next open GitHub issue\n\nPhase 1 …',
+ })).toBe('Claim and ship the next open GitHub issue');
+ });
+
+ it('prefers an explicit title, then a post-run agent summary', () => {
+ expect(deriveTaskSpeechLabel({ title: 'Ship it', description: SWARM_DESCRIPTION })).toBe('Ship it');
+ expect(deriveTaskSpeechLabel({
+ description: SWARM_DESCRIPTION,
+ metadata: { taskSummary: 'Fixed the flaky backup test' },
+ })).toBe('Fixed the flaky backup test');
+ });
+
+ it('skips scaffolding-only leading lines to the first real topic', () => {
+ expect(deriveTaskSpeechLabel({ description: '#\n---\nRefactor the widget registry' }))
+ .toBe('Refactor the widget registry');
+ });
+
+ it('returns empty for a missing or empty task', () => {
+ expect(deriveTaskSpeechLabel(null)).toBe('');
+ expect(deriveTaskSpeechLabel({})).toBe('');
+ expect(deriveTaskSpeechLabel({ description: '' })).toBe('');
+ });
+});
+
describe('formatNotificationLine', () => {
it('speaks high-priority notifications, appending description when present', () => {
expect(formatNotificationLine({ priority: 'high', title: 'Backup failed' })).toBe('Backup failed');
@@ -111,6 +155,11 @@ describe('formatTaskCompletionLine', () => {
expect(line).toBe('Your coding task is done: Fix the flaky backup test.');
});
+ it('announces the swarm topic on completion, not the prompt block', () => {
+ expect(formatTaskCompletionLine({ status: 'completed', description: SWARM_DESCRIPTION }))
+ .toBe('Your coding task is done: claim and ship up to 3 independent issues in parallel.');
+ });
+
it('reports a blocked task as a failure', () => {
const line = formatTaskCompletionLine({ status: 'blocked', description: 'Refactor the registry' });
expect(line).toMatch(/didn't finish cleanly/i);