Skip to content

feat(threads): track and switch branches from thread details - #422

Merged
nixuuu merged 2 commits into
devfrom
feat/thread-branch-1
Nov 9, 2026
Merged

nixuuu merged 2 commits into
devfrom
feat/thread-branch-1

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 9, 2026

Copy link
Copy Markdown
Member

Thread details cut off both the working directory and current branch, and repeated model, permission, status and usage information already available elsewhere. The first commit removes that redundant block from web/desktop and mobile; the feature commit gives placement its own readable rows and a safe branch picker.

  • Show the complete wrapping path, collapse the home directory to ~, emphasize the folder name and reserve space for copying. Show the full current branch, its base on a separate line, and detached HEAD explicitly.
  • Track each checkout's HEAD with a debounced file watch and direct reads after initial gitdir resolution. Share the watch between threads and retain reconnect/turn-end recovery.
  • Search local and known remote branches without fetching. The gateway enforces ownership and rejects active/queued turns, pending interactions, background work and open goals across the checkout, including path aliases. The worker reserves the checkout, requires a clean tree and lets git refuse branches already used elsewhere. There is no stash or force.
  • Route linked-thread operations to their home and gate both home and worker support through additive capabilities. Record “Branch switched to X by you” and deliver checkout context to the next agent input, including resumed sessions and shell inputs. A shell failure preserves the note for the next input.

Ahead/behind remains available in Manage worktree; the placement section does not add periodic git scans. Contracts are additive, WORKER_LINK_PROTOCOL remains 1 and there is no database migration.

Verification

  • Gateway↔worker coverage: live HEAD updates, local and remote switching, expired commands, dirty trees, branches used in another worktree, running/queued turns, shared checkout aliases, owner scoping and older workers. Linked-computer coverage checks home routing, viewer HEAD/notices and older-home refusal. Shell integration checks the actual harness input and recovery after a failed shell command.
  • Real browser on a private production server: light/dark, desktop 1280×800, narrow 880×900 and phone 390×844; short/typical/long directory paths, short branches and feature/agent-email-channel-implementujesz-docelowa-architekture-agenta-ai, detached HEAD, searchable branch selection and successful switching from desktop and phone overlays. No horizontal overflow or leftover section seams. The reserved branch area measured 128 px before and after the tested short/long switch.
  • Mobile changes are JS/TS only. EAS CLI 27.4.1 production fingerprints were generated for both platforms before/after: iOS 2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3, Android c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d; both unchanged. Native device visuals were not checked.
  • Final repository checks pass: bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check, the web build and bun run check:tmp --timeout 30000 (1924 pass, 161 skip, 0 fail across 343 files; nothing left in the test temp directory). The initial 5-second-default run timed out in two existing plugin/skill tests; both passed in the complete run with a 30-second default.
  • Additional mobile checks: Expo Doctor passes 20/20; both Hermes bundle exports pass, and ESLint passes for the new picker/placement and the edited panel, sheets and thread state. The full Expo ESLint command also reports existing errors in other surfaces (including the unchanged ref assignment in ThreadScreen). CNG prebuild fails in @expo/image-utils/jimp-compact with Could not find MIME for Buffer <null>; native config and source assets are unchanged. Generated native folders were removed. This PR does not change native dependencies/configuration to address that separate issue.

Copy audit (§8)

  • Duplicate model, permission, status and usage rows → removed. Each fact keeps its existing primary surface; no replacement copy or empty section.
  • Truncated path/branch with an inline competing base → “Worktree”/“Directory”, “Branch”, full values, a separate “from …” line and “Detached at …”. Sentence case, existing glossary and explicit text preserve meaning without relying on icons or colour.
  • New actions use verbs: “Switch branch”, “Search branches”, “Copy working directory”. The picker groups are “Local branches” and “Remote branches”; no confirmation or destructive wording is introduced.
  • New errors state the problem and next step: commit/discard changes, choose another branch, wait for work, reconnect or update the relevant computer. Empty/loading/search states are short and actionable. Raw git diagnostics and private paths are not exposed as errors.
  • No humour or “soul” copy. Checked with short, typical and long values at desktop and phone widths; accessible labels name actions and errors use alerts. The requested full-path tooltip supports inspecting the complete path.

Related: #392, #395

Related: #392, #395

Copy audit: removed duplicate model, permission, status and usage labels. Model and permissions remain in the composer; status remains in the header and sidebar. No new UI copy.
Track HEAD through bounded file watches, expose safe owner-scoped branch selection on the home computer, and preserve branch context for the next agent turn.

Show full wrapping paths and branches in web, desktop and mobile details.

Related: #392, #395
@nixuuu
nixuuu merged commit 0946764 into dev Nov 9, 2026
15 of 17 checks passed
@nixuuu
nixuuu deleted the feat/thread-branch-1 branch November 9, 2026 16:20
nixuuu added a commit that referenced this pull request Nov 9, 2026
Picker options at the start and end of a list could put their hover
background directly against the search/footer dividers. Lists now keep a
4 px vertical inset inside the scrolling content, with matching scroll
padding for keyboard navigation.

