Skip to content

feat(projects): add workspaces on other workers from settings - #500

Merged
nixuuu merged 1 commit into
devfrom
feat/project-workspaces
Nov 10, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/project-workspaces

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 10, 2026

Copy link
Copy Markdown
Member

Settings → Projects now uses compact workspace rows with copyable, middle-truncated paths and an actions menu. Add workspace opens a worker/source picker on web and a sheet on mobile, supporting an existing directory or a clone on a local or linked worker.

Clone URLs are prefilled from an owned workspace's origin and remain editable. The destination uses the target worker's project parent or home and the project's directory name. Clones use the worker's own Git credentials, show a 5-minute limit, clean failed directories, and explain authentication failures without exposing Git diagnostics or credentials.

The additive AddProject.project_id field attaches to the selected project; the gateway checks ownership and duplicate placement before filesystem work. GetWorkspaceCloneSource returns only a safe, transient URL. Linked routing uses existing project aliases and a capability gate. Public worker mirrors now include the home directory so linked destination suggestions work.

Validation

  • bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check, and bun run --filter @canopy/web build pass.
  • 38 integration tests / 250 assertions pass across project-workspaces, add-project, linked-projects, config-sync-projects, and settings-expansion. Each file ran separately through bun run check:tmp; all temporary directories were clean. Coverage includes real local/linked workers, a temporary bare remote, origin prefill, new threads, duplicate refusal, owner boundaries, auth failures, cleanup, unsafe URLs, traversal and symlink refusal.
  • Real-browser checks cover light/dark, 1280/760/390 px, one/four workspaces, long names/paths, an offline worker, overflow/removal confirmation, existing-directory addition, clone success, auth failure and retry. No horizontal page overflow at phone width. Screenshots remain outside the repository in /var/tmp/canopy-project-workspaces/.
  • EAS CLI 27.4.1 production fingerprints are unchanged: iOS 6ddec9ef559ee0095ac33e94ff9418a942053b17; Android 5f6eae3ab278f1cd543e9ed763f923a319b65ec9. Mobile changes are JS only; native-device rendering was not exercised. No UI test suites were added or run.

Copy audit (docs/copy.md §8)

Before → after Reason
Per-worker “Add” → “Add workspace” Names the action and keeps it next to the grouped workspace list.
“Git URL” source → “Clone repository”; scoped submit → “Clone workspace” Separates the source action from the URL field and names what is added.
Raw clone diagnostics → “Could not clone the repository. Check the Git URL and connection, then retry.” Explains the failure and next action without exposing Git output.
Authentication failure → “Sign in to Git on (SSH key or credential helper), then retry.” Gives the target-specific remedy; connector credentials stay in the gateway.
Large worker card → compact name/computer/path row, visible “Offline” and “Already added” states Preserves meaning beyond colour and keeps long text tidy.

New text uses the existing project/workspace/worker/computer glossary, sentence case, imperative action labels and short sentences. Removal keeps the explicit confirmation and explains that existing threads/files remain. No new glossary terms or humorous text. Optional missing origins stay empty and editable; update/config-sharing dependencies name the needed action. Checked short, typical and long worker/computer names at desktop and phone width; offline text keeps reserved room.

Scope and compatibility

Adding a local project's workspace on a linked computer requires Share configuration on both sides, so the target home has that project's record. Without it the call fails before disk writes with an instruction to enable it; independent projects retain their existing behavior. Older linked gateways must update before accepting explicit attachment.

Copying repository/local files between workers remains the separate follow-up source; no copy option is displayed yet. Polish linked-computer and UI API docs describe the flow, credential handling and a future GitHub App gateway-proxied fetch option that keeps tokens off workers. No database migration or protocol version bump is needed.

@nixuuu
nixuuu merged commit 67af1dc into dev Nov 10, 2026
9 checks passed
@nixuuu
nixuuu deleted the feat/project-workspaces branch November 10, 2026 13:48
nixuuu added a commit that referenced this pull request Nov 10, 2026
nixuuu added a commit that referenced this pull request Nov 10, 2026
nixuuu added a commit that referenced this pull request Nov 10, 2026
## Change

