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: only reuse our own monitoring summary, never hijack an unrelated one (#2464)

Adam Eivyb09a36b3dd95
diff --git a/server/services/autonomousJobs/selfDiagnostics.js b/server/services/autonomousJobs/selfDiagnostics.js
index 1a37e003ca..dc28feb581 100644
--- a/server/services/autonomousJobs/selfDiagnostics.js
+++ b/server/services/autonomousJobs/selfDiagnostics.js
@@ -150,10 +150,15 @@ function runCli(cmd, args, options = {}) {
}
/**
- * Locate the persistent summary issue to reuse. Prefers an open `monitoring`
- * issue carrying our slug marker; falls back to the first open `monitoring`
- * issue. Returns `{ ok, issue }` — `ok:false` means the read FAILED (do NOT then
- * create a new one, or a transient `gh` blip files a duplicate; sentinel rule).
+ * Locate OUR persistent summary issue to reuse. Matches only an open `monitoring`
+ * issue that is identifiably ours — by the embedded slug marker, or (forward-compat
+ * for a summary filed before the marker existed) by our exact stable title. It
+ * deliberately does NOT fall back to "the first arbitrary `monitoring` issue": the
+ * handler edit-overwrites the body it returns, so reusing an unrelated issue the
+ * user labeled `monitoring` for their own tracking would clobber it. When none is
+ * ours, returns `{ ok:true, issue:null }` so the handler files its own dedicated
+ * summary. `ok:false` means the read FAILED (do NOT then create — a transient `gh`
+ * blip would file a duplicate; sentinel rule).
*/
export async function findMonitoringIssue({ cwd = PATHS.root, exec = runCli } = {}) {
const { code, stdout } = await exec('gh',
@@ -170,8 +175,8 @@ export async function findMonitoringIssue({ cwd = PATHS.root, exec = runCli } =
url: i.url || null,
labels: (i.labels || []).map(l => (typeof l === 'string' ? l : l?.name)).filter(Boolean)
}))
- const bySlug = norm.find(i => i.body.includes(SLUG_MARKER))
- return { ok: true, issue: bySlug || norm[0] || null }
+ const ours = norm.find(i => i.body.includes(SLUG_MARKER)) || norm.find(i => i.title === STABLE_TITLE)
+ return { ok: true, issue: ours || null }
}
/**
diff --git a/server/services/autonomousJobs/selfDiagnostics.test.js b/server/services/autonomousJobs/selfDiagnostics.test.js
index 4eff6b0887..e7595d92f5 100644
--- a/server/services/autonomousJobs/selfDiagnostics.test.js
+++ b/server/services/autonomousJobs/selfDiagnostics.test.js
@@ -133,6 +133,35 @@ describe('findMonitoringIssue', () => {
expect(issue.labels).toContain('needs attention')
})
+ it('does NOT hijack an unrelated monitoring issue with no marker and a different title', async () => {
+ const exec = makeExec([{
+ match: argsHave('issue', 'list'),
+ result: {
+ code: 0,
+ stdout: JSON.stringify([
+ { number: 10, title: 'My infra dashboard', body: 'hand-maintained notes', labels: [{ name: 'monitoring' }] }
+ ])
+ }
+ }])
+ const { ok, issue } = await findMonitoringIssue({ exec })
+ expect(ok).toBe(true)
+ expect(issue).toBeNull()
+ })
+
+ it('reuses a pre-marker summary by its exact stable title', async () => {
+ const exec = makeExec([{
+ match: argsHave('issue', 'list'),
+ result: {
+ code: 0,
+ stdout: JSON.stringify([
+ { number: 5, title: 'CoS self-diagnostics: self-healing failures', body: 'old body, no marker', labels: [{ name: 'monitoring' }] }
+ ])
+ }
+ }])
+ const { issue } = await findMonitoringIssue({ exec })
+ expect(issue.number).toBe(5)
+ })
+
it('distinguishes a failed read (ok:false) from an empty list (ok:true)', async () => {
const fail = makeExec([{ match: argsHave('issue', 'list'), result: { code: 1, stdout: '', stderr: 'gh boom' } }])
expect(await findMonitoringIssue({ exec: fail })).toEqual({ ok: false, issue: null })