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: preserve automation model pins while provider choices load

[._.]/ Adam Eivye462d3ecd34d
diff --git a/client/src/components/github/GitHubAgentRules.jsx b/client/src/components/github/GitHubAgentRules.jsx
index b6dfad99c6..b37b933745 100644
--- a/client/src/components/github/GitHubAgentRules.jsx
+++ b/client/src/components/github/GitHubAgentRules.jsx
@@ -66,7 +66,7 @@ function RuleForm({ rule, repos, rules, account, takenKeys, onCancel, onSubmit,
const canApplyNow = matches > 0 && actsNow(account.mode, action);
const submit = (event) => {
event.preventDefault();
- if (!repoValid || clash) return;
+ if (!repoValid || clash || saving || (action === 'agent' && picker.loading)) return;
const agent = action === 'agent';
onSubmit({
id: rule?.id || newRuleId(),
@@ -131,7 +131,7 @@ function RuleForm({ rule, repos, rules, account, takenKeys, onCancel, onSubmit,
)}
{clash && <p role="alert" className="text-xs text-port-error">There is already a rule for this kind of notification in {repoLabel(repo)}.</p>}
<div className="flex flex-wrap gap-2">
- <button type="submit" disabled={saving || !repoValid || clash} className="rounded bg-port-accent px-3 py-1.5 text-xs text-white disabled:opacity-50">
+ <button type="submit" disabled={saving || !repoValid || clash || (action === 'agent' && picker.loading)} className="rounded bg-port-accent px-3 py-1.5 text-xs text-white disabled:opacity-50">
{saving ? 'Saving…' : 'Save rule'}
</button>
<button type="button" onClick={onCancel} className="rounded border border-port-border px-3 py-1.5 text-xs text-gray-300">Cancel</button>
diff --git a/client/src/pages/GitHub.test.jsx b/client/src/pages/GitHub.test.jsx
index 981549060c..b0f402efc4 100644
--- a/client/src/pages/GitHub.test.jsx
+++ b/client/src/pages/GitHub.test.jsx
@@ -858,6 +858,40 @@ describe('GitHub automations tab', () => {
}));
expect(await screen.findByText('octocat/hello', { selector: 'span' })).toBeTruthy();
});
+
+ it('preserves a saved agent rule pin while its provider catalog is loading', async () => {
+ let resolveProviders;
+ mock.getProviders.mockReturnValue(new Promise((resolve) => { resolveProviders = resolve; }));
+ const rule = { id: 'rule-pinned', kind: 'review-request', repo: '*', action: 'agent', provider: 'example-provider', model: 'example-model', effort: 'high' };
+ mock.getGitHubAutomations.mockResolvedValue({ ...OVERVIEW, accounts: [{ ...OVERVIEW.accounts[0], agentRules: [rule], repos: [] }] });
+ mock.updateGitHubAccount.mockImplementation(async (id, data) => ({ id, ...data }));
+ renderTab('automations');
+ const edit = await screen.findByRole('button', { name: 'Edit Review requests rule for All repos' });
+ await act(async () => fireEvent.click(edit));
+ const form = screen.getByRole('form', { name: 'Edit automation rule' });
+ expect(screen.getByRole('button', { name: 'Save rule' })).toBeDisabled();
+ fireEvent.submit(form);
+ expect(mock.updateGitHubAccount).not.toHaveBeenCalled();
+
+ await act(async () => resolveProviders({ providers: [{ id: 'example-provider', name: 'Example Provider', type: 'cli', enabled: true, models: ['example-model'], defaultModel: 'example-model' }] }));
+ await waitFor(() => expect(screen.getByLabelText(/^Provider/)).toHaveValue('example-provider'));
+ fireEvent.click(screen.getByRole('button', { name: 'Save rule' }));
+ await waitFor(() => expect(mock.updateGitHubAccount).toHaveBeenCalledWith('github-com', { agentRules: [rule] }));
+ });
+
+ it('allows non-agent rule edits while the provider catalog is loading', async () => {
+ mock.getProviders.mockReturnValue(new Promise(() => {}));
+ const rule = { id: 'rule-done', kind: 'ci-activity', repo: '*', action: 'done' };
+ mock.getGitHubAutomations.mockResolvedValue({ ...OVERVIEW, accounts: [{ ...OVERVIEW.accounts[0], agentRules: [rule], repos: [] }] });
+ mock.updateGitHubAccount.mockImplementation(async (id, data) => ({ id, ...data }));
+ renderTab('automations');
+ fireEvent.click(await screen.findByRole('button', { name: 'Edit CI activity rule for All repos' }));
+ fireEvent.change(screen.getByLabelText('Then'), { target: { value: 'leave' } });
+ const save = screen.getByRole('button', { name: 'Save rule' });
+ expect(save).toBeEnabled();
+ fireEvent.click(save);
+ await waitFor(() => expect(mock.updateGitHubAccount).toHaveBeenCalledWith('github-com', { agentRules: [{ ...rule, action: 'leave' }] }));
+ });
});
describe('GitHub audit tab', () => {