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: hide disabled GitHub accounts from the instance inbox

picodote7f638668aa3
diff --git a/client/src/components/github/GitHubInboxTab.jsx b/client/src/components/github/GitHubInboxTab.jsx
index 770d398a1f..6cdefe7174 100644
--- a/client/src/components/github/GitHubInboxTab.jsx
+++ b/client/src/components/github/GitHubInboxTab.jsx
@@ -173,7 +173,7 @@ export default function GitHubInboxTab() {
});
};
- const enabledAccounts = (accounts || []).filter((account) => account.enabled);
+ const enabledAccounts = (accounts || []).filter((account) => account.enabled && account.mode !== 'disabled');
const labelFor = (id) => (enabledAccounts.length > 1 ? accounts.find((account) => account.id === id)?.label : null);
const syncErrors = Object.entries(data?.sync || {}).filter(([id, state]) => state.lastError && (!accountId || id === accountId));
const lastSyncAt = Object.values(data?.sync || {}).map((state) => state.lastSyncAt).filter(Boolean).sort().at(-1);
diff --git a/client/src/pages/GitHub.test.jsx b/client/src/pages/GitHub.test.jsx
index 7b4d1a13aa..c67d307d5a 100644
--- a/client/src/pages/GitHub.test.jsx
+++ b/client/src/pages/GitHub.test.jsx
@@ -449,6 +449,18 @@ describe('GitHub inbox tab', () => {
mock.getGitHubNotifications.mockResolvedValue({ notifications: [NOTIFICATION], sync: {} });
});
+ it('offers only accounts active on this instance in the inbox filter', async () => {
+ mock.getGitHubAccounts.mockResolvedValue([
+ IMPLICIT,
+ { ...IMPLICIT, id: 'other', label: 'Other active' },
+ { ...IMPLICIT, id: 'disabled', label: 'Disabled mode', mode: 'disabled' },
+ { ...IMPLICIT, id: 'off', label: 'Turned off', enabled: false },
+ ]);
+ await renderInbox();
+ const picker = await screen.findByRole('combobox', { name: 'Account' });
+ expect([...picker.options].map(option => option.value)).toEqual(['', IMPLICIT.id, 'other']);
+ });
+
it('says why a thread is here and what state its pull request is in', async () => {
mock.getGitHubNotifications.mockResolvedValue({ notifications: [{ ...NOTIFICATION,
subjectStatus: { state: 'open', draft: false, mergeState: 'blocked' } }], sync: {} });
@@ -910,7 +922,7 @@ describe('GitHub automations tab', () => {
agentRules: [expect.objectContaining({ kind: 'ci-activity', repo: 'octocat/hello', action: 'done' })],
}));
await waitFor(() => expect(mock.syncGitHubNotifications).toHaveBeenCalledWith('github-com', { silent: true }));
- expect(screen.queryByRole('form', { name: 'New automation rule' })).toBeNull();
+ await waitFor(() => expect(screen.queryByRole('form', { name: 'New automation rule' })).toBeNull());
});
it('saves and edits owner rules while counting only threads without a repo override', async () => {
diff --git a/server/services/githubNotifications.db.test.js b/server/services/githubNotifications.db.test.js
index 9af973a09b..ad7dadc65b 100644
--- a/server/services/githubNotifications.db.test.js
+++ b/server/services/githubNotifications.db.test.js
@@ -1452,6 +1452,31 @@ describe.skipIf(!runDb)('GitHub notifications inbox against Postgres', () => {
fetchSpy.mockRestore();
});
+ it.each([{ mode: 'disabled' }, { enabled: false }])('hides cached inbox rows, counts and sync errors for inactive accounts (%j) without deleting them', async (disabled) => {
+ mockGh(() => listing([thread('821')]));
+ await syncAccountNotifications(account.id, { automate: false });
+ await query('UPDATE github_notification_sync SET last_error = $2 WHERE account_id = $1', [account.id, 'Old sync failure']);
+ expect((await listNotifications({ accountId: account.id })).counts.all).toBe(1);
+ await updateAccount(account.id, disabled);
+ vi.mocked(execGh).mockClear();
+
+ for (const view of ['needs-you', 'suspect', 'handled', 'all']) {
+ const scoped = await listNotifications({ accountId: account.id, view });
+ expect(scoped.notifications).toEqual([]);
+ expect(Object.values(scoped.counts).every(count => count === 0)).toBe(true);
+ expect(scoped.sync).toEqual({});
+ const combined = await listNotifications({ view });
+ expect(combined.notifications.some(row => row.accountId === account.id)).toBe(false);
+ expect(combined.sync[account.id]).toBeUndefined();
+ }
+ await updateAccount(account.id, { mode: 'observe', enabled: true });
+ const restored = await listNotifications({ accountId: account.id });
+ expect(restored.notifications.map(row => row.threadId)).toEqual(['821']);
+ expect(restored.counts.all).toBe(1);
+ expect(restored.sync[account.id].lastError).toBe('Old sync failure');
+ expect(execGh).not.toHaveBeenCalled();
+ });
+
it('never fetches or processes a disabled account, scheduled or manual', async () => {
mockGh(() => listing([thread('811')]));
await updateAccount(account.id, { mode: 'disabled' });
diff --git a/server/services/githubNotifications.js b/server/services/githubNotifications.js
index 9d61f16b8c..51faa58766 100644
--- a/server/services/githubNotifications.js
+++ b/server/services/githubNotifications.js
@@ -396,9 +396,9 @@ export async function listActionableNotifications({ limit = 100 } = {}) {
}
export async function listNotifications({ accountId = null, view = 'needs-you' } = {}) {
- const accounts = await listAccounts();
+ const accounts = (await listAccounts()).filter(isActive);
const accountsById = new Map(accounts.map((account) => [account.id, account]));
- const ids = accountId ? [accountId] : accounts.map((account) => account.id);
+ const ids = accounts.filter((account) => !accountId || account.id === accountId).map((account) => account.id);
const [rows, syncRows, countRows] = await Promise.all([
query(
`SELECT * FROM github_notifications WHERE account_id = ANY($1::text[]) AND ${VIEW_FILTERS[view]}