The inline combobox scrolls a wrapper around its padded list. This lets
sticky group headings remain flush with the search divider after the
inset scrolls away. Menu padding also lives inside its content, so a
phone sheet's safe-area padding cannot remove the last row's inset.
Mobile `PickerSheet` gets the same top inset through a TS-only style
change.

**Scope and audit**

- Project, worker, workspace and branch pickers (including the
existing-thread branch picker from #422) inherit the shared `Combobox`
fix. The model list uses it too; its provider rail keeps its existing
inset and adds scroll padding.
- Settings selects and slash/mention lists reuse the list inset. Both
desktop autocomplete popovers and phone inline suggestions have scroll
padding on their actual scroll container.
- Permission/thread action menus and submenus retain their inset during
keyboard navigation. Effort uses an already padded slider panel and
needs no list change.
- The updates center already has vertical content padding; it now has
matching scroll padding. Directory browsing already has an inset. Other
settings/credential/proxy choices inherit `Select`.
- `docs/ui-scale.md` records the scrolling-content rule. No UI copy
changed; copy audit is not applicable.

**Verification**

- Passed: frozen Bun install, monorepo typecheck, root lint, format
check, web build, and focused ESLint for
`apps/mobile/src/ui/Picker.tsx`.
- Real Chromium checks used the actual shared components in a temporary
isolated fixture on an unused port: light/dark, 1440 px desktop and 390
px phone widths, 2/40 options, short and long labels,
scrolling/non-scrolling lists, with/without a search header and footer.
Checked first/last hover and keyboard-active rows, top/bottom scrolling,
grouped sticky headings, model rail Home/End, and submenu
ArrowRight/ArrowLeft focus return. Edge insets stay about 4 px; scrolled
sticky headings meet the viewport with an opaque background and no seam.
No UI test suite or screenshots were added.
- Generated production-profile fingerprints with `bunx [email protected]
fingerprint:generate --platform <ios|android> --build-profile production
--json --non-interactive` on current `dev` and this branch; both
platforms are unchanged.
- The extra Expo ESLint command has 36 existing errors and 3 warnings on
`dev`, outside the changed picker. The changed mobile file passes
focused ESLint. Native visual checks were not run.
- Full local `check:tmp` was intentionally not run on the shared
machine; CI remains the gate.

Fixes: #115
Related: #422
nixuuu added a commit that referenced this pull request Nov 10, 2026
## Change

The thread-details branch picker had a 128 px minimum height, a chevron
aligned with the label, and an upstream name that wrapped into awkward
fragments. Render Branch and Worktree with shared compact field layouts
on web/desktop and mobile: no resting fill, content-driven height,
reserved value-line chevron, and middle-truncated upstream names with
the full value in a web tooltip or selectable native text.

Running/offline/unsupported states keep the same muted row and an
explanation. A dirty result from the existing branch-list request
disables branch selection and shows “Commit or stash changes before
switching branches.” Reopening refreshes the status after cleanup; the
worker still enforces a fresh status before switching. Native picker
options use compact single-line labels.

Fixes: #422

## Verification

- `bun install --frozen-lockfile`, `bun run gen:check`, `bun run
typecheck`, `bun run lint`, `bun run format:check`, and `bun run
--filter @canopy/web build` passed. No UI tests added; full `check:tmp`
left to CI as requested.
- Inspected the production placement components in Chromium using an
isolated temporary fixture with mocked branch responses: light/dark at
1280, 768, and 390 px, plus 320 px light; short, typical, and very long
branch/base names; detached HEAD; running, unsupported, offline, and
dirty states; hover, keyboard focus, Enter, Escape, and focus return.
The typical branch row is 84 px including its three text lines, with no
spare bottom area; a checkout without a base line is 60 px. No
horizontal overflow at phone widths. Fixtures and images are excluded
from the commit.
- Checked picker search, selected current-branch check, local/remote
groups, long option tooltips, phone sheet, and a 32-option scrolling
list. List padding and scroll padding are 4 px; sticky headings meet the
search divider, and the final option retains a 4 px bottom inset.
- `bunx [email protected] fingerprint:generate --platform ios
--build-profile production --json --non-interactive` and the equivalent
Android command passed before and after the changes. iOS remains
`6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android remains
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Mobile changes are TS/TSX
only. Native device rendering and live gateway/worker flows were not
exercised.

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

- Existing Branch, Worktree, from, picker/search labels, errors, and
detached-HEAD text are unchanged. Existing availability reasons move
from inline text to a hover/focus/long-press tooltip on web, keeping the
row compact and keyboard reachable; native reasons remain inline.
- No dirty-status explanation → “Commit or stash changes before
switching branches.” One short action sentence identifies how to restore
availability; the same wording is used on both clients. No new glossary
terms or decorative copy. Checked short, typical, and long names at
desktop and phone widths; text and accessibility state convey
availability alongside color.
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