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

address review (codex): constrain issue planning to supported trackers

[._.]/ Adam Eivy60af10ccf4c2
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsx
index eb9659baf5..93991b396c 100644
--- a/client/src/components/cos/TaskAddForm.jsx
+++ b/client/src/components/cos/TaskAddForm.jsx
@@ -141,6 +141,52 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
[apps, newTask.app]
);
const appHasJira = selectedApp?.jira?.enabled;
+ const [resolvedWorkTracker, setResolvedWorkTracker] = useState({ appId: null, tracker: null });
+
+ // Plan-and-file uses the bundled issue-only `plan-task` command. Resolve an
+ // app's effective tracker before exposing the toggle so PLAN.md and JIRA
+ // apps cannot queue an issue workflow their tracker does not support.
+ useEffect(() => {
+ const configuredTracker = selectedApp?.workTracker;
+ if (!selectedApp?.id || (configuredTracker && configuredTracker !== 'auto')) {
+ setResolvedWorkTracker({ appId: selectedApp?.id || null, tracker: null });
+ return undefined;
+ }
+
+ const appId = selectedApp.id;
+ setResolvedWorkTracker({ appId, tracker: null });
+ let cancelled = false;
+ Promise.resolve(api.getAppWorkTracker(appId, { silent: true }))
+ .then(info => {
+ if (!cancelled) setResolvedWorkTracker({ appId, tracker: info?.resolved || null });
+ })
+ .catch(() => {
+ if (!cancelled) setResolvedWorkTracker({ appId, tracker: null });
+ });
+ return () => { cancelled = true; };
+ }, [selectedApp?.id, selectedApp?.workTracker]);
+
+ const planOnlyTrackerStatus = useMemo(() => {
+ if (!selectedApp) return 'supported';
+ const configuredTracker = selectedApp.workTracker;
+ const tracker = configuredTracker && configuredTracker !== 'auto'
+ ? configuredTracker
+ : resolvedWorkTracker.appId === selectedApp.id ? resolvedWorkTracker.tracker : null;
+ if (!tracker) return 'pending';
+ return tracker === 'github' || tracker === 'gitlab' ? 'supported' : 'unsupported';
+ }, [resolvedWorkTracker, selectedApp]);
+ const planOnlySupported = planOnlyTrackerStatus === 'supported';
+
+ // Clear a template or an already-selected mode when an app resolves to a
+ // tracker that cannot receive the issue-only plan-task workflow.
+ useEffect(() => {
+ if (planOnlyTrackerStatus !== 'unsupported' || !planOnly) return;
+ setPlanOnly(false);
+ if (slashdoCommand === 'plan-task') {
+ setSlashdoCommand('');
+ setWorktreeChangesExpected(undefined);
+ }
+ }, [planOnly, planOnlyTrackerStatus, slashdoCommand]);
// Gate on a content signature of the selected app's defaults (not the
// `apps` array reference) so periodic re-fetches in the parent don't
@@ -194,6 +240,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
})();
const handlePlanOnlyChange = (enabled) => {
+ if (enabled && !planOnlySupported) return;
setPlanOnly(enabled);
if (enabled) {
setSlashdoCommand('plan-task');
@@ -395,7 +442,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
targetInstanceId: targetInstanceId || undefined,
planOnly,
slashdoCommand: planOnly ? 'plan-task' : (slashdoCommand || undefined),
- slashdoArgs: planOnly ? '--issues --yes' : undefined,
+ slashdoArgs: planOnly ? '--yes' : undefined,
createJiraTicket: planOnly ? false : createJiraTicket,
useWorktree: planOnly ? false : useWorktree,
openPR: planOnly ? false : useWorktree && openPR,
@@ -618,19 +665,32 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
Enhance
</span>
</label>
- <label htmlFor="task-plan-only" className="flex items-center gap-2 cursor-pointer select-none whitespace-nowrap py-1">
- <input
- id="task-plan-only"
- type="checkbox"
- checked={planOnly}
- onChange={(e) => handlePlanOnlyChange(e.target.checked)}
- className="w-4 h-4 rounded border-port-border bg-port-bg text-port-accent focus:ring-port-accent focus:ring-offset-0"
- />
- <span className="flex items-center gap-1.5 text-sm text-gray-400" title="Read the codebase and file a GitHub or GitLab issue without implementing the task.">
- <FileText size={14} className="text-port-accent" />
- Plan &amp; file issue
- </span>
- </label>
+ {planOnlyTrackerStatus !== 'unsupported' && (
+ <label htmlFor="task-plan-only" className="flex items-center gap-2 cursor-pointer select-none whitespace-nowrap py-1">
+ <input
+ id="task-plan-only"
+ type="checkbox"
+ checked={planOnly}
+ disabled={!planOnlySupported}
+ onChange={(e) => handlePlanOnlyChange(e.target.checked)}
+ className="w-4 h-4 rounded border-port-border bg-port-bg text-port-accent focus:ring-port-accent focus:ring-offset-0 disabled:opacity-40"
+ />
+ <span className="flex items-center gap-1.5 text-sm text-gray-400" title="Read the codebase and file a GitHub or GitLab issue without implementing the task.">
+ <FileText size={14} className="text-port-accent" />
+ Plan &amp; file issue
+ </span>
+ </label>
+ )}
+ {planOnlyTrackerStatus === 'pending' && (
+ <p className="basis-full text-xs text-gray-500">
+ Checking the app&apos;s work tracker before enabling issue planning.
+ </p>
+ )}
+ {planOnlyTrackerStatus === 'unsupported' && (
+ <p className="basis-full text-xs text-gray-500">
+ Plan &amp; file issue is available for GitHub or GitLab issue trackers.
+ </p>
+ )}
{planOnly && (
<p className="basis-full text-xs text-gray-500">
Read-only planning: file the issue without code changes, a worktree, PR, simplify pass, or review.
diff --git a/client/src/components/cos/TaskAddForm.test.jsx b/client/src/components/cos/TaskAddForm.test.jsx
index b349a0d323..85bae67ffd 100644
--- a/client/src/components/cos/TaskAddForm.test.jsx
+++ b/client/src/components/cos/TaskAddForm.test.jsx
@@ -9,6 +9,7 @@ const api = vi.hoisted(() => ({
// Back the reviewer table's Model column (useReviewerModelOptions).
getLocalLlmStatus: vi.fn(),
getProviders: vi.fn(),
+ getAppWorkTracker: vi.fn(),
applyCosTaskTemplate: vi.fn(),
addCosTask: vi.fn()
}));
@@ -30,6 +31,7 @@ describe('TaskAddForm responsive layout', () => {
api.getCodeReviewDefaults.mockResolvedValue(null);
api.getLocalLlmStatus.mockResolvedValue({ ollama: { models: [] }, lmstudio: { models: [] } });
api.getProviders.mockResolvedValue({ providers: [] });
+ api.getAppWorkTracker.mockResolvedValue({ resolved: 'github' });
api.applyCosTaskTemplate.mockResolvedValue({ success: true });
apiSystem.getAssignableInstances.mockResolvedValue({ instances: [] });
});
@@ -96,7 +98,7 @@ describe('TaskAddForm responsive layout', () => {
expect(api.addCosTask.mock.calls.at(-1)[0]).toMatchObject({
planOnly: true,
slashdoCommand: 'plan-task',
- slashdoArgs: '--issues --yes',
+ slashdoArgs: '--yes',
useWorktree: false,
openPR: false,
simplify: false,
@@ -111,6 +113,30 @@ describe('TaskAddForm responsive layout', () => {
expect(openPrToggle()).toBeChecked();
});
});
+
+ it.each([
+ ['PLAN.md', 'plan', 'plan'],
+ ['JIRA', 'jira', 'jira'],
+ ['auto-resolved JIRA', 'auto', 'jira'],
+ ])('does not offer plan-and-file mode for %s apps', async (_label, workTracker, resolvedTracker) => {
+ api.getAppWorkTracker.mockResolvedValue({ resolved: resolvedTracker });
+ render(
+ <TaskAddForm
+ providers={[]}
+ apps={[{
+ id: 'tracker-app',
+ name: 'Tracker App',
+ repoPath: 'example.com/repo',
+ workTracker,
+ }]}
+ defaultApp="tracker-app"
+ onTaskAdded={vi.fn()}
+ />
+ );
+
+ await waitFor(() => expect(screen.getByText(/Plan & file issue is available for GitHub or GitLab/i)).toBeInTheDocument());
+ expect(screen.queryByLabelText(/Plan & file issue/i)).toBeNull();
+ });
});
// A slashdo quick-template carries the run shape its workflow implies (#3089).
@@ -125,7 +151,7 @@ describe('TaskAddForm quick templates', () => {
const renderForm = () => render(
<TaskAddForm
providers={[]}
- apps={[{ id: 'example-app', name: 'Example App', repoPath: 'example.com/repo', defaultOpenPR: true, defaultUseWorktree: true }]}
+ apps={[{ id: 'example-app', name: 'Example App', repoPath: 'example.com/repo', workTracker: 'github', defaultOpenPR: true, defaultUseWorktree: true }]}
defaultApp="example-app"
onTaskAdded={vi.fn()}
/>
@@ -136,6 +162,7 @@ describe('TaskAddForm quick templates', () => {
api.getCodeReviewDefaults.mockResolvedValue(null);
api.getLocalLlmStatus.mockResolvedValue({ ollama: { models: [] }, lmstudio: { models: [] } });
api.getProviders.mockResolvedValue({ providers: [] });
+ api.getAppWorkTracker.mockResolvedValue({ resolved: 'github' });
api.applyCosTaskTemplate.mockResolvedValue({ success: true });
});
diff --git a/server/lib/schemaVersions.js b/server/lib/schemaVersions.js
index 3097530aa3..802a36c7c7 100644
--- a/server/lib/schemaVersions.js
+++ b/server/lib/schemaVersions.js
@@ -585,7 +585,7 @@ export const PORTOS_SCHEMA_VERSIONS = Object.freeze({
// the task. Per-category gate → only cos-tasks sync pauses until the peer
// upgrades.
// v7 = plan-only issue-filing tasks (metadata.planOnly, the forced
- // plan-task --issues --yes invocation, and the task-description context
+ // plan-task --yes invocation, and the task-description context
// bridge). A <=v6 peer accepts the permissive metadata map but does not
// understand the no-delivery execution contract, so it can claim the task
// and run the workflow without the description context needed to file the
diff --git a/server/routes/cos.test.js b/server/routes/cos.test.js
index c1cc90c6c9..6909303a3d 100644
--- a/server/routes/cos.test.js
+++ b/server/routes/cos.test.js
@@ -100,7 +100,9 @@ vi.mock('../services/cosTaskGenerator.js', async (importActual) => ({
buildClaimWorkTask: vi.fn()
}));
vi.mock('../services/apps.js', () => ({
- getAppById: vi.fn()
+ getAppById: vi.fn(),
+ getAppWorkTracker: vi.fn(),
+ PORTOS_APP_ID: 'portos-default'
}));
// The per-ticket `/tasks/jira-ticket` route loads the claim-issue-jira prompt
diff --git a/server/routes/cosTaskRoutes.js b/server/routes/cosTaskRoutes.js
index 85708db2da..3560a522ac 100644
--- a/server/routes/cosTaskRoutes.js
+++ b/server/routes/cosTaskRoutes.js
@@ -8,7 +8,7 @@ import * as cos from '../services/cos.js';
import * as taskWatcher from '../services/taskWatcher.js';
import { enhanceTaskPrompt } from '../services/taskEnhancer.js';
import { buildClaimWorkTask, buildJiraTicketTask } from '../services/cosTaskGenerator.js';
-import { getAppById } from '../services/apps.js';
+import { getAppById, getAppWorkTracker, PORTOS_APP_ID } from '../services/apps.js';
import { getAssignableInstances } from '../services/instances.js';
import { workTrackerLabel } from '../lib/workTracker.js';
import { getSlashdoWorkflow, slashdoWorkflowAppliesTo, SLASHDO_COMMAND_NAMES } from '../lib/slashdoCatalog.js';
@@ -48,6 +48,21 @@ async function assertAssignableInstance(instanceId) {
throw new ServerError('Unknown instance — pick one of this install\'s federated instances', { status: 400, code: 'UNKNOWN_INSTANCE' });
}
+const ISSUE_TRACKERS = new Set(['github', 'gitlab']);
+
+// The bundled plan-task workflow files an issue; it cannot target PLAN.md or
+// JIRA. Keep the API contract aligned with the quick-task form so direct
+// callers cannot bypass the tracker gate.
+async function assertPlanOnlyTracker(taskData) {
+ if (taskData.planOnly !== true && taskData.slashdoCommand !== 'plan-task') return;
+ const trackerInfo = await getAppWorkTracker(taskData.app || PORTOS_APP_ID);
+ if (!trackerInfo || ISSUE_TRACKERS.has(trackerInfo.resolved)) return;
+ throw new ServerError(
+ `Plan-and-file tasks require a GitHub or GitLab issue tracker (resolved to ${trackerInfo.resolved})`,
+ { status: 400, code: 'UNSUPPORTED_PLAN_ONLY_TRACKER' }
+ );
+}
+
const router = Router();
// GET /api/cos/tasks - Get all tasks (user + internal), grouped by source.
@@ -305,6 +320,7 @@ router.post('/tasks', asyncHandler(async (req, res) => {
if (!parsed.success) failValidation(parsed);
const { type, ...taskData } = parsed.data;
if (taskData.targetInstanceId) await assertAssignableInstance(taskData.targetInstanceId);
+ await assertPlanOnlyTracker(taskData);
const result = await cos.addTask(taskData, type);
if (result?.duplicate) {
diff --git a/server/routes/cosTaskRoutes.test.js b/server/routes/cosTaskRoutes.test.js
index ae8522df2f..1ad55dccf8 100644
--- a/server/routes/cosTaskRoutes.test.js
+++ b/server/routes/cosTaskRoutes.test.js
@@ -33,12 +33,13 @@ vi.mock('../services/cosTaskGenerator.js', () => ({
buildClaimWorkTask: vi.fn(),
buildJiraTicketTask: vi.fn(),
}));
-vi.mock('../services/apps.js', () => ({ getAppById: vi.fn() }));
+vi.mock('../services/apps.js', () => ({ getAppById: vi.fn(), getAppWorkTracker: vi.fn(), PORTOS_APP_ID: 'portos-default' }));
vi.mock('../services/streamingDetect.js', () => ({ NON_PM2_TYPES: new Set() }));
vi.mock('../services/instances.js', () => ({ getAssignableInstances: vi.fn() }));
import * as cos from '../services/cos.js';
import { getAssignableInstances } from '../services/instances.js';
+import { getAppWorkTracker } from '../services/apps.js';
import cosTaskRoutes from './cosTaskRoutes.js';
const SELF = 'self-instance-id';
@@ -87,6 +88,31 @@ describe('POST /api/cos/tasks — targetInstanceId (#4520)', () => {
});
});
+describe('POST /api/cos/tasks — plan-only tracker gate', () => {
+ it('rejects issue-only planning for a non-issue tracker', async () => {
+ getAppWorkTracker.mockResolvedValue({ resolved: 'jira' });
+
+ const res = await request(buildApp())
+ .post('/api/cos/tasks')
+ .send({ description: 'plan the change', app: 'jira-app', planOnly: true });
+
+ expect(res.status).toBe(400);
+ expect(res.body.code).toBe('UNSUPPORTED_PLAN_ONLY_TRACKER');
+ expect(cos.addTask).not.toHaveBeenCalled();
+ });
+
+ it('allows issue-only planning for a GitLab tracker', async () => {
+ getAppWorkTracker.mockResolvedValue({ resolved: 'gitlab' });
+
+ const res = await request(buildApp())
+ .post('/api/cos/tasks')
+ .send({ description: 'plan the change', app: 'gitlab-app', planOnly: true });
+
+ expect(res.status).toBe(200);
+ expect(cos.addTask).toHaveBeenCalledWith(expect.objectContaining({ planOnly: true }), 'user');
+ });
+});
+
describe('PUT /api/cos/tasks/:id — targetInstanceId (#4520)', () => {
const metadataOf = () => cos.updateTask.mock.calls[0][1].metadata;
diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.js
index d61d8a68a1..227b112337 100644
--- a/server/services/agentPromptBuilder.test.js
+++ b/server/services/agentPromptBuilder.test.js
@@ -2619,7 +2619,7 @@ describe('buildAgentPrompt — slashdo-backed tasks', () => {
const prompt = await buildAgentPrompt(
slashdoTask({
planOnly: true,
- slashdoArgs: '--issues --yes',
+ slashdoArgs: '--yes',
readOnly: true,
noCodeOutput: true,
useWorktree: false,
@@ -2629,7 +2629,7 @@ describe('buildAgentPrompt — slashdo-backed tasks', () => {
}), {}, '/r', null, isTruthyMeta,
{ providerType: 'cli', providerId: 'codex' });
- expect(prompt).toContain('--issues --yes');
+ expect(prompt).toContain('--yes');
expect(prompt).toContain('Apply it to the task described above.');
expect(prompt).toContain('## Completion (No Code Output)');
expect(prompt).not.toContain('## Completion Workflow');
diff --git a/server/services/cosTaskStore.js b/server/services/cosTaskStore.js
index 49626ae1a0..503f80e894 100644
--- a/server/services/cosTaskStore.js
+++ b/server/services/cosTaskStore.js
@@ -508,11 +508,11 @@ export async function addTask(taskData, taskType = 'user', { raw = false, ignore
}
if (planOnly) {
// Plan-and-file is a single bounded CoS action. The bundled plan-task
- // command defaults to PLAN.md, so force issue mode as well as `--yes` to
- // make this toggle's GitHub/GitLab deliverable unambiguous and unattended.
+ // command is already issue-only, so pass its supported `--yes` flag to
+ // make this toggle's issue-filing action unattended.
metadata.planOnly = true;
metadata.slashdoCommand = 'plan-task';
- metadata.slashdoArgs = '--issues --yes';
+ metadata.slashdoArgs = '--yes';
metadata.readOnly = true;
metadata.noCodeOutput = true;
metadata.useWorktree = false;
diff --git a/server/services/cosTaskStore.test.js b/server/services/cosTaskStore.test.js
index 7ee65e7397..67fb10cf56 100644
--- a/server/services/cosTaskStore.test.js
+++ b/server/services/cosTaskStore.test.js
@@ -513,7 +513,7 @@ describe('cosTaskStore.addTask', () => {
expect(created.metadata).toMatchObject({
planOnly: true,
slashdoCommand: 'plan-task',
- slashdoArgs: '--issues --yes',
+ slashdoArgs: '--yes',
readOnly: true,
noCodeOutput: true,
useWorktree: false,