Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(ide): leave the repository picker as soon as a pick is saved

rubenluetke10-beep54f9ac353aca
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitHubRepoPicker.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitHubRepoPicker.tsx
index 9b6f6f6316..f68edc6652 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitHubRepoPicker.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitHubRepoPicker.tsx
@@ -41,7 +41,8 @@ export function GitHubRepoPicker({
/** The repository picked before, when the picker is reopened to change it. */
current: string;
suggested: string;
- onPicked: () => void;
+ /** The choice is saved; called with the picked `owner/name`. */
+ onPicked: (repo: string) => void;
/** Present when there is already a choice to go back to. */
onCancel?: () => void;
}) {
@@ -81,7 +82,7 @@ export function GitHubRepoPicker({
setError("");
try {
await bindGitHubRepo(workspaceId, name);
- onPicked();
+ onPicked(name);
} catch (err) {
setError((err as Error).message);
} finally {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx
index f83ae0ccde..736068ba2c 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.test.tsx
@@ -88,6 +88,8 @@ const OVERVIEW: RepoOverview = {
let answer: unknown = OVERVIEW;
let status = 200;
+/** Holds overview answers back, like a slow GitHub read. */
+let gate: Promise<void> | null = null;
const calls: string[] = [];
const puts: string[] = [];
const REPOS = {
@@ -104,6 +106,7 @@ const REPOS = {
beforeEach(() => {
answer = OVERVIEW;
status = 200;
+ gate = null;
calls.length = 0;
puts.length = 0;
vi.stubGlobal(
@@ -119,6 +122,7 @@ beforeEach(() => {
answer = OVERVIEW;
return json({ ok: true, repo: "o/r" });
}
+ if (gate) await gate;
return json(answer, status);
}),
);
@@ -226,6 +230,25 @@ describe("GitOverviewTab", () => {
expect(screen.queryByTestId("git-repo-picker")).toBeNull();
});
+ it("leaves the picker at once after a pick, while GitHub is still being read", async () => {
+ answer = { ...OVERVIEW, github: { ...OVERVIEW.github, available: false, code: "needs_repo", repo: "", repo_url: "" } };
+ render(<GitOverviewTab />);
+ await vi.waitFor(() => expect(screen.getAllByTestId("git-repo-choice")).toHaveLength(2));
+ let release: () => void = () => {};
+ gate = new Promise<void>((resolve) => {
+ release = resolve;
+ });
+ fireEvent.click(screen.getAllByTestId("git-repo-choice")[0]);
+ // The local branches and the choice show before GitHub has answered.
+ expect(await screen.findAllByTestId("git-branch-row")).toHaveLength(6);
+ expect(screen.queryByTestId("git-repo-picker")).toBeNull();
+ const state = screen.getByTestId("git-github-state");
+ expect(state.textContent).toContain("o/r");
+ expect(state.textContent).toContain("Reading pull requests and CI from GitHub");
+ release();
+ await vi.waitFor(() => expect(screen.getByTestId("git-github-state").textContent).toContain("GitHub status from"));
+ });
+
it("reopens the pick from the repository name to change it", async () => {
render(<GitOverviewTab />);
fireEvent.click(await screen.findByTestId("git-bound-repo"));
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx
index 0feed73676..83cd864d01 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/git/GitOverviewTab.tsx
@@ -411,13 +411,22 @@ export function GitOverviewTab() {
const [showLegend, setShowLegend] = useState(false);
// Reopened from the repository chip to change an earlier choice.
const [changing, setChanging] = useState(false);
+ // The repository just picked. The pick is saved at once, but the GitHub
+ // read it starts takes seconds (up to the request timeout); until that
+ // answer lands the tab shows the choice and the local branches, never the
+ // picker again — a picker that stays put reads as "the click did nothing".
+ const [pickedRepo, setPickedRepo] = useState("");
useEffect(() => setChanging(false), [workspaceId]);
+ useEffect(() => setPickedRepo(""), [data, workspaceId]);
if (!workspace) {
return <p className="px-4 py-6 text-center text-xs text-muted-foreground">{t("ide_side_panel.git.no_workspace")}</p>;
}
const github = data?.github;
- const picking = Boolean(data && workspaceId && (github?.code === "needs_repo" || (changing && github?.code !== "not_connected")));
+ const picking = Boolean(
+ data && workspaceId && !pickedRepo && (github?.code === "needs_repo" || (changing && github?.code !== "not_connected")),
+ );
+ const boundRepo = pickedRepo || github?.repo || "";
const repoName = (data?.root || workspace.path).replace(/\\/g, "/").split("/").filter(Boolean).pop() ?? workspace.name;
return (
@@ -468,7 +477,7 @@ export function GitOverviewTab() {
</QuickTooltip>
</span>
</div>
- {github?.repo && (
+ {boundRepo && (
<p data-testid="git-github-state" className="flex min-w-0 items-center gap-1.5 text-[10.5px] text-muted-foreground">
<QuickTooltip content={t("ide_side_panel.git.change_repo")} side="bottom" className="inline-flex min-w-0">
<button
@@ -477,14 +486,16 @@ export function GitOverviewTab() {
onClick={() => setChanging(true)}
className="inline-flex min-w-0 items-center gap-1 rounded px-0.5 font-mono text-foreground/80 hover:bg-secondary hover:text-foreground"
>
- <span className="truncate">{github.repo}</span>
+ <span className="truncate">{boundRepo}</span>
</button>
</QuickTooltip>
<span aria-hidden>·</span>
<span className="min-w-0 truncate">
- {github.available
- ? fill(t("ide_side_panel.git.github_updated"), { when: sinceLabel(t, github.fetched_at) })
- : github.reason}
+ {pickedRepo
+ ? t("ide_side_panel.git.github_reading")
+ : github?.available
+ ? fill(t("ide_side_panel.git.github_updated"), { when: sinceLabel(t, github.fetched_at) })
+ : github?.reason}
</span>
</p>
)}
@@ -500,7 +511,8 @@ export function GitOverviewTab() {
workspaceId={workspaceId}
current={github?.repo ?? ""}
suggested={github?.suggested_repo ?? ""}
- onPicked={() => {
+ onPicked={(repo) => {
+ setPickedRepo(repo);
setChanging(false);
refresh();
}}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 0ffefe451e..96f2e94b30 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -5880,6 +5880,7 @@
"ci_stale": "Diese Prüfungen liefen auf {commit}; neuere lokale Commits sind noch nicht gepusht.",
"click_ci": "Klicken, um den CI-Lauf zu öffnen.",
"github_updated": "GitHub-Stand von {when}",
+ "github_reading": "Pull Requests und CI werden von GitHub gelesen…",
"github_off": "Kein GitHub-Status: {reason}",
"seconds_ago": "vor {n} s",
"minutes_ago": "vor {n} min"
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 9f9583e347..c9710e9d19 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -5913,6 +5913,7 @@
"ci_stale": "These checks ran on {commit}; newer local commits are not pushed yet.",
"click_ci": "Click to open the CI run.",
"github_updated": "GitHub status from {when}",
+ "github_reading": "Reading pull requests and CI from GitHub…",
"github_off": "No GitHub status: {reason}",
"seconds_ago": "{n} s ago",
"minutes_ago": "{n} min ago"
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 2b43b5179e..c6447aaca1 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -5880,6 +5880,7 @@
"ci_stale": "Estas comprobaciones se ejecutaron en {commit}; hay commits locales más nuevos sin subir.",
"click_ci": "Haz clic para abrir la ejecución de CI.",
"github_updated": "Estado de GitHub de {when}",
+ "github_reading": "Leyendo pull requests y CI de GitHub…",
"github_off": "Sin estado de GitHub: {reason}",
"seconds_ago": "hace {n} s",
"minutes_ago": "hace {n} min"