Add workspace now offers **Copy from <workspace>** for a project on
local and linked workers. Web/desktop uses the add dialog; mobile uses a
sheet with a touch tree picker. Both show directory sizes, file counts,
ignored groups, secret confirmation, progress, cancellation and
completion summaries. Project presets store path hashes in the gateway
database.

The default copies the complete Git metadata, including unpushed
commits, the index, branch and remotes. A remote clone would lose
unpublished objects and index state, and can require credentials
unavailable on the target. Linked worktrees become independent
checkouts. The target verifies Git connectivity before publication.
Selecting `.git/config` and other potential credentials requires
explicit confirmation.

Transfers use existing worker and linked-computer links, with one
acknowledged 128 KiB chunk in flight and an 8 MiB/s cap. SHA-256
verifies each file and the aggregate. Staging plus rename prevents
publishing partial checkouts; receipts recover interrupted finalization
and cleanup checks directory identities. Retries start from a fresh
preview rather than resuming partial file offsets. Limits are 20 GiB
selected, 8 GiB per file, 100,000 entries and an 8 MiB manifest. Nested
checkouts/submodules, external Git alternates and unsafe paths need
cloning instead.

Additive contracts negotiate `workspace_copy_v1`; protocol 1 and frozen
update/v1 stay unchanged. Migration 0112 stores presets and owner-scoped
transfer summaries. File contents bypass journals, outboxes, models,
logs and diagnostics. Audit records contain actor, source, target,
counts and bytes. Polish protocol, worktree, linked-computer, durability
and governor docs describe the flow.

## Verification

- `bun install`, `bun run gen`, `bun run gen:check`, root typecheck,
lint, format check and web build passed. Generated contracts are
included.
- Real-worker gRPC coverage exercises local and linked copies in both
directions, worktree Git state, ignored defaults/presets, explicit
secrets, symlink escapes, executable bits, cancellation/failure cleanup,
chunk and aggregate integrity, size limits, foreign ownership, older
workers, log confidentiality, restart recovery and starting a thread in
the new workspace: 11 tests and 66 assertions passed.
- Full `check:tmp` covered all 394 test files, one process/file at a
time. Every file passed, with opt-in live tests skipped. Four existing
test files needed a retry: channel identity, promotion and skills
initially hit the default 5-second timeout; gateway UI initially
observed a duplicate interaction answer. All four passed individually
with a 30-second timeout. Worker shutdown now waits for copy-receipt
recovery, avoiding filesystem work after shutdown.
- Manual browser checks covered light/dark, 1280 px desktop, 760 px
narrow and 390 px phone layouts, long paths, ignored directories,
secrets, progress, cancel, error and success. Expanding 3,501 files took
17 ms and mounted 21 rows. A selected 64 MiB copy completed and appeared
immediately; cancellation removed both staging and destination.
Screenshots remain outside the repository.
- Mobile: typecheck and changed-file ESLint passed, Expo Doctor 20/20,
CNG prebuild and iOS/Android exports passed. Production fingerprints
using `[email protected]` are unchanged: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Full mobile ESLint reports
39 errors and 3 warnings in unchanged files; changed files are clean.
Native device inspection was unavailable: device support failed twice.
Windows/macOS worker runtime behavior was not exercised.

### Copy audit (docs/copy.md §8)

1. Checked new text for short active sentences, sentence case,
punctuation and glossary terms. `1 files` → `1 file` fixes singular
counts in both clients. No new glossary term or humour.
2. Actions use verbs: **Choose files**, **Review secrets**, **Copy these
files**, **Cancel copy**, **Refresh file list**. Confirmation repeats
the copy action and names the target.
3. Errors name the failure and recovery: generic failure → **Workspace
copy failed. Refresh the file list and retry.** Older capability →
**Update this worker to copy files**. Technical transport details stay
off the surface.
4. Empty filtering has **No matching files**. Limits, remembered
selection and ignored defaults appear once at the selection step. Secret
warnings use plain language and an explicit file list; no meaning
depends on colour.
5. Checked short/typical/long worker names and long paths at desktop,
narrow and phone widths. Counts use tabular digits, paths truncate or
wrap, and partial selections have a visible mark.

