Skip to content

feat: group workspace roots and switch safely - #34

Merged
johnnyhuy merged 3 commits into
mainfrom
ao/workspace-design/grouped-roots
Nov 7, 2026
Merged

johnnyhuy merged 3 commits into
mainfrom
ao/workspace-design/grouped-roots

Conversation

@johnnyhuy

@johnnyhuy johnnyhuy commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Related repositories and package folders currently appear as unrelated cwd-based workspaces. This adds named groups of existing roots so users can switch while Pi sessions continue in the background, with the execution destination kept explicit.

This PR targets main and depends on the still-open #33 at 3bce2eab. Its main-based diff includes #33's unchanged prerequisite commits; the workspace milestone is the commits after that head. It preserves #33's continuation engine and archive-owner safeguards. Review and land #33 first; this PR does not modify or replace it.

Refs #5, milestone 1 only. This does not close #5.

Changes

  • Add a versioned, atomic root/group registry with stable IDs, per-root defaults, legacy-file backups, and retained missing-root history. Initially unresolved paths canonicalize on restoration without changing IDs or archive headers.
  • Add group creation, naming, membership editing, and an existing-folder picker. Keep Files, Changes, History, and defaults scoped to the selected root.
  • Preserve background tabs, drafts, settings edits, and per-root views. Reject stale Git/detail results, reload interrupted preview selections, and keep clean settings caches from restoring old defaults.
  • Validate archive header cwd and root identity before continuation; serialize opens to avoid competing writers. Keep one cwd per Pi session and refuse root-changing runtime or alias redirects.
  • Show bounded file-list truncation and reject package-root commits when the shared index includes staged sibling files.

Validation

  • mise run build: lint, all typechecks, 69 unit tests, 39 component tests, and production bundle passed.
  • mise run test:e2e: all 43 deterministic Electron tests passed, including feat: add session-tree navigation and branch-aware continuation #33 branch-aware resume/fork and source preservation, delayed switching, concurrent opens, alias ownership, restored-root new/resume/fork, and long-session/narrow-window regressions.
  • Regression tests reproduced the four local review findings before their fixes. CI also exposed a collapsing session list at compact heights; 7c656ca reserves usable session-pane space and adds a normal-click 900×600 regression. The compact-window fix passed CI and Electron checks.
  • Fresh-runtime persistence regression: the RPC fixture now assigns an archive path before creating the file, as Pi 1.5.0 does. Six IPC cases cover the first prompt/model setup, deleted persisted/resumed archives, switched missing paths, malformed/foreign headers, and observed empty archives. Missing-file allowance is pinned to a newly launched, zero-message runtime's initial path and is permanently revoked after persistence or a path change.
  • git diff --check passed. No live-provider inference was used.

Remaining scope

Automatic repository/worktree hierarchy, group-wide history, durable archive handles, and cross-folder context transfer remain deferred. Group membership does not combine Pi instructions or provide simultaneous multi-cwd execution. Live processes, drafts, and view state remain in memory; groups, root selection, and defaults persist.

Requested AO review focus

Review the latest head for runtime ownership (including fresh unpersisted archives, single-cwd ownership, live archive reuse, and #33 continuation), migration safety (legacy records, stable IDs, missing/moved roots, and alias handling), and switching races (late opens, stale responses, previews, and per-root drafts/settings). Report actionable correctness findings. Do not merge.

@johnnyhuy
johnnyhuy changed the base branch from ao/session-tree/navigation to main November 7, 2026 14:17

@johnnyhuy johnnyhuy left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one blocking new-session regression.

Standards

No high-confidence documented standards violations found. Filesystem and process operations remain behind IPC and follow the root-scoped model.

Spec

New sessions cannot start against real Pi 1.5.0 because the ownership check requires an archive that Pi intentionally has not persisted yet. The required fix and regression coverage are in the inline comment.

Reviewed the main-based diff at 7c656ca, including the prerequisite #33 changes. Verified lazy persistence by reading the installed Homebrew Pi 1.5.0 session-manager and RPC sources. No project programs, tests, or builds were run.

Standards: 0 findings. Spec/correctness: 1 P1 finding.

Comment thread src/main/index.ts Resolved

@johnnyhuy johnnyhuy left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved / ready. The prior P1 new-session blocker is addressed at 4795882.

Standards

No required findings. The fresh-archive exception is limited to newly launched, non-ephemeral runtimes and permanently ends after messages, an archive-path change, or observing a file.

Spec

No required findings. Read-only inspection of installed Homebrew Pi 1.5.0 confirms that ordinary fresh runtimes report zero messages and an allocated archive path before persistence. The updated fixture models this behavior, and regression cases cover first model setup/prompt plus deleted, switched, malformed, and foreign archives.

Reviewed the main-based diff and the follow-up commit. No project programs, tests, or builds were executed; validation is static code and test inspection. The documented dependency on PR #33 remains.

Standards: 0 findings. Spec/correctness: 0 outstanding required findings.

@johnnyhuy johnnyhuy left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved / ready. No outstanding required findings.

This run requests the same head (4795882) and base (a7e9f44) as the completed follow-up review. Reverified both refs and the clean checkout; the reviewed diff is unchanged.

Standards: no required findings. Spec/correctness: the previous new-session persistence blocker is fixed. The fresh-runtime allowance matches Pi 1.5.0 lazy persistence and preserves strict checks after messages, path changes, or observing an archive. Regression coverage includes first model setup/prompt and missing, switched, malformed, and foreign archives.

Validation is read-only code and test inspection, including installed Pi source inspection from the preceding review of this exact head. No project programs, tests, or builds were executed. The documented dependency on PR #33 remains.

@johnnyhuy johnnyhuy left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved / ready. No outstanding required findings.

Reverified that PR #34 still has head 4795882 and base a7e9f44, with a clean checkout. The main-based diff is identical to the completed review of this head.

Standards: no required findings. Spec/correctness: the prior fresh-session persistence blocker is resolved, with narrowly scoped handling of an initial unpersisted archive and regression coverage for first setup/prompt and ownership refusal cases. The documented dependency on PR #33 remains.

Validation is read-only inspection from the completed review of this exact diff, plus current ref/checkout verification. No project programs, tests, or builds were run.

johnnyhuy and others added 3 commits November 8, 2026 00:30
Add persisted workspace groups, root-scoped recovery and safe background switching. Preserve Pi single-cwd ownership and branch-aware continuation while covering migration and switching regressions.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Reserve usable space for session rows and scroll the sidebar when root navigation fills a short window. Exercise background-session switching at 900×600.

Co-authored-by: OpenAI Codex <noreply@openai.com>
Track the initial archive allocated to a zero-message runtime and allow it to remain absent until Pi persists the first conversation. Revoke the exception on messages, archive changes, or observed files; resumed archives retain strict header ownership.

Match Pi lazy persistence in the RPC fixture and cover first prompts, removed resumed/persisted archives, switched paths, and malformed or foreign headers.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@johnnyhuy
johnnyhuy force-pushed the ao/workspace-design/grouped-roots branch from 4795882 to ad50190 Compare November 7, 2026 15:31
@johnnyhuy
johnnyhuy merged commit 46b15b3 into main Nov 7, 2026
15 checks passed
@johnnyhuy
johnnyhuy deleted the ao/workspace-design/grouped-roots branch November 7, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multi-repo and multi-root workspace workflows

1 participant