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

feat(cos): jira-sprint-manager as opt-in per-app scheduled task

Adam Eivybfda35c4a77a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 2b76016f5b..cc0ffdd329 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -19,6 +19,9 @@
## Changed
+- **JIRA Sprint Manager is now a per-app scheduled task** — Moved from system-level autonomous job to project-based scheduled task with opt-in semantics. Disabled by default for all apps; must be explicitly enabled per app in task type overrides. Supports per-app worktree+PR workflow. Old autonomous job entries are auto-migrated (removed) on startup.
+- **Killed agent tasks stay blocked** — Tasks from user-terminated agents are no longer regenerated by the improvement task queue. Previously, killing an agent would block the task but a new identical task could be queued on the next evaluation cycle.
+
- **Native PostgreSQL uses system pg** — Native mode now reuses the existing system PostgreSQL on port 5432 (e.g., Homebrew service) instead of running a separate instance on port 5561. `setup-native` detects an already-running pg, creates the portos user/database, and applies the schema. No dedicated data directory or manual startup needed. Docker mode unchanged on port 5561. Sync between backends is zero-downtime since they run on different ports simultaneously.
- **CoS feature-ideas task** — Agents now implement the next unchecked PLAN.md item instead of inventing features. When user clarification is needed, agents create a `.plan-questions.md` marker and a `plan_question` notification linking to the Documents tab. Added `{appId}` template variable for prompt linking.
diff --git a/client/src/components/cos/tabs/TaskItem.jsx b/client/src/components/cos/tabs/TaskItem.jsx
index 7f1c2b63c4..9d79c8ac3d 100644
--- a/client/src/components/cos/tabs/TaskItem.jsx
+++ b/client/src/components/cos/tabs/TaskItem.jsx
@@ -47,6 +47,7 @@ function extractTaskType(description) {
if (d.includes('typing') || d.includes('typescript')) return 'task:typing';
if (d.includes('release')) return 'task:release-check';
if (d.includes('dependency')) return 'task:dependency-updates';
+ if (d.includes('jira') || d.includes('sprint')) return 'task:jira-sprint-manager';
}
// General task type classification
diff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.js
index 58b92740e9..c42cf60f43 100644
--- a/server/services/autonomousJobs.js
+++ b/server/services/autonomousJobs.js
@@ -125,7 +125,6 @@ const JOB_SKILL_MAP = {
'job-github-repo-maintenance': 'github-repo-maintenance',
'job-brain-review': 'brain-review',
'job-datadog-error-monitor': 'datadog-error-monitor',
- 'job-jira-sprint-manager': 'jira-sprint-manager',
'job-autobiography-prompt': 'autobiography-prompt'
}
@@ -254,53 +253,6 @@ Write the briefing in a concise, actionable format. Save it as a CoS report.`,
createdAt: null,
updatedAt: null
},
- {
- id: 'job-jira-sprint-manager',
- name: 'JIRA Sprint Manager',
- description: 'Triage current sprint tickets for JIRA-enabled apps, then implement the highest-priority ready ticket in a worktree with a merge request.',
- category: 'jira-sprint-manager',
- interval: 'daily',
- intervalMs: DAY,
- scheduledTime: '00:00',
- weekdaysOnly: true,
- enabled: false,
- priority: 'HIGH',
- autonomyLevel: 'yolo',
- promptTemplate: `[Autonomous Job] JIRA Sprint Manager
-
-You are acting as my Chief of Staff, triaging and implementing JIRA tickets for apps with JIRA integration enabled.
-
-This job runs Monday-Friday. It triages all sprint tickets first, then implements the top-priority ready ticket.
-
-Phase 1 — Triage:
-1. Call GET /api/apps to get all managed apps
-2. Filter for apps with jira.enabled = true and jira.instanceId + jira.projectKey set
-3. For each JIRA-enabled app:
- - Call GET /api/jira/:instanceId/my-sprint-tickets/:projectKey to get tickets assigned to me in current sprint
- - For each ticket, evaluate what needs to be done next:
- a) Does the ticket need clarification or better requirements? Add a comment with questions
- b) Is the ticket blocked or needs discussion? Add a comment noting blockers
- c) Is the ticket well-defined and ready to work? Mark it as a candidate for implementation
-4. Prioritize tickets marked as HIGH or Blocker
-
-Phase 2 — Implement:
-5. From the triage results, select the highest priority ticket in "To Do" or "Ready" status that is well-defined
-6. For the selected ticket:
- - Create a git worktree using the worktree manager
- - Implement the ticket requirements
- - Commit changes and push the branch
- - Create a merge request using gh CLI
- - Transition the ticket to "In Review" status
- - Add a comment to JIRA with the MR link
-7. If no tickets are ready to implement, skip Phase 2
-
-Phase 3 — Report:
-8. Generate a summary report covering triage actions taken and implementation work completed`,
- lastRun: null,
- runCount: 0,
- createdAt: null,
- updatedAt: null
- },
{
id: 'job-datadog-error-monitor',
name: 'DataDog Error Monitor',
@@ -569,8 +521,8 @@ function createDefaultJobsData() {
* Merge loaded data with defaults (add any missing default jobs)
*/
function mergeWithDefaults(loaded) {
- // Migration: remove pr-reviewer job (moved to Schedule system)
- loaded.jobs = loaded.jobs.filter(j => j.id !== 'job-pr-reviewer')
+ // Migration: remove jobs moved to Schedule system
+ loaded.jobs = loaded.jobs.filter(j => j.id !== 'job-pr-reviewer' && j.id !== 'job-jira-sprint-manager')
const existingById = new Map(loaded.jobs.map(j => [j.id, j]))
const now = new Date().toISOString()
diff --git a/server/services/cos.js b/server/services/cos.js
index f6a298290a..8507e2f846 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -1237,11 +1237,14 @@ async function queueEligibleImprovementTasks(state, cosTaskData) {
if (!improvementEnabled) return;
// Get existing pending/in_progress system tasks to avoid duplicates
+ // Also skip task types where a user-terminated blocked task exists (user intentionally killed it)
const existingTasks = cosTaskData.tasks || [];
const existingTaskTypes = new Set();
for (const task of existingTasks) {
- if (task.status === 'pending' || task.status === 'in_progress') {
+ const isActive = task.status === 'pending' || task.status === 'in_progress';
+ const isUserTerminated = task.status === 'blocked' && task.metadata?.blockedCategory === 'user-terminated';
+ if (isActive || isUserTerminated) {
const analysisType = task.metadata?.analysisType ||
task.metadata?.selfImprovementType ||
task.description?.match(/\[(?:self-improvement|improvement)\]\s*(\w[\w-]*)/i)?.[1];
@@ -1316,7 +1319,8 @@ function getSelfImprovementTaskDescription(taskType) {
'dependency-updates': 'Check for and safely update outdated dependencies',
'error-handling': 'Improve error handling patterns and recovery logic',
'typing': 'Add or fix TypeScript/JSDoc type annotations',
- 'release-check': 'Verify release readiness (changelog, version, tests)'
+ 'release-check': 'Verify release readiness (changelog, version, tests)',
+ 'jira-sprint-manager': 'Triage and implement JIRA sprint tickets (worktree+PR)'
};
return descriptions[taskType] || null;
}
@@ -1339,7 +1343,8 @@ function getAppImprovementTaskDescription(taskType, app) {
'ui-bugs': `Review UI for visual bugs in ${app.name}`,
'mobile-responsive': `Check mobile responsiveness of ${app.name}`,
'feature-ideas': `Implement a feature idea for ${app.name} aligned with GOALS.md (worktree+PR)`,
- 'release-check': `Verify release readiness for ${app.name}`
+ 'release-check': `Verify release readiness for ${app.name}`,
+ 'jira-sprint-manager': `Triage and implement JIRA sprint tickets for ${app.name} (worktree+PR)`
};
return descriptions[taskType] || null;
}
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index b58a589f9e..dc9477393b 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -540,6 +540,40 @@ Summarize:
IMPORTANT: Always use \`git pull --rebase --autostash\` before pushing (dev branch gets auto-bumped by CI). Never use \`git push\` alone.`,
+ 'jira-sprint-manager': `[Improvement: {appName}] JIRA Sprint Manager
+
+Triage and implement JIRA tickets for {appName}:
+
+Repository: {repoPath}
+
+## Phase 1 — Triage
+
+1. Call GET /api/apps to find the app config for {appName} (match by name or repoPath)
+2. Get the app's JIRA config: jira.instanceId and jira.projectKey
+3. Call GET /api/jira/instances/:instanceId/my-sprint-tickets/:projectKey to get tickets assigned to me in current sprint
+4. For each ticket, evaluate what needs to be done next:
+ a) Needs clarification or better requirements? Create a Review Hub todo via POST /api/review/todo with title "[TICKET-KEY] Needs clarification" and description listing the questions
+ b) Blocked or needs discussion? Create a Review Hub todo with title "[TICKET-KEY] Blocked" and description explaining the blockers
+ c) Well-defined and ready to work? Mark it as a candidate for implementation
+5. Prioritize tickets marked as HIGH or Blocker
+
+Do NOT comment on JIRA tickets directly — all action items go to the Review Hub so the user can review them in one place.
+
+## Phase 2 — Implement
+
+6. From the triage results, select the highest priority ticket in "To Do" or "Ready" status that is well-defined
+7. For the selected ticket:
+ - Implement the ticket requirements in {repoPath}
+ - Commit changes and push the branch
+ - Create a merge request using gh CLI or glab CLI (detect from git remote)
+ - Transition the ticket to "In Review" status
+ - Add a comment to JIRA with the MR link
+8. If no tickets are ready to implement, skip Phase 2
+
+## Phase 3 — Report
+
+9. Generate a summary report covering triage actions taken and implementation work completed`,
+
'pr-reviewer': `[Improvement: {appName}] PR Review — Check Open PRs
Review open pull requests / merge requests on {appName} from other contributors and post code reviews on any that lack a review since the last commit.
@@ -709,7 +743,7 @@ export const SELF_IMPROVEMENT_TASK_TYPES = [
'security', 'code-quality', 'test-coverage', 'performance',
'accessibility', 'console-errors', 'dependency-updates', 'documentation',
'ui-bugs', 'mobile-responsive', 'feature-ideas', 'error-handling',
- 'typing', 'release-check', 'pr-reviewer'
+ 'typing', 'release-check', 'pr-reviewer', 'jira-sprint-manager'
];
const DEFAULT_TASK_INTERVALS = {
@@ -727,7 +761,8 @@ const DEFAULT_TASK_INTERVALS = {
'error-handling': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null },
'typing': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null },
'release-check': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null },
- 'pr-reviewer': { type: INTERVAL_TYPES.CUSTOM, intervalMs: 7200000, enabled: false, weekdaysOnly: true, providerId: null, model: null, prompt: null }
+ 'pr-reviewer': { type: INTERVAL_TYPES.CUSTOM, intervalMs: 7200000, enabled: false, weekdaysOnly: true, providerId: null, model: null, prompt: null },
+ 'jira-sprint-manager': { type: INTERVAL_TYPES.DAILY, enabled: false, weekdaysOnly: true, optIn: true, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: true, simplify: true } }
};
/**
@@ -1045,9 +1080,17 @@ export async function shouldRunTask(taskType, appId = null) {
// Check per-app override
if (appId) {
- const enabledForApp = await isTaskTypeEnabledForApp(appId, taskType);
- if (!enabledForApp) {
- return { shouldRun: false, reason: 'disabled-for-app' };
+ if (interval.optIn) {
+ // Opt-in tasks require explicit per-app enablement (default: disabled)
+ const overrides = await getAppTaskTypeOverrides(appId);
+ if (overrides[taskType]?.enabled !== true) {
+ return { shouldRun: false, reason: 'opt-in-not-enabled' };
+ }
+ } else {
+ const enabledForApp = await isTaskTypeEnabledForApp(appId, taskType);
+ if (!enabledForApp) {
+ return { shouldRun: false, reason: 'disabled-for-app' };
+ }
}
}
@@ -1325,6 +1368,10 @@ export async function getScheduleStatus() {
const check = await shouldRunTask(taskType);
// Build per-app overrides map and count enabled apps
+ // Opt-in tasks default to disabled; standard tasks default to enabled
+ const isEnabledForApp = interval.optIn
+ ? (override) => override?.enabled === true
+ : (override) => !override || override.enabled !== false;
const appOverrides = {};
let enabledAppCount = 0;
const allOverrides = await Promise.all(activeApps.map(app => getAppTaskTypeOverrides(app.id)));
@@ -1332,12 +1379,12 @@ export async function getScheduleStatus() {
const override = allOverrides[i][taskType];
if (override) {
appOverrides[activeApps[i].id] = {
- enabled: override.enabled !== false,
+ enabled: isEnabledForApp(override),
interval: override.interval || null,
...(override.taskMetadata && { taskMetadata: override.taskMetadata })
};
}
- if (!override || override.enabled !== false) {
+ if (isEnabledForApp(override)) {
enabledAppCount++;
}
}
@@ -1509,7 +1556,8 @@ function getTaskTypeDescription(taskType) {
'release-check': 'Check dev for release readiness',
'error-handling': 'Improve error handling',
'typing': 'Improve TypeScript types',
- 'pr-reviewer': 'Review open PRs from contributors'
+ 'pr-reviewer': 'Review open PRs from contributors',
+ 'jira-sprint-manager': 'Triage and implement JIRA sprint tickets'
};
return descriptions[taskType] || taskType.replace(/-/g, ' ');
}