Related: #500
nixuuu added a commit that referenced this pull request Nov 10, 2026
Linked bots can stay missing in web/desktop even when both computers
show connected. `ListBots` served only the in-memory peer-read cache
while a home was online, so a cold/evicted cache or an A gateway restart
returned no remote bots despite a committed bot mirror. The background
read eventually completed, but the web bot store ignored
`linkedReadCompleted("ListBots")`. Since #458 disabled polling when the
gateway advertises pushed bots, that incomplete list could persist until
another bot change or client reload.

Use the committed mirror while the online read cache is loading or
stale, and continue refreshing the authoritative home list in the
background. Bot mirror commits also mark the home's list cache due and
announce a list invalidation. The web bot store now handles that
invalidation. Mobile already handles it through `OverviewInvalidation`
in its shared query bus, so its implementation remains unchanged.
Existing dimmed/read-only rows and gateway rejection of offline writes
remain in place. Updating A restarts its gateway and client
subscription, restores the persisted mirror immediately and refreshes
from B automatically; no manual resync, database repair or re-pairing is
required.

The original cold-cache behavior comes from #348; #458 turned a
transient incomplete web list into persistent missing rows. History does
not implicate #502 (worker command delivery), #507 (connection
recovery), #500 (workspace/config sharing) or #475 (row badge
rendering). A plain warm-cache B restart did not fail in the baseline.
The cold-cache and A-restart cases reproduce a failure path matching the
report; the maintainer's live stack and databases were not inspected or
changed.

Extract the unchanged feed-negotiation helper from `routed-overview.ts`
to keep the file and watch function within the repository's size limits.
Update the Polish bot and linked-computer documentation.

## Verification

- RED, before the production fix: `TMPDIR=/var/tmp bun run check:tmp
tests/integration/linked-bots-resync.test.ts` — 2 failed, 2 passed. The
cold online-cache read and first list after A restarted omitted B's bots
despite their persisted mirror. Temp cleanup passed.
- GREEN: **30/30 sequential complete-file runs passed**, one test
process at a time using the same `check:tmp` command. Each final-file
run passed all five integration scenarios (150 scenario passes in total)
and left nothing in its private temp directory.
- Coverage: two real gateways, separate PostgreSQL databases and an
actual mTLS link; active and archived bots with last-message previews;
same-version B restart and restart with advertised app version changing
from nightly.119 to nightly.121; A's one ongoing overview watch and
fresh API reads; read-only/offline write rejection; A gateway restart
with its database retained; deletion, archive/unarchive and message
changes made while B was away, then convergence after a fresh B runtime.
Version coverage changes the handshake version on the current
implementation; it does not run historical release binaries. The client
is exercised at the public API/feed boundary; no UI test suite was
added.
- Related suites, run sequentially one file at a time through
`check:tmp`: `linked-reads` (4 passed), `linked-list-retention` (1
passed), `linked-agents` (16 passed). All three temp cleanup checks
passed.
- `bun install`, `bun run typecheck`, `bun run lint`, `bun run
format:check`: passed. Implementation and regression coverage received a
self-review. Full unfiltered tests, `gen:check`, a web build and
browser/device checks were not run locally under the workspace
verification limits; CI covers the broader automated checks.

Copy audit (`docs/copy.md` §8): no UI text added or changed.

Fixes: #458
Related: #348
nixuuu added a commit that referenced this pull request Nov 10, 2026
The URL and choice steps in Add project and Add workspace exposed their
primary actions only as keyboard hints. Every step now renders a
clickable primary button in the shared `StepHeader`, with its action
label and ↵ at the right of the input row.

