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 (codex): preserve per-app model when resolving to a schedule pin

Adam Eivy876996a0bb66
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.js b/server/services/autonomousJobs/layeredIntelligenceHooks.js
index 5d5851b836..93a225af0a 100644
--- a/server/services/autonomousJobs/layeredIntelligenceHooks.js
+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.js
@@ -178,7 +178,11 @@ async function resolveLiAgentProvider(app, config) {
type = await providerTypeOf(pinId)
if (type && type !== 'api') {
providerId = pinId
- model = pin?.model ?? null
+ // Keep an explicit per-app model if the user set one (provider absent but
+ // model present); only fall back to the pin's model when there's no per-app
+ // model. This matches the pre-refactor net spawn behavior, where the hook's
+ // returned model (the per-app model) overrode the generator's interval.model.
+ model = config.model ?? pin?.model ?? null
}
}
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
index 9c9f08a229..fbc6dbdd85 100644
--- a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
@@ -171,6 +171,32 @@ describe('buildTaskInput', () => {
expect(li.gatherSources).not.toHaveBeenCalled();
});
+ it('keeps an explicit per-app model when the provider is absent but a non-api schedule pin resolves', async () => {
+ // No per-app PROVIDER, but a per-app MODEL is set, and the global schedule pins
+ // a real CLI provider. The resolved provider is the pin; the model must stay the
+ // per-app model (matching the pre-refactor net spawn behavior), not the pin's.
+ li.getEffectiveConfig.mockReturnValue({ providerId: null, model: 'my-model', allowedScopes: ['app-improvement'], sources: {} });
+ getTaskInterval.mockResolvedValue({ providerId: 'claude-cli', model: 'pin-model' });
+ getProviderById.mockImplementation(async (id) => ({ id, type: 'cli' }));
+ const res = await buildTaskInput({ app: APP });
+ expect(res.skip).toBeUndefined();
+ expect(res.providerId).toBe('claude-cli');
+ expect(res.model).toBe('my-model');
+ });
+
+ it('adopts the schedule pin provider + model when neither a per-app provider nor model is set', async () => {
+ // No per-app provider AND no per-app model → the resolved provider/model are
+ // both the pin's, so the hook fully owns the resolution (not delegated to the
+ // generator's interval.providerId/model).
+ li.getEffectiveConfig.mockReturnValue({ providerId: null, model: null, allowedScopes: ['app-improvement'], sources: {} });
+ getTaskInterval.mockResolvedValue({ providerId: 'claude-cli', model: 'pin-model' });
+ getProviderById.mockImplementation(async (id) => ({ id, type: 'cli' }));
+ const res = await buildTaskInput({ app: APP });
+ expect(res.skip).toBeUndefined();
+ expect(res.providerId).toBe('claude-cli');
+ expect(res.model).toBe('pin-model');
+ });
+
it('skips a jira-tracked app with no usable jira config', async () => {
resolveAppWorkTracker.mockResolvedValue({ resolved: 'jira', forge: null });
const res = await buildTaskInput({ app: { ...APP, jira: { enabled: false } } });