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: development watchdog names why an app is source-unavailable (#12980) (#13028)

[._.]/b3d9b6d7315e
diff --git a/server/services/developmentWatchdog.js b/server/services/developmentWatchdog.js
index 54a3da6ca2..5587c1b041 100644
--- a/server/services/developmentWatchdog.js
+++ b/server/services/developmentWatchdog.js
@@ -334,7 +334,12 @@ async function scan({ dryRun = false, force = false, source = 'scheduled' } = {}
if (!app || !mayReadApp(state, id)) { receipt.apps.push({ appId: id, complete: false, blockers: ['app-unavailable-or-not-granted'], pullRequests: [], issues: [] }); continue; }
let row;
try { row = await inspectApp(app, allTasks, localReviewTasks, activeAgentTaskIds); }
- catch { row = { appId: id, complete: false, blockers: ['source-unavailable'], pullRequests: [], issues: [] }; }
+ catch (err) {
+ const { redactCliDetail } = await import('./perpetualWork.js');
+ const detail = redactCliDetail(String(err?.message || '').split('\n')[0]);
+ console.error(`❌ Development watchdog could not inspect app ${id}: ${detail ?? 'no error message'}`);
+ row = { appId: id, complete: false, blockers: ['source-unavailable'], detail, pullRequests: [], issues: [] };
+ }
if (row.complete && !dryRun && !peers.blockers.length && mayCreateTasksForApp(state, id)) {
await retireTerminalReviewFollowUps(app, row).catch(err => {
console.error(`❌ Development watchdog could not retire a completed PR follow-up: ${err.message}`);
diff --git a/server/services/developmentWatchdog.test.js b/server/services/developmentWatchdog.test.js
index 5475df5d38..1b090cb20f 100644
--- a/server/services/developmentWatchdog.test.js
+++ b/server/services/developmentWatchdog.test.js
@@ -28,7 +28,7 @@ vi.mock('./taskSchedule.js', () => ({
recordExecution: (...args) => m.execution(...args),
}));
vi.mock('./github.js', () => ({ execGh: async args => {
- if (args[0] === 'api') return m.account;
+ if (args[0] === 'api') { if (m.accountFailure) throw new Error(m.accountFailure); return m.account; }
if (args[0] === m.execGhFailureOn) throw new Error('forge unavailable');
if (args[0] === m.invalidGhJsonOn) return 'not json';
return JSON.stringify({ body: '', state: m.dependencyOpen ? 'OPEN' : 'CLOSED', labels: m.dependencyOpen ? [{ name: 'in-progress' }] : [] });
@@ -49,7 +49,7 @@ import { readPersistentMindMaintenanceContext } from './persistentMindMaintenanc
beforeEach(() => {
m.state = { config: { improvementEnabled: true, persistentMindMaintainer: { enabled: true, appIds: ['app'] }, persistentMindCapabilities: { readPortos: true, createTasks: true }, maxConcurrentAgents: 3 }, agents: {} };
- m.tasks = []; m.prs = []; m.backlog = []; m.peers = []; m.adds = []; m.updates = []; m.branch = ''; m.account = 'atomantic'; m.fullName = 'atomantic/example'; m.execOptions = []; m.save.mockClear(); m.nextPrs = null; m.prReads = 0; m.prStates = {}; m.dependencies = []; m.dependencyOpen = false; m.execGhFailureOn = null; m.invalidGhJsonOn = null; m.issueTruncated = false;
+ m.tasks = []; m.prs = []; m.backlog = []; m.peers = []; m.adds = []; m.updates = []; m.branch = ''; m.account = 'atomantic'; m.fullName = 'atomantic/example'; m.execOptions = []; m.save.mockClear(); m.nextPrs = null; m.prReads = 0; m.prStates = {}; m.dependencies = []; m.dependencyOpen = false; m.execGhFailureOn = null; m.accountFailure = null; m.invalidGhJsonOn = null; m.issueTruncated = false;
m.readiness = { shouldRun: true }; m.requests = []; m.duplicate = false;
m.metadata.mockReset().mockResolvedValue({ metadata: {} });
m.prepare.mockReset().mockResolvedValue({
@@ -93,6 +93,15 @@ describe('development watchdog scan to dispatch', () => {
m.tasks = [{ id: 'held', status: 'blocked', metadata: { app: 'app', reviewLoopPRUrl: m.prs[0].url, blockedCategory: 'max-spawns' } }];
receipt = await runDevelopmentWatchdog({ force: true }); expect(receipt.apps[0].pullRequests[0].disposition).toBe('blocked'); expect(m.adds).toEqual([]);
});
+ it('an uninspectable app is logged and its receipt row carries a redacted detail', async () => {
+ m.accountFailure = 'HTTP 401 bad credentials ghp_abcdefghijklmnopqrstuvwxyz0123456789\nsecond line';
+ const spy = vi.spyOn(console, 'error').mockImplementation(() => {});
+ const receipt = await runDevelopmentWatchdog({ force: true });
+ const row = receipt.apps[0]; const logged = spy.mock.calls.map(c => c[0]).join('\n'); spy.mockRestore();
+ expect(row).toMatchObject({ complete: false, blockers: ['source-unavailable'] });
+ expect(row.detail).toContain('HTTP 401'); expect(row.detail).not.toContain('ghp_abcdef'); expect(row.detail).not.toContain('second line');
+ expect(logged).toContain('could not inspect app app: HTTP 401'); expect(logged).not.toContain('ghp_abcdef');
+ });
it('unknown participating peer and wrong account defer work', async () => {
m.backlog = [{ ref: '42' }]; m.peers = [{ id: 'peer', fullSync: true }];
let receipt = await runDevelopmentWatchdog({ force: true }); expect(receipt.complete).toBe(false); expect(m.adds).toEqual([]);
diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.js
index b58382946e..ddb2bcb0b1 100644
--- a/server/services/perpetualWork.js
+++ b/server/services/perpetualWork.js
@@ -91,7 +91,7 @@ const CLI_DETAIL_MAX_CHARS = 200;
* callers can tell "no detail available" apart from a detail that redacted to
* an empty string.
*/
-function redactCliDetail(stderr) {
+export function redactCliDetail(stderr) {
const lines = String(stderr || '').split('\n').map((l) => l.trim()).filter(Boolean);
if (lines.length === 0) return null;
const detail = redactPii(scrubSecretTokens(lines[lines.length - 1]));