Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(projects): restore archived projects on activation
vastsaf01b493a737f
diff --git a/apps/desktop/src/stores/slices/project-slice.ts b/apps/desktop/src/stores/slices/project-slice.tsindex 00ff55a72..51e1bb182 100644--- a/apps/desktop/src/stores/slices/project-slice.ts+++ b/apps/desktop/src/stores/slices/project-slice.ts@@ -315,7 +315,11 @@ export function createProjectSlice({name: workspace.name || workspace.path,branch: workspace.branch,});- persistCurrentSidebar(get);+ if (projectIsArchived(workspace.path, get().projectMeta)) {+ get().restoreProject(workspace.path);+ } else {+ persistCurrentSidebar(get);+ }return workspace;},diff --git a/apps/desktop/test/app-store-sidebar.test.mjs b/apps/desktop/test/app-store-sidebar.test.mjsindex bc98da109..19decf7d7 100644--- a/apps/desktop/test/app-store-sidebar.test.mjs+++ b/apps/desktop/test/app-store-sidebar.test.mjs@@ -18,6 +18,40 @@ const topbarSource = await readFile("utf8",);+test("opening an archived project restores its sidebar visibility", () => {+ const activationBlock = projectSliceSource.match(+ /activateProject: async[\s\S]*?openProjectPath:/,+ )?.[0] ?? "";+ const setProjectIndex = activationBlock.indexOf(+ "await api.setProject(requestedPath)",+ );+ const navigationGuardIndex = activationBlock.indexOf(+ "if (!runtime.navigationIntentIsCurrent(intent)) return null;",+ setProjectIndex,+ );+ const restoreIndex = activationBlock.indexOf(+ "get().restoreProject(workspace.path)",+ );+ const restoreBlock = projectSliceSource.match(+ /restoreProject: \(path\) => \{[\s\S]*?persistCurrentSidebar\(get\);\s*\},/,+ )?.[0] ?? "";++ assert.ok(setProjectIndex >= 0, "activation must set the host project");+ assert.ok(+ navigationGuardIndex > setProjectIndex,+ "stale activation must be ignored",+ );+ assert.ok(+ restoreIndex > navigationGuardIndex,+ "only a successful activation restores visibility",+ );+ assert.match(+ activationBlock,+ /if \(projectIsArchived\(workspace\.path, get\(\)\.projectMeta\)\)\s*\{\s*get\(\)\.restoreProject\(workspace\.path\);\s*\}/,+ );+ assert.match(restoreBlock, /archived:\s*false/);+});+test("project activation separates visible transcript state from background run state", () => {const activationBlock = storeSource.match(/activateProject: async[\s\S]*?openProjectPath:/,diff --git a/docs/adr/0294-project-archive-list-inspector.md b/docs/adr/0294-project-archive-list-inspector.mdindex 01a47e21b..dce11aa7c 100644--- a/docs/adr/0294-project-archive-list-inspector.md+++ b/docs/adr/0294-project-archive-list-inspector.md@@ -43,8 +43,11 @@ must not leave the page.5. **Search still matches session titles.** A session-title hit keeps theowning project in the index, selects it, and lists the matching chats inthe inspector.-6. **Presentation only.** No IPC, storage, host protocol, or activation- semantics change beyond the click-vs-activate split on this destination.+6. **Presentation and renderer-local archive state.** No IPC, host-owned+ storage, or host protocol changes. Explicitly activating an archived+ project (Open, double-click, Enter, or opening one of its sessions) clears+ its archived presentation state so it reappears in the home sidebar.+ Selecting a row to inspect it does not restore the project.## Consequencesdiff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.mdindex 73e75c276..c9ba803b1 100644--- a/docs/spec/04-ux/06-settings-ia.md+++ b/docs/spec/04-ux/06-settings-ia.md@@ -842,6 +842,9 @@ system while preserving their different data ownership:history- Activating a project or project session returns to chat; archive and closeactions keep Project archive open even when the active workspace changes+- Opening an archived project also clears its renderer-local archive state so+ the project becomes visible in the home sidebar; merely selecting its row+ for inspection does not restore it.### Info- app/host/protocol versions + open logsdiff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.mdindex 178ad0a6c..d660da6a3 100644--- a/docs/spec/04-ux/09-interaction-patterns.md+++ b/docs/spec/04-ux/09-interaction-patterns.md@@ -223,8 +223,11 @@ may be retained while exactly one workspace supplies the visible shell context.#### Project tab lifecycle-1. **Open** — selecting a project from Settings → Project archive or the picker adds its- normalized path to the retained set and activates it. Existing tabs remain.+1. **Open** — activating a project from Settings → Project archive or the+ picker adds its normalized path to the retained set and activates it.+ Activation clears that path's archived presentation state so the project+ appears in the home sidebar; selecting an inspector row without activating+ it does not restore the project. Existing tabs remain.2. **Activate** — selecting a different group calls the existing `project.set`bridge. Its path then drives topbar identity, active workspace state, andnew-task scope.diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 649ad1e86..8328aa6ec 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -17821,3 +17821,27 @@ host-created files. The full app's file-preview viewer is covered separately.evaluates the generated shims and renders an automatic JSX component usingthe host hooks and context. Isolated Electron coverage uses`scripts/e2e-plugin-jsx-runtime.mjs`; no user profile or provider is used.++### E2E-264: Reopening an archived project restores sidebar visibility++- **Preconditions**: A durable project group exists for a local folder and can+ be archived through the renderer-owned sidebar preferences.+- **Steps**:+ 1. Archive the project and confirm its row is hidden from the default+ sidebar but remains available in Settings → Project archive.+ 2. Use the project's Open action in Project archive.+ 3. Archive it again, open Add project, select the same folder, and create.+ 4. Archive it again and open one of its sessions from Project archive.+- **Expected**: Each successful activation clears the path's archived+ presentation state, returns to chat, and makes the project visible in the+ sidebar. Selecting an inspector row without activating it and ordinary+ session refreshes leave the archive state unchanged. Reopening the same+ folder reuses the existing group without duplicating project or session data.+- **Specs linked**: `04-ux/06-settings-ia.md`,+ `04-ux/09-interaction-patterns.md`, ADR 0294, D658, issue #1653.+- **Acceptance**: Renderer project activation restores the normalized path's+ local archive metadata only after the host project activation succeeds.+- **Status**: Source-contract coverage in+ `apps/desktop/test/app-store-sidebar.test.mjs` and+ `apps/desktop/test/project-create-dialog.test.mjs`; full UI scenario remains+ Draft and is run only when explicitly requested in a capable environment.diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 54f2190ad..d7529e3a7 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -51,6 +51,7 @@ This log freezes previously open questions into concrete decisions.| D655 | Cloud sync opens in packaged builds as Experimental | **Amend D649: remove the packaged-build visibility gate from Settings `sync` and restore its `Experimental` badge on the rail row and page title. Cloud sync and Remote Hosts are both available in packaged and development builds with Experimental badges. The S3 sync behavior, protocol, Host schema, and persisted data are unchanged. See `04-ux/06-settings-ia.md`, `03-runtime/22-config-sync.md`, and E2E-CONFIG-SYNC-s3-portable-configuration.** | The existing encrypted backup is useful to packaged-build users; the Experimental badge communicates its current maturity without keeping the feature hidden. || D656 | Quarantine appends the host keeps refusing instead of stalling the outbox | **Amend ADR 0041 / D318 / D444 / D597: an append whose `session.appendMessage` or `session.recordUsage` call fails with an error the outbox cannot classify as a duplicate message id, a `PERMISSION_DENIED:` poison row, or a foreign-key orphan is retried on a bounded backoff (5s, doubling to a 60s cap) instead of ending the flush. The fifth consecutive failure on that head moves it into an application-owned dead-letter file, `session-message-outbox.dead-letter.json`, with its payload, session id, quarantine timestamp, and host error; only the newest 256 quarantined appends are kept, and the oldest is discarded with a warn. The flush then continues with the next entry, so one refused append can no longer hold the FIFO head, fill the 1024-entry cap, or fail every session's writes. Quarantined appends are never replayed automatically, and `session.delete` drops that session's quarantined appends too. No protocol version, storage schema, or queued-outbox format change.** | A `stream did not contain valid UTF-8` append stayed at the FIFO head for 14.8 hours while `session.persistence.outbox.is.full` fired 5990 times, so every session's appends failed until restart. Only three error classes had a drain, and every other error was treated as transient forever (#1560). || D657 | Let the embedded Browser open local files outside the workspace | **Amend ADR 0170: an explicit absolute path or `file:` URL may load any existing regular local file, and a local-file page may navigate to other existing local files. Relative inputs remain workspace-rooted; HTTP(S) pages retain only the prior in-workspace file-link allowance. Missing files, directories, and remote file authorities remain blocked. `BrowserPreview` and the sidecar keep their workspace-rooted resolver. The public `pi.browser.navigate` API follows this policy under the high-risk `browser.cdp` permission. See ADR 0328, E2E-059, `04-ux/08-component-spec.md`, and `05-security/01-security.md`.** | Users need to inspect local HTML outside a project, while workspace-scoped agent file tools and remote-page navigation must retain their existing boundary (#1627). |+| D658 | Opening archived projects restores sidebar visibility | **Amend D093 / D455: successful explicit project activation clears that normalized path's renderer-local archived flag and persists it, so Open from Project archive, reopening the same folder through Add project, and opening a project session reveal the project in the home sidebar. Selecting a row for inspection and ordinary session refreshes do not alter archive state. No host/project/session storage or protocol change. See ADR 0294, E2E-264, and issue #1653.** | Reopening a project updated the active workspace but left its path-keyed archived presentation flag set, hiding the project from the sidebar after the user had explicitly opened it. |## B. Secondary implementation defaults