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: use target app labels for repo studies

[._.]/ Adam Eivyed678085584b
diff --git a/server/lib/dispatchLabels.js b/server/lib/dispatchLabels.js
index 86d5f36168..aa81ffd8a1 100644
--- a/server/lib/dispatchLabels.js
+++ b/server/lib/dispatchLabels.js
@@ -295,3 +295,14 @@ export const REPO_STUDY_LABEL_CONTRACT = Object.freeze({
'If a proposal cannot be classified defensibly on all three axes, do not file that proposal; filing an incomplete issue is not a valid fallback. After each NEW issue, read its labels back and repair any missing required label before continuing; never relabel a duplicate you skipped. Contributor labels remain optional and must follow the shared guidance.',
].join('\n'),
});
+
+/** Repo-study contract for managed apps whose label taxonomy is not PortOS's. */
+export const GENERIC_REPO_STUDY_LABEL_CONTRACT = Object.freeze({
+ forgeFlags: '--label area:<area> --label model:<tier> --label effort:<level>',
+ jiraFlags: '`area:<area>` + `model-<tier>` + `effort-<level>`',
+ instructions: [
+ '**Repo-study complete-label contract (mandatory):** every NEW proposal must carry `repo-study`, `plan`, at least one relevant `area:*`, exactly one justified model label (`model:*` on GitHub/GitLab, `model-*` on JIRA), and exactly one justified effort label (`effort:*` on GitHub/GitLab, `effort-*` on JIRA). The dispatch axes are independent: choose them from the inspected target-app files and proposed implementation, never by stamping `medium` on both.',
+ 'Scope labels (`area:*`) are required for repo-study issues. Inspect the target app\'s existing tracker labels and apply the narrowest relevant labels; create a genuinely missing, clearly scoped area label only when the tracker supports it.',
+ 'If a proposal cannot be classified defensibly on all three axes, do not file that proposal; filing an incomplete issue is not a valid fallback. After each NEW issue, read its labels back and repair any missing required label before continuing; never relabel a duplicate you skipped. Contributor labels remain optional and must follow the shared guidance.',
+ ].join('\n'),
+});
diff --git a/server/lib/workTracker.js b/server/lib/workTracker.js
index e7eeba08d7..ecc8cb9a0a 100644
--- a/server/lib/workTracker.js
+++ b/server/lib/workTracker.js
@@ -323,13 +323,16 @@ ${jiraLabelContract}
* (cosTaskGenerator.js), the on-commit reference-watch trigger
* (referenceRepos.js), and the one-off `repo-study` (repoIntake.js).
*/
-export async function resolveTrackerFilingBlock(app, taskType) {
+export async function resolveTrackerFilingBlock(app, taskType, options = {}) {
if (!TRACKER_FILING_TASK_TYPES.has(taskType)) return { trackerInstructions: '', workTracker: null };
// Never throws — degrades to the PLAN.md block, which `isFileTracker` then
// agrees with, so the flag and the instructions stay consistent.
const workTracker = await resolveAppWorkTracker(app).catch(() => ({ resolved: 'plan' }));
return {
- trackerInstructions: formatTrackerInstructions(workTracker.resolved, TRACKER_FILING_PRESETS[taskType]),
+ trackerInstructions: formatTrackerInstructions(workTracker.resolved, {
+ ...TRACKER_FILING_PRESETS[taskType],
+ ...options,
+ }),
workTracker: workTracker.resolved,
worktreeChangesExpected: isFileTracker(workTracker.resolved),
};
diff --git a/server/services/repoIntake.js b/server/services/repoIntake.js
index f208a50514..a7fd6a8d82 100644
--- a/server/services/repoIntake.js
+++ b/server/services/repoIntake.js
@@ -22,6 +22,7 @@ import * as cos from './cos.js';
import { getAppById, PORTOS_APP_ID } from './apps.js';
import { prepareScanReportDirectory, reportPathForId } from './malwareScanReports.js';
import { resolveTrackerFilingBlock } from '../lib/workTracker.js';
+import { GENERIC_REPO_STUDY_LABEL_CONTRACT } from '../lib/dispatchLabels.js';
import { normalizeRepoIntake } from '../lib/repoIntakeActions.js';
/** `owner/repo` when the link carries GitHub metadata, else its display title. */
@@ -153,7 +154,9 @@ export async function queueRepoStudy(link, targetAppId = PORTOS_APP_ID) {
// never disagree (a github/gitlab/jira run files out of band and leaves the
// tree clean; without the flag it is mistaken for missing code work, #3102).
const { trackerInstructions, workTracker, worktreeChangesExpected } =
- await resolveTrackerFilingBlock(app, 'repo-study');
+ await resolveTrackerFilingBlock(app, 'repo-study', app.id === PORTOS_APP_ID
+ ? {}
+ : { issueLabelContract: GENERIC_REPO_STUDY_LABEL_CONTRACT });
const result = await cos.addTask(
{
diff --git a/server/services/repoIntake.test.js b/server/services/repoIntake.test.js
index cbcf0ce97c..38a023e164 100644
--- a/server/services/repoIntake.test.js
+++ b/server/services/repoIntake.test.js
@@ -110,6 +110,8 @@ describe('queueRepoStudy', () => {
expect(getAppById).toHaveBeenCalledWith(target.id);
expect(addTask.mock.calls[0][0].app).toBe(target.id);
expect(addTask.mock.calls[0][0].context).toContain('Example App');
+ expect(addTask.mock.calls[0][0].context).toContain('inspected target-app files');
+ expect(addTask.mock.calls[0][0].context).not.toContain('current PortOS area vocabulary');
});
// `analysisType` enrolls a task in taskSchedule's per-type consecutive-failure