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: exclude ignored issues from claim task preloads

[._.]/ Adam Eivy03639d4a6490
diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.js
index 04d8352c40..4736866ea2 100644
--- a/server/services/perpetualWork.js
+++ b/server/services/perpetualWork.js
@@ -560,7 +560,7 @@ async function countOpenIssuesUnfiltered(cfg, repoPath, env) {
* issues; 'any' = every author). The in-flight scan runs only when the list is
* non-empty, so an empty queue parks without a wasted branch/PR scan.
*/
-async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self', issueExcludeLabels = [], requireComplete = false } = {}, contextOnly = false, env) {
+async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self', issueExcludeLabels = [], excludeNonActionableLabels = false, requireComplete = false } = {}, contextOnly = false, env) {
const cfg = FORGE_ISSUE_CONFIG[forgeKey];
const repoPath = app?.repoPath;
if (!repoPath) return { actionable: false, count: 0, reason: 'no-repo-path' };
@@ -683,13 +683,17 @@ async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self', is
if (trustedLogins) issues = issues.filter((i) => trustedLogins.has(i.authorLogin));
// Prompt context observes author and configured label policy without hiding
- // blocked/assigned work that a non-claim task may need to inspect.
+ // blocked/assigned work that a non-claim task may need to inspect. Claim
+ // preloads opt into the same structural label exclusions as the detector.
if (contextOnly) {
- const excluded = new Set((Array.isArray(issueExcludeLabels) ? issueExcludeLabels : []).map((label) => String(label).toLowerCase()));
+ const excluded = new Set((Array.isArray(issueExcludeLabels) ? issueExcludeLabels : []).map((label) => String(label).trim().toLowerCase()));
+ if (excludeNonActionableLabels) {
+ for (const label of NON_ACTIONABLE_ISSUE_LABELS) excluded.add(label);
+ }
return {
truncated: listingTruncated || (trustedLogins?.size || 0) > MAX_COLLABORATOR_AUTHOR_QUERIES,
issues: issues.filter((issue) => !(issue.labels || []).some((label) =>
- excluded.has(String(typeof label === 'string' ? label : label?.name).toLowerCase())
+ excluded.has(String(typeof label === 'string' ? label : label?.name).trim().toLowerCase())
))
};
}
diff --git a/server/services/perpetualWork.test.js b/server/services/perpetualWork.test.js
index 6c3ac33fc9..e7d4ede0b3 100644
--- a/server/services/perpetualWork.test.js
+++ b/server/services/perpetualWork.test.js
@@ -85,6 +85,34 @@ function routeSpawn(routes) {
}
describe('perpetualWork', () => {
+ it.each([
+ ['claim-issue', 'gh'], ['claim-issue-gitlab', 'glab'], ['claim-work', 'gh']
+ ])('excludes structural and user labels before rendering %s agent inputs', async (taskType, cli) => {
+ const { resolveTaskDataInputs } = await import('./taskDataInputs.js');
+ const labels = ['in-progress', 'blocked', 'needs-input', 'future', 'wontfix', 'question', 'discussion', 'Human-Only'];
+ const issues = labels.map((label, index) => ({
+ number: index + 1, iid: index + 1, title: `Excluded ${index}`,
+ labels: [index % 2 ? { name: label.toUpperCase() } : label]
+ }));
+ issues.push({ number: 20, iid: 20, title: 'Eligible work', labels: ['bug'] });
+ routeSpawn({ [`${cli} issue`]: { stdout: JSON.stringify(issues) } });
+ const options = {
+ app: { repoPath: '/repo' }, taskType,
+ taskMetadata: { issueAuthorFilter: 'any', issueExcludeLabels: [' human-only '] },
+ dependencies: {
+ resolveTracker: async () => ({ forge: cli, host: cli === 'gh' ? 'github.com' : 'gitlab.com' }),
+ resolveTokenEnv: async () => ({})
+ }
+ };
+ const [section] = await resolveTaskDataInputs(['open-issues'], options);
+ expect(section.content).toContain('#20 Eligible work');
+ expect(section.content).not.toContain('Excluded');
+ routeSpawn({ [`${cli} issue`]: { stdout: JSON.stringify(issues.slice(0, -1)) } });
+ const [empty] = await resolveTaskDataInputs(['open-issues'], options);
+ expect(empty.content).toContain('No open issues match');
+ expect(empty.content).not.toContain('Excluded');
+ });
+
describe('isActionableIssue', () => {
const base = { number: 7, title: 'Fix the thing', assignees: [], labels: [] };
diff --git a/server/services/taskDataInputs.js b/server/services/taskDataInputs.js
index 640d3e3ffa..67f6992c0b 100644
--- a/server/services/taskDataInputs.js
+++ b/server/services/taskDataInputs.js
@@ -262,6 +262,7 @@ const INPUT_LOADERS = {
issueAuthorFilter: taskMetadata.issueAuthorFilter
?? (claimTask ? 'self' : 'any'),
issueExcludeLabels: taskMetadata.issueExcludeLabels || [],
+ excludeNonActionableLabels: claimTask,
}, forge.env)
: await deps.listIssues({ cli: forge.cli, cwd: app.repoPath, env: forge.env });
return result.ok
diff --git a/server/services/taskDataInputs.test.js b/server/services/taskDataInputs.test.js
index 3941da8f49..91984d335a 100644
--- a/server/services/taskDataInputs.test.js
+++ b/server/services/taskDataInputs.test.js
@@ -142,12 +142,12 @@ describe('taskDataInputs', () => {
};
const sections = await resolveTaskDataInputs(['open-issues'], options);
expect(sections[0].content).toContain('#7 Eligible');
- expect(listConfiguredIssues).toHaveBeenCalledWith('gh', APP, options.taskMetadata, expect.any(Object));
+ expect(listConfiguredIssues).toHaveBeenCalledWith('gh', APP, { ...options.taskMetadata, excludeNonActionableLabels: true }, expect.any(Object));
listConfiguredIssues.mockResolvedValue({ ok: false, issues: [] });
expect((await resolveTaskDataInputs(['open-issues'], options))[0].content).toContain('could not be preloaded');
options.taskMetadata = {};
await resolveTaskDataInputs(['open-issues'], options);
- expect(listConfiguredIssues).toHaveBeenLastCalledWith('gh', APP, { issueAuthorFilter: 'self', issueExcludeLabels: [] }, expect.any(Object));
+ expect(listConfiguredIssues).toHaveBeenLastCalledWith('gh', APP, { issueAuthorFilter: 'self', issueExcludeLabels: [], excludeNonActionableLabels: true }, expect.any(Object));
expect(listIssues).not.toHaveBeenCalled();
});