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: /do:next Slashdo button honors the app's Work Tracker

Adam Eivya67a090c368d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 37f79d661a..324bc3ff32 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -47,6 +47,7 @@
## Fixed
+- **The `/do:next` Slashdo button now honors the app's Work Tracker.** Per-app Work Tracker (PLAN.md / GitHub / GitLab / JIRA) already routed the *scheduled* `claim-work` flow, but the manual `/do:next` button inlined the raw slashdo command body — which always drains PLAN.md unless `--issues` is passed. Clicking it for an app set to GitHub/GitLab/JIRA Issues silently worked the wrong queue. The button now resolves the app's Work Tracker and delegates to the same claim flow the scheduler uses (`plan-task` / `claim-issue` / `claim-issue-gitlab` / `jira-sprint-manager`, via a shared `buildClaimWorkTask` router that also drives the scheduled path), inheriting the JIRA flow's CoS-managed worktree+PR isolation. The task description and button tooltip now read generically ("claim the next work item per this app's Work Tracker") instead of naming PLAN.md.
- **The GitHub Release workflow no longer crashes on a large changelog.** The v2.22.0 release (a ~175KB changelog) failed at the "Create Release" step with `Argument list too long`: the changelog was passed to `softprops/action-gh-release` as the `body:` input, which GitHub materializes as an `INPUT_BODY` environment variable, and a 175KB env var overflows `ARG_MAX` when the action's Node process is exec'd. The body also exceeds GitHub's hard 125,000-character release-note limit (a separate HTTP 422). The workflow now writes the (placeholder-substituted) changelog to a file and feeds it via `body_path:` instead of an env var, and caps it at 120,000 chars on a whole-line boundary — appending a pointer to the full changelog file at the tag when truncated. (`.github/workflows/release.yml`)
- Scheduled-task descriptions in the Automation UI no longer fall back to a raw dasherized label. `claim-work` (the single-source work-tracker router), `code-reviewer-a`/`code-reviewer-b`, and `do-replan` now show real one-line descriptions instead of "claim work" / "code reviewer a", which read as orphaned/legacy tasks. A parity guard test now keeps the description map in sync with the task-type list.
- PM2 standardization no longer assigns ports that are already in use. The analysis now feeds the AI the set of listening/reserved ports (plus the common Vite defaults 5173/5174) to avoid, and a deterministic post-pass reassigns any port that still collides into the 6000–6099 range — so standardizing an app never lands on a port another app already holds.
diff --git a/client/src/components/apps/SlashDoPanel.jsx b/client/src/components/apps/SlashDoPanel.jsx
index 24a0ec288a..2fd210f6c1 100644
--- a/client/src/components/apps/SlashDoPanel.jsx
+++ b/client/src/components/apps/SlashDoPanel.jsx
@@ -9,7 +9,7 @@ const SLASHDO_COMMANDS = [
{ id: 'push', label: '/do:push', description: 'Commit and push all work', classes: 'bg-port-success/20 text-port-success hover:bg-port-success/30 border-port-success/30' },
{ id: 'review', label: '/do:review', description: 'Deep code review', classes: 'bg-port-accent/20 text-port-accent hover:bg-port-accent/30 border-port-accent/30' },
{ id: 'replan', label: '/do:replan', description: 'Audit and prune PLAN.md, removing completed items', classes: 'bg-cyan-500/20 text-cyan-400 hover:bg-cyan-500/30 border-cyan-500/30' },
- { id: 'next', label: '/do:next', description: 'Claim the next unclaimed PLAN.md item and ship a PR', classes: 'bg-blue-500/20 text-blue-400 hover:bg-blue-500/30 border-blue-500/30' },
+ { id: 'next', label: '/do:next', description: "Claim the next unclaimed work item (per this app's Work Tracker) and ship a PR", classes: 'bg-blue-500/20 text-blue-400 hover:bg-blue-500/30 border-blue-500/30' },
{ id: 'release', label: '/do:release', description: 'Create a release PR', classes: 'bg-purple-500/20 text-purple-400 hover:bg-purple-500/30 border-purple-500/30' },
{ id: 'better', label: '/do:better', description: 'DevSecOps audit', classes: 'bg-port-warning/20 text-port-warning hover:bg-port-warning/30 border-port-warning/30', hideForSwift: true },
{ id: 'better-swift', label: '/do:better-swift', description: 'SwiftUI DevSecOps audit', classes: 'bg-port-warning/20 text-port-warning hover:bg-port-warning/30 border-port-warning/30', swiftOnly: true }
diff --git a/server/routes/cos.test.js b/server/routes/cos.test.js
index ba8c466425..a29f32f6d1 100644
--- a/server/routes/cos.test.js
+++ b/server/routes/cos.test.js
@@ -83,6 +83,15 @@ vi.mock('../services/subAgentSpawner.js', () => ({
loadSlashdoCommand: vi.fn()
}));
+// The `/do:next` slashdo route resolves the app's Work Tracker via
+// buildClaimWorkTask + getAppById instead of inlining the raw command body.
+vi.mock('../services/cosTaskGenerator.js', () => ({
+ buildClaimWorkTask: vi.fn()
+}));
+vi.mock('../services/apps.js', () => ({
+ getAppById: vi.fn()
+}));
+
// Import mocked modules
import * as cos from '../services/cos.js';
import * as taskWatcher from '../services/taskWatcher.js';
@@ -90,6 +99,8 @@ import * as appActivity from '../services/appActivity.js';
import * as claudeChangelog from '../services/claudeChangelog.js';
import { enhanceTaskPrompt } from '../services/taskEnhancer.js';
import { loadSlashdoCommand } from '../services/subAgentSpawner.js';
+import { buildClaimWorkTask } from '../services/cosTaskGenerator.js';
+import { getAppById } from '../services/apps.js';
describe('CoS Routes', () => {
let app;
@@ -796,7 +807,6 @@ describe('CoS Routes', () => {
'push',
'review',
'replan',
- 'next',
'release',
'better',
'better-swift'
@@ -813,6 +823,42 @@ describe('CoS Routes', () => {
expect(loadSlashdoCommand).toHaveBeenCalledWith(command);
});
+ it('routes /do:next through the app Work Tracker instead of the raw command', async () => {
+ getAppById.mockResolvedValue({ id: 'my-app', name: 'MyApp', repoPath: '/repo' });
+ buildClaimWorkTask.mockResolvedValue({
+ tracker: 'github',
+ source: 'config',
+ promptTaskType: 'claim-issue',
+ prompt: 'CLAIM ISSUE PROMPT',
+ taskMetadata: { useWorktree: false, openPR: false }
+ });
+ cos.addTask.mockResolvedValue({ id: 'task-sd-next', status: 'pending' });
+
+ const response = await request(app)
+ .post('/api/cos/tasks/slashdo')
+ .send({ command: 'next', app: 'my-app' });
+
+ expect(response.status).toBe(200);
+ expect(response.body.id).toBe('task-sd-next');
+ expect(buildClaimWorkTask).toHaveBeenCalledWith(expect.objectContaining({ id: 'my-app' }));
+ // The raw do:next body must NOT be inlined for the next command.
+ expect(loadSlashdoCommand).not.toHaveBeenCalledWith('next');
+ const [taskData] = cos.addTask.mock.calls.at(-1);
+ expect(taskData.context).toBe('CLAIM ISSUE PROMPT');
+ expect(taskData.description).toContain('GitHub Issues');
+ });
+
+ it('returns 404 when /do:next targets an unknown app', async () => {
+ getAppById.mockResolvedValue(null);
+
+ const response = await request(app)
+ .post('/api/cos/tasks/slashdo')
+ .send({ command: 'next', app: 'ghost-app' });
+
+ expect(response.status).toBe(404);
+ expect(buildClaimWorkTask).not.toHaveBeenCalled();
+ });
+
it('should return 400 for invalid command', async () => {
const response = await request(app)
.post('/api/cos/tasks/slashdo')
diff --git a/server/routes/cosTaskRoutes.js b/server/routes/cosTaskRoutes.js
index e3b08cebfe..db9d033232 100644
--- a/server/routes/cosTaskRoutes.js
+++ b/server/routes/cosTaskRoutes.js
@@ -8,6 +8,9 @@ import * as cos from '../services/cos.js';
import * as taskWatcher from '../services/taskWatcher.js';
import { enhanceTaskPrompt } from '../services/taskEnhancer.js';
import { loadSlashdoCommand } from '../services/subAgentSpawner.js';
+import { buildClaimWorkTask } from '../services/cosTaskGenerator.js';
+import { getAppById } from '../services/apps.js';
+import { workTrackerLabel } from '../lib/workTracker.js';
import { asyncHandler, ServerError, failValidation } from '../lib/errorHandler.js';
import { createCosTaskSchema, updateCosTaskSchema, validateRequest } from '../lib/validation.js';
@@ -20,7 +23,7 @@ const SLASHDO_COMMANDS = {
push: { label: 'Push', description: 'Commit and push all work with changelog' },
review: { label: 'Review', description: 'Deep code review of changed files' },
replan: { label: 'Replan', description: 'Audit PLAN.md, archive completed items, prune stale work' },
- next: { label: 'Next', description: 'Claim the next unclaimed PLAN.md item and ship a PR' },
+ next: { label: 'Next', description: 'Claim the next unclaimed work item (per the app\'s Work Tracker) and ship a PR' },
release: { label: 'Release', description: 'Create a release PR' },
better: { label: 'Better', description: 'Unified DevSecOps audit and remediation' },
'better-swift': { label: 'Better Swift', description: 'SwiftUI DevSecOps audit and remediation' }
@@ -82,14 +85,36 @@ router.post('/tasks/slashdo', asyncHandler(async (req, res) => {
throw new ServerError('App ID is required', { status: 400, code: 'VALIDATION_ERROR' });
}
- const content = await loadSlashdoCommand(command);
- if (!content) {
- throw new ServerError(`Failed to load slashdo command: ${command}`, { status: 500, code: 'COMMAND_LOAD_FAILED' });
+ const meta = SLASHDO_COMMANDS[command];
+
+ // `/do:next` is the work-claim consumer: route it through the same
+ // workTracker-aware logic the scheduled `claim-work` flow uses, so the manual
+ // button honors the app's per-app Work Tracker (PLAN.md / GitHub / GitLab /
+ // JIRA) instead of always draining PLAN.md. Every other command inlines its
+ // raw slashdo body verbatim.
+ let context;
+ let taskMetadata = { useWorktree: false, openPR: false };
+ let description;
+ if (command === 'next') {
+ const appObj = await getAppById(app);
+ if (!appObj) {
+ throw new ServerError(`App not found: ${app}`, { status: 404, code: 'APP_NOT_FOUND' });
+ }
+ const claim = await buildClaimWorkTask(appObj);
+ context = claim.prompt;
+ // claim.taskMetadata overrides the false/false default only where it carries
+ // a key (jira-sprint-manager flips both to CoS-managed worktree+PR).
+ taskMetadata = { ...taskMetadata, ...claim.taskMetadata };
+ description = `Run /do:next for ${appObj.name} — claim next ${workTrackerLabel(claim.tracker)} item and ship a PR`;
+ } else {
+ context = await loadSlashdoCommand(command);
+ if (!context) {
+ throw new ServerError(`Failed to load slashdo command: ${command}`, { status: 500, code: 'COMMAND_LOAD_FAILED' });
+ }
+ description = `Run /do:${command} for ${app} — ${meta.description}`;
}
- const meta = SLASHDO_COMMANDS[command];
- const description = `Run /do:${command} for ${app} — ${meta.description}`;
- const taskData = { description, app, context: content, useWorktree: false, openPR: false, simplify: false, reviewLoop: false };
+ const taskData = { description, app, context, ...taskMetadata, simplify: false, reviewLoop: false };
const result = await cos.addTask(taskData, 'user');
if (result?.duplicate) {
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index cf656d87d4..afcf3c69ec 100644
--- a/server/services/cosTaskGenerator.js
+++ b/server/services/cosTaskGenerator.js
@@ -145,6 +145,79 @@ const PLAN_SELF_CLAIM_TASK_TYPES = new Set(['plan-task']);
// cleanly — burning an LLM round for nothing.
const PLAN_GATE_TASK_TYPES = new Set(['plan-task']);
+// Concrete directives substituted into the {issueAuthorFilter} placeholder of
+// the GitHub/GitLab claim-issue prompt bodies. 'owner' (the default, matching
+// /do:next --issues) restricts to repo/project-owner-filed issues; 'any' claims
+// any open issue. The plan/jira prompts carry no {issueAuthorFilter} placeholder
+// so the value is a harmless no-op for them.
+const ISSUE_AUTHOR_FILTER_BLOCKS = {
+ gh: {
+ any: '**Author filter: any author.** Claim the next eligible open issue regardless of who filed it — omit `--author` from `gh issue list` entirely.',
+ owner: '**Author filter: repository owner only.** Only claim issues filed by the repository owner/creator. Resolve the owner with `OWNER="$(gh repo view --json owner -q .owner.login)"` and pass `--author "$OWNER"` (a quoted single token) to `gh issue list`; skip issues opened by anyone else.'
+ },
+ glab: {
+ any: '**Author filter: any author.** Claim the next eligible open issue regardless of who opened it — omit `--author` from `glab issue list`.',
+ owner: '**Author filter: project owner only.** Only claim issues opened by the project owner. Resolve the owner from the project namespace (e.g. `glab repo view`), then pass `--author <owner>` to `glab issue list`; skip issues opened by anyone else.'
+ }
+};
+
+/**
+ * Resolve the {issueAuthorFilter} directive for a resolved claim task type.
+ * The forge is inferred from the prompt body: `glab` for the GitLab claim flow,
+ * `gh` for GitHub, and the gh block as a default for plan/jira (whose prompts
+ * have no placeholder, so the value is never substituted anyway).
+ */
+export function resolveIssueAuthorFilterBlock(promptTaskType, mode = 'owner') {
+ const issueForge = promptTaskType === 'claim-issue-gitlab' ? 'glab'
+ : promptTaskType === 'claim-issue' ? 'gh'
+ : null;
+ const filterMode = mode === 'any' ? 'any' : 'owner';
+ return (ISSUE_AUTHOR_FILTER_BLOCKS[issueForge] || ISSUE_AUTHOR_FILTER_BLOCKS.gh)[filterMode];
+}
+
+/**
+ * Build a one-off "claim the next work item" task for `app`, routed by the app's
+ * configured workTracker — the manual (Slashdo `/do:next` button) counterpart to
+ * the scheduled `claim-work` router below. Resolves the tracker, delegates to the
+ * matching claim prompt body (plan-task / claim-issue / claim-issue-gitlab /
+ * jira-sprint-manager), substitutes the standard placeholders, and surfaces the
+ * delegated flow's worktree/PR posture (jira-sprint-manager needs CoS-managed
+ * isolation; the plan/github/gitlab prompts self-manage their worktree + PR).
+ *
+ * @returns {Promise<{ tracker, source, promptTaskType, prompt, taskMetadata }>}
+ */
+export async function buildClaimWorkTask(app, { issueAuthorFilter = 'owner', reviewers = ['copilot'] } = {}) {
+ const { resolveAppWorkTracker, trackerToClaimTaskType } = await import('../lib/workTracker.js');
+ const { getTaskPrompt } = await import('./taskPromptService.js');
+ const taskSchedule = await import('./taskSchedule.js');
+
+ const wt = await resolveAppWorkTracker(app);
+ const promptTaskType = trackerToClaimTaskType(wt.resolved) || 'plan-task';
+ const template = await getTaskPrompt(promptTaskType);
+
+ const reviewersList = Array.isArray(reviewers) ? reviewers : [reviewers];
+ const reviewersCsv = reviewersList.filter(Boolean).join(', ') || 'copilot';
+ const issueAuthorFilterBlock = resolveIssueAuthorFilterBlock(promptTaskType, issueAuthorFilter);
+
+ const prompt = template
+ .replace(/\{appName\}/g, app.name)
+ .replace(/\{repoPath\}/g, app.repoPath)
+ .replace(/\{appId\}/g, app.id)
+ // Function-form replacers so literal `$`/`$1` in the substituted text isn't
+ // interpreted as a backreference (see the scheduler's same-pattern note).
+ .replace(/\{reviewers\}/g, () => reviewersCsv)
+ .replace(/\{issueAuthorFilter\}/g, () => issueAuthorFilterBlock);
+
+ // Mirror the scheduler: inherit the delegated flow's isolation posture so the
+ // JIRA route runs in a CoS-managed worktree rather than the live checkout.
+ const delegatedMeta = taskSchedule.DEFAULT_TASK_INTERVALS[promptTaskType]?.taskMetadata || {};
+ const taskMetadata = {};
+ if ('useWorktree' in delegatedMeta) taskMetadata.useWorktree = delegatedMeta.useWorktree;
+ if ('openPR' in delegatedMeta) taskMetadata.openPR = delegatedMeta.openPR;
+
+ return { tracker: wt.resolved, source: wt.source, promptTaskType, prompt, taskMetadata };
+}
+
/**
* For feature-ideas / plan-task, read the target repo's PLAN.md, find which
* item IDs are already in flight via branch/PR scan, and pick the first
@@ -1446,32 +1519,10 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st
const promptReviewers = normalizeReviewers(metadata, codeReviewDefaults?.reviewers)
.filter((r) => !LOCAL_LLM_REVIEWERS.includes(r));
const reviewersCsv = (promptReviewers.length ? promptReviewers : [...DEFAULT_REVIEWERS]).join(',');
- // claim-issue: expand {issueAuthorFilter} into a concrete directive telling
- // the agent which open issues are claimable. The filter was already merged
- // (global → per-app override) and value-constrained by sanitizeTaskMetadata,
- // so read it from `metadata`. 'owner' (the default, matching /claim --issues)
- // restricts to repo-owner-filed issues; 'any' claims any open issue.
- // The forge whose CLI the resolved prompt body documents — `glab` for the
- // GitLab claim flow, `gh` for the GitHub one, null for plan/jira (whose
- // prompts carry no {issueAuthorFilter} placeholder, so the replace is a
- // harmless no-op there).
- const issueForge = promptTaskType === 'claim-issue-gitlab' ? 'glab'
- : promptTaskType === 'claim-issue' ? 'gh'
- : null;
- const authorFilterMode = (metadata.issueAuthorFilter || 'owner') === 'any' ? 'any' : 'owner';
- const ISSUE_AUTHOR_FILTER_BLOCKS = {
- gh: {
- any: '**Author filter: any author.** Claim the next eligible open issue regardless of who filed it — omit `--author` from `gh issue list` entirely.',
- owner: '**Author filter: repository owner only.** Only claim issues filed by the repository owner/creator. Resolve the owner with `OWNER="$(gh repo view --json owner -q .owner.login)"` and pass `--author "$OWNER"` (a quoted single token) to `gh issue list`; skip issues opened by anyone else.'
- },
- glab: {
- any: '**Author filter: any author.** Claim the next eligible open issue regardless of who opened it — omit `--author` from `glab issue list`.',
- owner: '**Author filter: project owner only.** Only claim issues opened by the project owner. Resolve the owner from the project namespace (e.g. `glab repo view`), then pass `--author <owner>` to `glab issue list`; skip issues opened by anyone else.'
- }
- };
- // Default to the gh block for plan/jira (null forge) — their prompts have no
- // {issueAuthorFilter} placeholder so the value is never substituted anyway.
- const issueAuthorFilterBlock = (ISSUE_AUTHOR_FILTER_BLOCKS[issueForge] || ISSUE_AUTHOR_FILTER_BLOCKS.gh)[authorFilterMode];
+ // {issueAuthorFilter} directive — the filter was already merged (global →
+ // per-app override) and value-constrained by sanitizeTaskMetadata, so read it
+ // from `metadata` (default 'owner', matching /do:next --issues).
+ const issueAuthorFilterBlock = resolveIssueAuthorFilterBlock(promptTaskType, metadata.issueAuthorFilter || 'owner');
const description = promptTemplate
.replace(/\{appName\}/g, app.name)
diff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.js
index 7726a1be60..c0eb6023f2 100644
--- a/server/services/cosTaskGenerator.test.js
+++ b/server/services/cosTaskGenerator.test.js
@@ -15,7 +15,7 @@ import { describe, it, expect } from 'vitest';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
-import { selectDryRunAutoApproved, exceedsMaxSpawns } from './cosTaskGenerator.js';
+import { selectDryRunAutoApproved, exceedsMaxSpawns, resolveIssueAuthorFilterBlock } from './cosTaskGenerator.js';
import { MAX_TOTAL_SPAWNS } from '../lib/validation.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -119,6 +119,34 @@ describe('claim-work single-source routing', () => {
expect(GEN_SRC).toContain("'useWorktree' in delegatedMeta");
expect(GEN_SRC).toContain("'openPR' in delegatedMeta");
});
+
+ it('exposes buildClaimWorkTask so the manual /do:next button reuses the same router', () => {
+ expect(GEN_SRC).toContain('export async function buildClaimWorkTask(');
+ // Same tracker resolution + delegated isolation posture as the scheduler.
+ expect(GEN_SRC).toMatch(/buildClaimWorkTask[\s\S]*resolveAppWorkTracker, trackerToClaimTaskType/);
+ expect(GEN_SRC).toMatch(/buildClaimWorkTask[\s\S]*resolveIssueAuthorFilterBlock\(promptTaskType/);
+ });
+});
+
+// The {issueAuthorFilter} directive is shared by the scheduled claim-work router
+// AND the manual /do:next button (buildClaimWorkTask), so it is a standalone
+// pure helper. These exercise it directly rather than via source string.
+describe('resolveIssueAuthorFilterBlock', () => {
+ it('returns the gh forge directive for the github claim body', () => {
+ expect(resolveIssueAuthorFilterBlock('claim-issue', 'owner')).toContain('gh issue list');
+ expect(resolveIssueAuthorFilterBlock('claim-issue', 'any')).toContain('regardless of who filed it');
+ });
+
+ it('returns the glab forge directive for the gitlab claim body', () => {
+ expect(resolveIssueAuthorFilterBlock('claim-issue-gitlab', 'owner')).toContain('glab issue list');
+ expect(resolveIssueAuthorFilterBlock('claim-issue-gitlab', 'any')).toContain('regardless of who opened it');
+ });
+
+ it('defaults to the gh block (harmless no-op) for plan/jira bodies and to owner mode', () => {
+ expect(resolveIssueAuthorFilterBlock('plan-task')).toContain('gh issue list');
+ // Unknown mode collapses to owner, not any.
+ expect(resolveIssueAuthorFilterBlock('claim-issue', 'bogus')).toContain('repository owner only');
+ });
});
describe('exceedsMaxSpawns', () => {