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

address review (claude): require a positively-resolved pin type before healing

[._.]/ Adam Eivy9a6a58f19e8a
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.js b/server/services/autonomousJobs/layeredIntelligenceHooks.js
index f18f75495e..abf77e526a 100644
--- a/server/services/autonomousJobs/layeredIntelligenceHooks.js
+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.js
@@ -222,7 +222,11 @@ export async function buildTaskInput({ app } = {}) {
const pinTask = await readPinTask()
const pinId = pinTask?.providerId || null
const pinType = await providerTypeOf(pinId)
- if (pinId && pinType !== 'api') {
+ // Adopt the pin only when it RESOLVES to a real non-api provider. `pinType`
+ // is null for an unresolvable id (deleted/renamed/typo'd pin) — treating that
+ // as "not api" and adopting it would re-wedge the task on a doomed provider
+ // with a misleading "healed" warning, so require a positively-known type.
+ if (pinId && pinType && pinType !== 'api') {
console.warn(`⚠️ Layered Intelligence: ${app.name} per-app provider '${config.providerId}' is API-only (no coding harness) — using the schedule provider '${pinId}' instead`)
// Persist the healed provider/model onto config so the returned prompt input
// (and the spawn's hookOverride) pins the AGENT to the pin, not the stale api
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
index dcf9da53d7..9c9f08a229 100644
--- a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
@@ -150,6 +150,18 @@ describe('buildTaskInput', () => {
expect(res.model).toBe('qwen3:35b');
});
+ it('skips (does not adopt) when the schedule pin references an unresolvable provider id', async () => {
+ // Stale api per-app override + a schedule pin pointing at a provider that no
+ // longer resolves (deleted/renamed). providerTypeOf(pin) → null; adopting it
+ // would re-wedge on a doomed id, so the heal must fall through to the skip.
+ li.getEffectiveConfig.mockReturnValue({ providerId: 'ollama', model: 'qwen', allowedScopes: ['app-improvement'], sources: {} });
+ getTaskInterval.mockResolvedValue({ providerId: 'ghost-provider', model: null });
+ getProviderById.mockImplementation(async (id) => (id === 'ghost-provider' ? null : { id, type: 'api' }));
+ const res = await buildTaskInput({ app: APP });
+ expect(res).toEqual({ skip: { reason: 'provider-not-agent-capable' } });
+ expect(li.gatherSources).not.toHaveBeenCalled();
+ });
+
it('still skips when the per-app AND the schedule pin are both api-only (no CLI/TUI anywhere)', async () => {
li.getEffectiveConfig.mockReturnValue({ providerId: 'ollama', model: 'qwen', allowedScopes: ['app-improvement'], sources: {} });
getTaskInterval.mockResolvedValue({ providerId: 'lmstudio', model: null });