Invalid input disables the button and exposes the reason to mouse,
keyboard and touch through the existing kit tooltip wrapper. Busy
actions replace ↵ with a spinner in a reserved slot; the label and
button width stay fixed. Back and Close remain clickable, with Close now
visible on desktop as well. Phone and coarse-pointer controls reserve at
least 44 px, and long inputs shrink before the buttons.

The copy flow moves its existing action buttons into that same header,
including review, confirmation, retry and completion. File selection and
copy transport are unchanged. Mobile already had explicit primary
buttons for its equivalent forms; its Add project label now
distinguishes Add project, Create project and Clone project. Only
JS/TypeScript mobile code changed.

## Flows checked

| Surface | Coverage |
| --- | --- |
| Add project | Worker and source selection; existing directory; new
project / Git init; Git URL and GitHub owner/repo; clone destination.
Clicked through successful existing-directory addition, Git init and a
local Git clone using real workers. |
| Add workspace | Worker selection including Already added; sources;
existing-directory destination; clone URL and destination; copy
destination, file list, secret confirmation, progress and Done.
Completed a real workspace copy between two private workers. |
| Shared-step scope | `ChoiceStep`, `UrlStep`, `BrowseStep` and
`CopyWorkspaceStep` are all callers of `StepHeader`; both add flows use
them. Copy changes are confined to header/action wiring and removal of
the old action buttons. |
| Other pickers inspected in code | Command palette, workspace/worktree
picker, Git ref picker and workspace-directory dialog. They use their
own selectable rows or explicit submit buttons rather than `StepHeader`;
no change needed. |
| Mobile inspected in code | Add project: directory/init/clone/GitHub;
Add workspace: directory/clone; WorkspaceCopy: destination, file
selection, secret confirmation, progress and completion. Existing
buttons and sheet close/back affordances cover the same actions. |

## Verification

- Passed `bun install`, `bun run gen:check`, `bun run typecheck`, `bun
run lint`, `bun run format:check`, `git diff --check`, and `bun run
--filter @canopy/web build`.
- Real-browser checks used a private gateway/BFF/Postgres and two real
workers on ports 15437–15439. All add-flow steps above were viewed in
light/dark at 1280, 720 and 375 px, with long URLs/paths; also checked
no-results/disabled tooltip at 320 px. Back, Close, disabled reasons and
mouse actions work. The clone button measured exactly 128.5 × 44 px
before and during its busy state. No UI test suite was added or run.
- EAS CLI **27.4.1**, `fingerprint:generate --platform <ios|android>
--build-profile production --json --non-interactive`: before/after
hashes match. iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Native-device rendering was
not exercised. The full integration `check:tmp` run was not performed;
this task authorized the listed checks and browser verification.

Screenshots are outside the repository:
`/var/tmp/canopy-palette-actions/` (105 PNGs), with every exact path in
`/var/tmp/canopy-palette-actions/screenshots.txt`. Representative files:

-
`/var/tmp/canopy-palette-actions/project-clone-url-long-desktop-light.png`
-
`/var/tmp/canopy-palette-actions/project-url-invalid-tooltip-phone-dark.png`
- `/var/tmp/canopy-palette-actions/workspace-clone-path-phone-light.png`
-
`/var/tmp/canopy-palette-actions/workspace-copy-confirm-phone-dark.png`
- `/var/tmp/canopy-palette-actions/workspace-copy-done-desktop-dark.png`

## Copy audit — docs/copy.md §8

