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 Reconcile button to Git tab Local Branches to queue a branch-reconcile task

Adam Eivyd10961db6b77
diff --git a/client/src/components/apps/tabs/GitTab.jsx b/client/src/components/apps/tabs/GitTab.jsx
index bfe55b4b9c..c3c54c7823 100644
--- a/client/src/components/apps/tabs/GitTab.jsx
+++ b/client/src/components/apps/tabs/GitTab.jsx
@@ -150,6 +150,7 @@ export default function GitTab({ appId, appName, repoPath }) {
const [syncing, setSyncing] = useState(null);
const [pushingAll, setPushingAll] = useState(false);
const [openingPullRequest, setOpeningPullRequest] = useState(false);
+ const [reconciling, setReconciling] = useState(false);
const [remoteBranches, setRemoteBranches] = useState([]);
const [_defaultBranch, setDefaultBranch] = useState('main');
const [loadingRemote, setLoadingRemote] = useState(false);
@@ -363,6 +364,20 @@ export default function GitTab({ appId, appName, repoPath }) {
}
};
+ const handleReconcileBranches = async () => {
+ if (!appId || reconciling) return;
+ setReconciling(true);
+ const result = await api.triggerCosOnDemandTask('branch-reconcile', appId, { silent: true }).catch((err) => {
+ toast.error(`Could not queue branch reconcile: ${err.message}`);
+ return null;
+ });
+ setReconciling(false);
+ if (result) {
+ toast.success(`Branch reconcile queued for ${appName} — check CoS Agents`);
+ await api.forceCosEvaluate().catch(() => null);
+ }
+ };
+
const handleDeleteBranch = async (branchName, { local, remote }) => {
if (!repoPath || deleting) return;
setDeleting(branchName);
@@ -767,6 +782,17 @@ export default function GitTab({ appId, appName, repoPath }) {
<div className="flex flex-wrap items-center justify-between gap-2 mb-3">
<h3 className="text-sm font-medium text-gray-400">Local Branches</h3>
<div className="flex flex-wrap items-center gap-2">
+ {appId && (
+ <button
+ onClick={handleReconcileBranches}
+ disabled={reconciling}
+ title="Queue a branch-reconcile agent to merge, push, or retire this app's leftover branches"
+ className={`flex items-center gap-1 text-xs ${touchBtnCls} text-port-accent hover:text-white disabled:opacity-50`}
+ >
+ <GitMerge size={12} />
+ {reconciling ? 'Queuing...' : 'Reconcile'}
+ </button>
+ )}
{localMergedCount > 0 && !cleanupConfirm && (
<button
onClick={() => setCleanupConfirm('local')}
diff --git a/client/src/components/apps/tabs/GitTab.test.jsx b/client/src/components/apps/tabs/GitTab.test.jsx
index ebd1f4222c..5988236ea0 100644
--- a/client/src/components/apps/tabs/GitTab.test.jsx
+++ b/client/src/components/apps/tabs/GitTab.test.jsx
@@ -19,6 +19,7 @@ vi.mock('../../../services/api', () => ({
resetToDefaultBranch: vi.fn(),
createSlashdoTask: vi.fn(),
forceCosEvaluate: vi.fn(),
+ triggerCosOnDemandTask: vi.fn(),
}));
vi.mock('./RepositorySourcePanel', () => ({
default: ({ appId, refreshKey }) => (
@@ -55,6 +56,7 @@ beforeEach(() => {
api.resetToDefaultBranch.mockResolvedValue({ success: true, branch: 'main', previousBranch: 'main', previousHead: 'b'.repeat(40), head: 'a'.repeat(40), discardedFiles: 1, fetched: true });
api.createSlashdoTask.mockResolvedValue({ id: 'task-pr-1' });
api.forceCosEvaluate.mockResolvedValue({ success: true });
+ api.triggerCosOnDemandTask.mockResolvedValue({ success: true });
});
afterEach(() => {
@@ -81,6 +83,18 @@ describe('GitTab managed repository sources', () => {
));
});
+ it('queues a branch-reconcile task for the app from Local Branches', async () => {
+ render(<GitTab appId="app-example" appName="Example App" repoPath="/srv/example-app" />);
+
+ fireEvent.click(await screen.findByRole('button', { name: 'Reconcile' }));
+
+ await waitFor(() => expect(api.triggerCosOnDemandTask).toHaveBeenCalledWith(
+ 'branch-reconcile',
+ 'app-example',
+ { silent: true },
+ ));
+ });
+
it('shows repository topology for every managed app', async () => {
const { rerender } = render(
<GitTab