Skip to content

Commit abc8535

Browse files
committed
fix(ui): reload projects after startup identity resolves
1 parent f3607b1 commit abc8535

4 files changed

Lines changed: 27 additions & 2 deletions

File tree

‎docs/web/control-ui.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ The **+** in the sidebar's **Sessions** toolbar opens a full-page draft at `/new
307307

308308
The folder defaults to the agent workspace. Write-scoped connections can browse, restore recent Gateway folders, and start sessions anywhere inside a configured agent workspace; another absolute Gateway path requires `operator.admin` but can run directly without being a Git checkout. Local placement keeps the optional **Worktree** control with a base-branch picker backed by `worktrees.branches` (no fetch) and an optional worktree name (the branch becomes `openclaw/<name>`). Choosing either a device or cloud profile forces a managed worktree from the selected Gateway source. **Start in terminal** is available only for local placement.
309309

310-
Gateway reconnects and Git verification retries preserve your edited base branch and worktree name. Choosing another folder or project clears those repository-specific details.
310+
The project picker refreshes after sign-in and reconnects. Gateway reconnects and Git verification retries preserve your edited base branch and worktree name. Choosing another folder or project clears those repository-specific details.
311311

312312
For local worktree sessions, sending the first message opens the admitted session before naming, checkout, and setup finish. The chat shows the submitted message and preparation stages. A generated title is saved as soon as naming completes, independently of checkout and setup. Setup failures remain visible in that session; send a retry there after correcting the problem. The retry reuses the saved title. If naming itself fails, another attempt uses the original first prompt, including text attachments. Stopping during setup cancels preparation without starting the agent. Steering an active run keeps its progress visible, and delayed history cannot replace a newer startup stage or restore startup labels after activity begins.
313313

‎ui/src/pages/new-session/draft-place-browser.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,30 @@ function createBrowser(request: (method: string) => Promise<unknown>, data?: New
105105
}
106106

107107
describe("DraftPlaceBrowser", () => {
108+
it.each(["loaded", "pending"])(
109+
"reloads the project catalog after an owner reset without reconnecting (%s)",
110+
async (initial) => {
111+
const retired = { id: "retired", displayName: "Retired", repoRoot: "/retired" };
112+
const current = { id: "current", displayName: "Current", repoRoot: "/current" };
113+
const pending = createDeferred<{ projects: (typeof retired)[] }>();
114+
const request = vi.fn(() => pending.promise);
115+
const fixture = createBrowser(request);
116+
const previous = fixture.browser.refreshProjects();
117+
if (initial === "loaded") {
118+
pending.resolve({ projects: [retired] });
119+
await previous;
120+
}
121+
122+
request.mockResolvedValue({ projects: [current] });
123+
fixture.browser.resetProjects();
124+
fixture.update();
125+
await waitForFast(() => expect(fixture.browser.projects).toEqual([current]));
126+
pending.resolve({ projects: [retired] });
127+
await previous;
128+
expect(fixture.browser.projects).toEqual([current]);
129+
},
130+
);
131+
108132
it.each(["disconnect", "failure"])(
109133
"retains the selected project until a catalog confirms its removal (%s)",
110134
async (unavailable) => {

‎ui/src/pages/new-session/draft-place-browser.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ export class DraftPlaceBrowser {
337337
}
338338

339339
resetProjects() {
340+
// Retire the old request and refetch even when the connection has not changed.
341+
void this.projectsTask.run([null, false, -1]);
340342
this.projectsValue = [];
341343
this.projectRecentsValue = undefined;
342344
this.clearProjectSelection();

‎ui/src/pages/new-session/draft-place-state.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ export class DraftPlaceState {
391391
}
392392

393393
clearProjectSelection() {
394-
// Catalog refresh errors also call this when the draft has no selected project.
395394
if (this.browser.projectId || this.browser.remoteProject) {
396395
this.repositoryState.clearDetails(true);
397396
}

0 commit comments

Comments
 (0)