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

feat: add a Disabled mode for GitHub accounts so an instance can skip their notifications (#13176)

[._.]/6439753c6667
diff --git a/client/src/components/github/GitHubAccountsTab.jsx b/client/src/components/github/GitHubAccountsTab.jsx
index 44337339ec..ad9bb7f41c 100644
--- a/client/src/components/github/GitHubAccountsTab.jsx
+++ b/client/src/components/github/GitHubAccountsTab.jsx
@@ -23,7 +23,7 @@ const TRUST_OPTIONS = [
{ value: 'public', label: 'Public', hint: 'Anyone can mention you; outside content is always screened' },
{ value: 'private', label: 'Private', hint: 'Enterprise: org members trusted; content stays on allowed AI providers' },
];
-const MODE_LABELS = { observe: 'Observe', assist: 'Assist', autopilot: 'Autopilot' };
+const MODE_LABELS = { disabled: 'Disabled', observe: 'Observe', assist: 'Assist', autopilot: 'Autopilot' };
const STATUS_VIEW = {
ok: { tone: 'success', label: 'Signed in' },
'wrong-account': { tone: 'warning', label: 'Other login active' },
diff --git a/client/src/components/github/GitHubAgentRules.jsx b/client/src/components/github/GitHubAgentRules.jsx
index c104158a4c..a1abeaad75 100644
--- a/client/src/components/github/GitHubAgentRules.jsx
+++ b/client/src/components/github/GitHubAgentRules.jsx
@@ -134,7 +134,7 @@ export default function GitHubAgentRules({ account, onSave, saving }) {
)}
</div>
{account.mode !== 'autopilot' && rules.length > 0 && (
- <p className="text-xs text-port-warning">Autopilot follows these rules. This account is in {account.mode === 'assist' ? 'Assist' : 'Observe'}, so nothing starts on its own yet.</p>
+ <p className="text-xs text-port-warning">Autopilot follows these rules. This account is in {{ assist: 'Assist', disabled: 'Disabled' }[account.mode] || 'Observe'}, so nothing starts on its own yet.</p>
)}
{rules.length === 0 && !editing && (
<p className="text-xs text-gray-500">No rules: security alerts and outside issues and pull requests in your apps go to their usual agents, and other review requests wait for you.</p>
diff --git a/client/src/components/github/GitHubAutomationsTab.jsx b/client/src/components/github/GitHubAutomationsTab.jsx
index 8626a05b5e..6fb6ef0720 100644
--- a/client/src/components/github/GitHubAutomationsTab.jsx
+++ b/client/src/components/github/GitHubAutomationsTab.jsx
@@ -19,10 +19,11 @@ import {
import { ACTION_LABELS, LEARNED_DECISION_LABELS } from './githubTriageLabels';
import GitHubAgentRules from './GitHubAgentRules';
-const MODE_OPTIONS = ['observe', 'assist', 'autopilot'];
-const MODE_LABELS = { observe: 'Observe', assist: 'Assist', autopilot: 'Autopilot' };
+const MODE_OPTIONS = ['disabled', 'observe', 'assist', 'autopilot'];
+const MODE_LABELS = { disabled: 'Disabled', observe: 'Observe', assist: 'Assist', autopilot: 'Autopilot' };
function modeHint(account) {
+ if (account.mode === 'disabled') return 'This PortOS instance does not fetch or process this account\'s notifications.';
if (account.mode === 'observe') return 'Records a decision for each notification; changes nothing on GitHub.';
const where = account.trust === 'private'
? 'Text goes only to local AI providers unless you allow others in Accounts.'
diff --git a/server/lib/validation.js b/server/lib/validation.js
index 7512b04abc..6b87fa8c7a 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -950,7 +950,7 @@ export const GITHUB_ACCOUNT_HOST_RE = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z
// github.com logins are [A-Za-z0-9-]; Enterprise Managed Users add `_shortcode`.
export const GITHUB_ACCOUNT_LOGIN_RE = /^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/;
export const GITHUB_ACCOUNT_TRUST_LEVELS = Object.freeze(['public', 'private']);
-export const GITHUB_ACCOUNT_MODES = Object.freeze(['observe', 'assist', 'autopilot']);
+export const GITHUB_ACCOUNT_MODES = Object.freeze(['disabled', 'observe', 'assist', 'autopilot']);
// Per-repo agent rules for the GitHub inbox: which kind of notification starts
// a CoS agent, in one repo (`owner/repo`) or every repo (`*`), and on which
diff --git a/server/services/githubNotificationAudit.js b/server/services/githubNotificationAudit.js
index 5ad17cfd59..cf857aa3d9 100644
--- a/server/services/githubNotificationAudit.js
+++ b/server/services/githubNotificationAudit.js
@@ -184,7 +184,7 @@ export async function undoAuditChange(id) {
* takes a tap on the Audit tab. A report with no suggestions sends nothing.
*/
export async function sendDueAuditReports({ now = Date.now() } = {}) {
- const accounts = (await listAccounts()).filter((account) => account.enabled && account.auditReport === true);
+ const accounts = (await listAccounts()).filter((account) => account.enabled && account.mode !== 'disabled' && account.auditReport === true);
if (!accounts.length) return [];
const { rows } = await query(
'SELECT account_id, last_sent_at FROM github_notification_audit_reports WHERE account_id = ANY($1::text[])',
diff --git a/server/services/githubNotifications.db.test.js b/server/services/githubNotifications.db.test.js
index c8244ccdf3..2d33c69a75 100644
--- a/server/services/githubNotifications.db.test.js
+++ b/server/services/githubNotifications.db.test.js
@@ -45,7 +45,7 @@ const { addTask } = await import('./cosTaskStore.js');
const { runUntrustedContentAnalysis } = await import('./untrustedContent.js');
const { createAccount, updateAccount } = await import('./githubAccounts.js');
const {
- syncAccountNotifications, listNotifications, applyNotificationAction, getNotification, runScheduledNotificationCheck, describeScheduledCheck,
+ syncAccountNotifications, syncAllNotifications, listNotifications, applyNotificationAction, getNotification, runScheduledNotificationCheck, describeScheduledCheck,
listAutomationActivity, undoAutomationAction, listLearnedRules, resolveWithAgent, getAutomationsOverview, setNotificationCadence,
} = await import('./githubNotifications.js');
const { runAccountAudit, applyAuditSuggestion, listAuditChanges, undoAuditChange, sendDueAuditReports } = await import('./githubNotificationAudit.js');
@@ -767,4 +767,15 @@ describe.skipIf(!runDb)('GitHub notifications inbox against Postgres', () => {
expect(fetchSpy).not.toHaveBeenCalled();
fetchSpy.mockRestore();
});
+
+ it('never fetches or processes a disabled account, scheduled or manual', async () => {
+ mockGh(() => listing([thread('811')]));
+ await updateAccount(account.id, { mode: 'disabled' });
+ expect(await syncAccountNotifications(account.id)).toMatchObject({ skipped: 'disabled' });
+ const scheduled = await runScheduledNotificationCheck();
+ expect(scheduled.find((result) => result.accountId === account.id)).toBeUndefined();
+ expect((await syncAllNotifications()).find((result) => result.accountId === account.id)).toBeUndefined();
+ const { rows } = await query('SELECT 1 FROM github_notifications WHERE account_id = $1 AND thread_id = $2', [account.id, '811']);
+ expect(rows).toHaveLength(0);
+ });
});
diff --git a/server/services/githubNotifications.js b/server/services/githubNotifications.js
index f0fa064ac3..4abe986ea2 100644
--- a/server/services/githubNotifications.js
+++ b/server/services/githubNotifications.js
@@ -253,8 +253,12 @@ async function syncAccountNow(account, automate) {
* Fetch one account's GitHub inbox (read and unread), coalescing concurrent requests.
* `automate: false` (a caller without host control) skips Assist/Autopilot.
*/
+// A 'disabled' account stays configured but this instance never fetches or processes its notifications.
+const isActive = (account) => account.enabled && account.mode !== 'disabled';
+
export async function syncAccountNotifications(accountId, { automate = true } = {}) {
const account = await getAccount(accountId);
+ if (account.mode === 'disabled') return { accountId: account.id, changed: false, skipped: 'disabled' };
return syncFlightFor(account.id).run(automate, () => syncAccountNow(account, automate).catch(async (error) => {
await recordSyncError(account.id, error.message).catch(() => {});
throw error;
@@ -263,7 +267,7 @@ export async function syncAccountNotifications(accountId, { automate = true } =
/** Sync every enabled account; one account's failure never hides another's result. */
export async function syncAllNotifications(options = {}) {
- const accounts = (await listAccounts()).filter((account) => account.enabled);
+ const accounts = (await listAccounts()).filter(isActive);
const results = [];
for (const account of accounts) {
results.push(await syncAccountNotifications(account.id, options)
@@ -501,7 +505,7 @@ let lastScheduledSummary = null;
* only; an Assist account also sorts and acts (githubNotificationAssist.js).
*/
export async function runScheduledNotificationCheck({ now = Date.now() } = {}) {
- const accounts = (await listAccounts()).filter((account) => account.enabled);
+ const accounts = (await listAccounts()).filter(isActive);
const cursors = new Map((await query(
'SELECT account_id, last_sync_at, poll_interval_seconds FROM github_notification_sync WHERE account_id = ANY($1::text[])',
[accounts.map((account) => account.id)],