| Before → after | Reason |
| --- | --- |
| Keyboard-only Continue/Select → visible Continue ↵ | Makes the
existing next-step action discoverable to mouse and touch users. |
| Per-step action slot and changing busy label → shared action label
with reserved ↵/spinner slot | Keeps one primary action and avoids width
changes while busy. Existing Add directory, Create project, Clone
project, Add workspace, Clone workspace and Choose files labels remain
scoped to their action. |
| Disabled without an accessible reason → existing URL/path validation
plus Choose an available option / Choose files to copy | Explains the
required input. Reasons are available on hover, keyboard focus and tap.
|
| Secret confirmation checkbox only → unchanged checkbox plus Confirm
that you want to copy these files tooltip | Keeps the explicit consent
requirement and describes how to enable the action. |
| Mobile Add project for every source → Add project / Create project /
Clone project | Names the actual operation. |

New/changed text uses sentence case, imperative verbs, existing glossary
terms and short instructions. Existing service errors, empty-state text
and secret warnings retain their wording. No new terminology, repeated
descriptive copy or humour. Labels remain textual and meaningful without
colour or the ↵ glyph. Checked short, typical and long inputs across
desktop and phone layouts. Polish documentation now describes the shared
primary action, disabled reasons and touch targets.

Fixes: #155

Related: #500
nixuuu added a commit that referenced this pull request Nov 10, 2026
Cloning a project or workspace now shows Git's live phase, percentage,
transfer size and rate, with a collapsible log and Cancel. Failures
preserve the log beside the error and Retry. The log has a fixed height,
automatic scrolling and a reserved scrollbar gutter on web/desktop;
mobile shares the same lifecycle and status formatting.

The worker runs `git clone --progress`, parses CR/LF stderr records and
sends bounded, sanitized snapshots at most four times per second over
the existing WorkerLink. `git_clone_progress_v1` gates
progress/cancellation and the linked-computer route. Older workers keep
the indeterminate unary flow. Proto additions are additive, WorkerLink
stays at protocol 1, and frozen update contracts are unchanged.

Clone deadlines are now 2 minutes without changed progress and 60
minutes overall, with matching gateway/client waits. Cancellation kills
the owned process group, removes queued work immediately and cleans only
the directory created by that clone. URL validation, protocol
restrictions, owner scoping and linked project-sharing checks remain
enforced. Polish protocol, routing and process-governor docs describe
the behavior. Copy workspace has no remote-clone path.

### Validation

- Passed `bun install`, `bun run gen:check`, `bun run typecheck`, `bun
run lint`, `bun run format:check` and `bun run --filter @canopy/web
build`.
- Ran `TMPDIR=/var/tmp bun run check:tmp <file>` serially for
`clone-progress`, `clone-progress-linked`, `process-governor`,
`add-project`, `project-workspaces` and `linked-projects`: 33 tests
passed, with clean temporary directories. Coverage includes
ordering/throttling, redaction and bounds, stalled/queued/running
cancellation, descendants, cleanup, retry, old workers, ownership and
the two-gateway route. No real network repositories or UI tests.
- Inspected the browser on private ports at desktop, narrow and phone
widths in light/dark: project/workspace cloning, scrolling/gutter,
authentication and bad-URL failures, cancellation/cleanup, and
successful registration. Used a local bare repository with 39 MiB of Git
data and controlled Git diagnostics to keep progress/failure states
visible. Screenshots remain outside the repository.
- EAS CLI 27.4.1 production fingerprints are unchanged: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Mobile changes are JS only.
Native device rendering and the Electron shell were not separately
exercised; desktop uses the shared web UI. The full repository test
suite was not run; the focused files above ran individually as
requested.

### Copy audit (§8)

“Cloning on {worker}… This stops after 5 minutes.” → live Git
phase/percentage/transfer status: removes the obsolete deadline and
shows current activity. Added “Cancel”, “Show Git log”/“Hide Git log”
and “Retry”: explicit, sentence-case actions. Failure, stall, timeout
and cancellation messages state the outcome and the next action;
transport details stay out of the surface text. Git's original
diagnostics stay inside the optional log. Checked sentence limits,
glossary, punctuation, repeated facts, accessible labels/status, and
short/typical/long text at desktop and phone widths. No new glossary
term, empty state or expressive copy.

Related: #500, #511, #512
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.

1 participant