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

guard the mind's duplicate-issue check against punctuation-only titles

[._.]/ Adam Eivy22184e96a48a
diff --git a/server/services/persistentMindIssueCapability.js b/server/services/persistentMindIssueCapability.js
index 78f0ba4a93..8dae2353c5 100644
--- a/server/services/persistentMindIssueCapability.js
+++ b/server/services/persistentMindIssueCapability.js
@@ -191,8 +191,11 @@ export async function filePersistentMindIssue(args) {
if (existing.transient) {
return { ok: false, error: `Could not read the existing ${app.forge} issues to check for duplicates (${existing.reason}); nothing was filed` };
}
+ // An all-punctuation title normalizes to the empty string, which would match
+ // every other such title — only a title with real content can dedupe.
const titleKey = normalizeIssueTitleKey(args.title);
- const duplicate = existing.issues.find((issue) => normalizeIssueTitleKey(issue.title) === titleKey);
+ const duplicate = titleKey
+ && existing.issues.find((issue) => normalizeIssueTitleKey(issue.title) === titleKey);
if (duplicate) {
return {
ok: true, duplicate: true, number: duplicate.number, url: duplicate.url,
@@ -211,7 +214,7 @@ export async function filePersistentMindIssue(args) {
planner: resolvePlannerId({ providerId: profile.providerId, model: profile.model }),
}),
...(args.labels || []),
- ];
+ ].filter((name, index, all) => all.indexOf(name) === index);
await ensureLabels({ app, names: labels });
const created = await createIssue({ app, title: args.title, body: args.body, labels });
diff --git a/server/services/persistentMindIssueCapability.test.js b/server/services/persistentMindIssueCapability.test.js
index 5bdb50b2d3..7facb10f1b 100644
--- a/server/services/persistentMindIssueCapability.test.js
+++ b/server/services/persistentMindIssueCapability.test.js
@@ -140,6 +140,14 @@ describe('persistent mind issue capability', () => {
expect(ghArgsFor('issue')).toEqual([]);
});
+ it('does not let two punctuation-only titles read as the same issue', async () => {
+ // Both normalize to the empty title key, which must not count as a match.
+ mocks.listAppIssues.mockResolvedValue(okList([openIssue({ title: '???' })]));
+
+ expect(await filePersistentMindIssue(fileRequest({ title: '!!!' }))).toMatchObject({ ok: true, duplicate: false });
+ expect(ghArgsFor('issue')).toHaveLength(1);
+ });
+
it('refuses to file when the tracker could not be read, rather than risking a duplicate', async () => {
mocks.listAppIssues.mockResolvedValue({ issues: [], reason: 'fetch-failed', transient: true, remedy: 'check gh auth' });