Skip to content

Rebuild the project view on upstream project and row primitives #419

Closed

Description

@tannerpolley

Plan step 3 of #416. Owner decision: keep the hierarchy, rebuild it on upstream.

  • Keep custom sections and subsections, dragging, and the worker/orchestrator controls in one owned component with one owner of layout state.
  • Reuse upstream's grouping, pin/archive, folder expansion and common row actions where they fit.
  • Keep the global activity filter separate from expansion.

Do this after the sync sub-issue.

Activity

  1. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    Design: retain the hierarchy, replace duplicated sidebar foundations

    Based on #416 findings, owner decisions, and read-only inspection of main 1e072987b65fc34e7099dc459c33d57c8309252f. Upstream nightly v0.1.10-nightly.20261116.4800 (7d32075e3757ded707914e2450c3e392a9665765) is an ancestor.

    Done means: custom sections/subsections, mixed child order, dragging, worker families and repository-orchestrator controls remain; Projects and Activity share project identities, folder expansion semantics, common row behavior and commands. Global activity scope remains independent of expansion. Saved sections survive unchanged. No additional per-row subscriptions or unrelated-row renders. The duplicate project thread renderer is deleted after cutover.

    Scope: web and desktop's shared web sidebar, local and remote environments. Native mobile and provider/delegation lifecycle redesign are excluded under the fork guide. No plugin framework, second store, new layout schema, or new styling system.

    Current footprint

    Counts below are physical lines at the pinned main. Shared-file +/− counts are git diff --numstat 7d32075 HEAD, not an estimate of removable code. Fork-only files have the same added-line count as their length. Paths below are relative to apps/web/src/ unless qualified.

    Fork composition and row presentation

    File Lines
    components/sidebar/SidebarProjectSections.tsx 1,797
    components/sidebar/SidebarProjectSections.logic.ts 187
    components/sidebar/useSidebarProjectsView.ts 59
    components/sidebar/NewSectionProjectDialog.tsx 182
    components/sidebar/SidebarProjectThread.logic.ts 55
    components/sidebar/SidebarProjectThreadTooltip.tsx 196
    components/sidebar/SidebarBackgroundWork.logic.ts 291
    components/sidebar/SidebarBackgroundWorkRows.tsx 519
    components/sidebar/SidebarColumns.tsx / .css / .logic.ts 272 / 126 / 10
    components/sidebar/SidebarFamilySeparators.logic.ts 117
    components/sidebar/SidebarThreadProcesses.tsx / .logic.ts / Group.tsx (SidebarThreadProcessesGroup.tsx) 143 / 110 / 181
    components/sidebar/useSidebarWorkExpansion.ts 9
    components/sidebar/SidebarThreadTime.tsx 55
    components/sidebar/SidebarAskModeItem.tsx / SidebarWorkerProviderItem.tsx 58 / 60
    components/sidebar/SidebarReveal.logic.ts 66

    Fork layout and appearance boundary

    File Lines
    components/SidebarLayoutSync.tsx 501
    sidebarLayoutClient.ts / sidebarLayoutProjection.ts / sidebarLayoutMigration.ts 211 / 220 / 93
    projectSectionPlacement.ts / projectFolderAppearance.ts / sidebarSectionFolders.ts 110 / 52 / 4
    hooks/useSidebarLayoutPermission.ts 14
    components/sidebar/ForkSidebarTextSizes.tsx / .css 33 / 73
    components/sidebar/ForkSidebarDebug.ts / .css 136 / 35
    components/settings/ForkSidebarDisplaySettings.tsx / ForkSidebarTextSizeSettings.tsx / ForkSidebarDebugSettings.tsx / SidebarProjectSettings.tsx 135 / 70 / 39 / 93
    packages/contracts/src/sidebarLayout.ts 137
    packages/shared/src/sidebarLayout.ts / sidebarSectionFolders.ts 425 / 117
    apps/server/src/sidebarLayout.ts 298

    These helpers need not all change. Layout transport, backend persistence, debugging and text-size preferences are retained boundaries, not rewrite targets.

    Edits inside upstream files

    File Current lines Fork delta +/−
    components/Sidebar.tsx 3,914 322 / 76
    components/Sidebar.logic.ts 1,658 241 / 46
    components/sidebar/SidebarThreadRow.tsx 2,038 269 / 75
    components/sidebar/SidebarThreadHeader.tsx 259 162 / 73
    uiStateStore.ts 822 419 / 64
    components/AppSidebarLayout.tsx 517 18 / 3
    components/sidebar/SidebarChrome.tsx 312 14 / 4
    components/sidebar/SidebarDraftBlock.tsx 251 10 / 1
    components/sidebar/mainAppLocation.ts 78 3 / 1
    components/ui/sidebar.tsx 910 10 / 2
    components/settings/SettingsSidebarNav.tsx 444 2 / 0

    The unchanged upstream primitives include hooks/useSidebarProjectGroups.ts (43 lines), sidebarProjectGrouping.ts (246), and SidebarProjectFolderHeader.tsx. Do not reset shared files wholesale: their deltas include unrelated retained features.

    Existing fork evidence to extend, not replace: ProjectSections logic/drag/permissions tests (232/245/177 lines), ProjectThread logic (150), BackgroundWork logic (507), Columns logic (21), FamilySeparators logic (172), ThreadProcesses logic (193), WorkExpansion (71), Reveal logic (77), Sidebar.logic.fork (578), SidebarLayoutSync (160), layout client/projection/migration (214/396/80), sidebarDisplay (384), placement/appearance/section-folders (54/34/110). Shared upstream test edits also exist in Sidebar.drag.browser and SidebarDraftBlock.browser (+1 each). Counts describe this feature slice, not the whole fork.

    Behavior mapping and ownership

    Source references are pinned: fork Sidebar, fork section component, upstream row, upstream folder.

    Fork behavior Reused owner / symbols Retained fork responsibility
    Logical repositories, worktrees, remote/local grouping and project ordering useSidebarProjectGroups, buildSidebarProjectSnapshots, SidebarProjectSnapshot.memberProjects, getProjectOrderKey, sortSidebarV2ProjectGroups Place those snapshots into saved sections; do not derive a second project identity.
    Section/subsection hierarchy and dragging Existing resolveProjectDrop, resolveSubsectionDrop, shared sidebarSectionChildOrder and applySidebarLayoutMutation Upstream has no section equivalent. Keep section DndContext, keyboard sensor, permissions, drop indicator and folder-drop/new-project placement. Do not turn on upstream folder mode as a substitute: it disables drag/Working shelf.
    Project header, expansion and actions SidebarProjectFolderHeader, sidebarFolderRowId, sidebarFolderExpansionKeys, resolveProjectExpanded, setProjectExpanded; handleProjectFolderContextMenu, startThreadInProjectFolder Wrap the upstream header in the existing sortable section placement. Add only the narrow header appearance/drag/action inputs needed for retained colors, icons and controls. Avoid nested buttons or nested li markup.
    Thread rows, rename, selection, navigation, context menu, pin/unpin, archive SidebarThreadRow folder variant, renderThreadRow assembly, useThreadActions (pinThread, unpinThread, archiveThread), handleThreadContextMenu; project operations use existing useProjectGroupUpdate Share row assembly/handlers between views; extract the current assembly only as needed rather than recreating all its callbacks in Projects. Preserve capability/permission checks, confirmation and multi-selection. Archive is not settle; use the existing command for each.
    Keyboard tree, reveal and visible order attachSidebarTree, navigationParent, sidebarFolderRowId, existing route reveal path Section ancestry and collectVisibleProjectThreadOrder must describe the same rendered tree, including collapsed worker families. Keep reveal opening ancestors without changing the activity filter.
    Worker/orchestrator roles and child work Upstream thread shells, row selection/action paths and subscription leases; existing useRepositoryOrchestratorAction.forThread context-menu augmentation Keep orchestratorsFirst, groupRunningSubagentsByParent, withChildNeeds, SidebarBackgroundWorkRows, useSidebarWorkExpansion, worker provider and ask-mode controls, issue badges, process visibility and family separators. No upstream product replacement is claimed for these.
    Model/effort columns and tooltips Shared composer EffortGlyph and model option descriptors Keep sidebarEffortGlyph and SidebarColumns as the single effort implementation; pass provider models by environment + instance.
    Global activity scope Existing sidebarProjectScopeKeys and scope/filter handlers Never derive scope from expanded folders or rewrite expansion on filter changes. Projects keeps its hierarchy; Activity keeps its shelves/search.

    One owned feature component: keep SidebarProjectSections as the fork composition root; it owns sections, drag state and custom worker/control composition. Its existing private helpers/pure logic are acceptable; “one component” does not mean one giant function. Remove its private SidebarProjectThreadRow after common-row cutover. Keep only narrow composition inputs in upstream Sidebar/header/row files. Generic row actions remain upstream-owned; fork-only menu items are contributed through the existing augmentation.

    One layout-state owner: retain the controller created by createSidebarLayoutClient, mounted once by SidebarLayoutSync. It owns client-side durable layout updates, per-environment revision/write lanes and pending edits. SidebarLayoutService remains the server authority. useUiStateStore is a projection/read facade with forwarding actions (configureSidebarLayoutActions, applySidebarLayoutProjection), not a second writable copy. useSidebarProjectsView reads that projection and retains only transient dialog/view state. No second sync hook or state copy in rows. Local work expansion and activity filtering remain separate UI concerns.

    Saved layouts: carry over without a new migration

    Retain SidebarLayout, the server table/migration, revision protocol and storage keys. Preserve section IDs, names, parentId, mixed childOrder, project memberships, color/folder settings, collapse states, projectOrder and Other expansion verbatim. Do not export the visible grouped list back as a replacement layout.

    Keep projectSidebarLayout as the durable-ID → grouped-row projection and sidebarProjectRefsForKeys as the inverse mutation lookup. Grouped rows use upstream sidebarFolderExpansionKeys for reading/toggling; commands still target the existing environment-scoped physical project IDs. Re-grouping or a disconnected environment must not delete unrendered memberships. Keep primary-environment precedence already encoded by the projection.

    Retain existing legacy paths: migrateSidebarLayout, pending import keys, resolvePendingSidebarImport and createLegacySidebarRetirement. Do not reset/import again on component mount. Preserve empty sections and unresolved aliases until their environment arrives; late import must not overwrite subsequent owner moves. The startup sidebarDisplaySnapshot is display-only, never a sync/import source. While it is active, layout writes stay guarded.

    Use synthetic persisted fixtures covering all fields and disconnected environments. No inspection or modification of the owner's live userdata is needed for this design or implementation.

    Performance acceptance

    This is a correctness constraint, not a hoped-for optimization:

    • Keep upstream useQuietThreadShells for list/group derivation and sidebarProviderEntriesAtom's stable environment maps. Eliminate the custom project row's broad useEnvironmentProviders() subscription when moving it to the shared row.
    • Compute grouping, parent/child lookup and layout projection once at the feature boundary; preserve references for unchanged groups/thread arrays. Pass stable action callbacks and primitive per-row state. Do not pass the entire layout/filter record into each row.
    • Reuse useSidebarRowSubscriptionLease for visible/active work. Reconcile the fork's useSidebarThreadProcesses visibility observer with it; do not mount both independent live-query/observer paths for the same work. No per-row layout streams, provider queries or extra global-store subscriptions.
    • Closed sections/projects do not mount thread rows or process detail lists. A streaming tick or provider checkedAt-only update must not redraw every project; selecting a thread should update only affected rows; expanding a family should affect that family and any actually changed project separator.
    • Before and after cutover, record render/subscription counts with the same synthetic hundreds-of-threads fixture, same expanded rows and events (stream update, provider status-only update, selection, one project expansion). Assert event/count invariants, not milliseconds, sleeps or a guessed speedup. Preserve existing required subscriptions; any net increase or unrelated-row renders is a failed gate. No new virtualization dependency in this task.

    Separately mergeable implementation order

    1. Unify layout access and grouped expansion. Keep the existing UI, move Projects expansion onto sidebarFolderExpansionKeys and the existing layout action/projection path, and remove duplicate layout derivation from the view hook where applicable. Preserve current data format. Extend existing projection/client/migration tests only where coverage is missing: grouped aliases, disconnected/reconnected environment, empty/nested sections, mixed order, late imports and pending edits. A real behavioral correction gets a failing case first. Capture the same nested synthetic layout before/after if visible expansion behavior changes. This is independently useful without changing row rendering.
    2. Use upstream project headers and shared project actions inside the hierarchy. Retain section/subsection drag wrappers and new-project placement. Integrate upstream folder row IDs and tree ancestry. Extend existing ProjectSections drag/permissions and visible-order logic cases for mixed project/subsection drops, read-only targets and collapsed ancestors; use a before/after capture for presentation and a short interaction recording for dragging/focus. Keep the old thread renderer temporarily. This step depends on 1.
    3. Use the common thread row and one subscription path. Share upstream row assembly between Activity and Projects; retain custom role/effort/family/work adornments through narrow inputs and existing owned helpers. Delete duplicate thread row/tooltip behavior only once the shared row covers it. Extend existing background-work/status/order logic tests for any changed behavior; run Sidebar effort bars are missing on some threads and drawn differently from the composer's #423 effort cases unchanged. Perform the render/subscription count comparison and a real-client pass for row actions, worker expansion, keyboard navigation, permissions, remote instance lookup and both supported sidebar appearances. Before/after captures must include default-effort Claude orchestrators and Codex workers. This step depends on 2.
    4. Finish the shell boundary and remove obsolete composition code. Move remaining fork-only dialog/section/control wiring behind SidebarProjectSections where feasible; remove dead helpers/imports and duplicated handlers, retaining generic search/Activity/shelves and upstream row commands. Verify Settings, command/keybinding entry points and route reveal against the same action/state owners. Extend existing visible-order/reveal logic tests only if behavior changes; capture the full nested layout before/after and replay the integrated workflow. Compare shared-file numstats against this baseline and account for every removed behavior. This step depends on 3; it is not permission for an unrelated cleanup.

    Each step can merge with working Projects and Activity views; no half-migrated storage or feature flag scaffolding. Run focused tests while iterating and agent-heavy vp run check:changed in a background shell before each push. No repo-wide suite. Use existing disposable synthetic fork fixtures; stop the dev server started for the integrated pass. Browser tests are justified only for actual hooks/drag/focus wiring, not visual styling.

    #423 / PR #424 preservation gate

    Main contains the default-effort change (4b2460d738) and glyph-size follow-up (37c672f4f2). Keep:

    • Explicit selection and recognized reported effort handling, then descriptor default only when neither provides an explicit effort; unsupported/unknown effort must not invent bars.
    • Provider resolution by environment and instance, with descriptor models passed through to sidebarEffortGlyph.
    • SidebarEffortMeter rendering the shared EffortGlyph size="xs"; retain current CSS sizing and do not restore the removed scaling.
    • Existing SidebarBackgroundWork.logic.test.ts regression assertions plus before/after visual evidence against the composer.
      Check top-level project threads, worker/subagent rows and Activity wherever effort is displayed. Do not copy a pre-fix(web): show default sidebar effort bars #424 renderer from upstream or an older fork commit.

    Owner decisions (before presentation changes; recommendations preserve current behavior)

    1. Should Projects keep its current compact columns, colors, family separators and custom text sizes while adopting upstream row mechanics? Options: keep current presentation (recommended); adopt upstream folder/card appearance and retire those preferences. The latter changes scope and requires explicit approval; hierarchy and controls remain mandatory either way.
    2. Should pinning change where a thread/project appears inside custom sections? Options: retain saved section placement and current orchestrator-first Projects order, sharing upstream pin/archive commands and indicators (recommended); introduce a separate global Pinned shelf/reorder policy in Projects. The second is a product change, not required by reuse. Preserve archive/unarchive through existing actions without erasing section membership; do not invent a new archive layout.

    Already decided: keep hierarchy, dragging and controls; use upstream primitives. Those decisions are not reopened. No implementation was performed. Tests/browser captures are implementation gates, not evidence produced by this source-only design.

  2. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    Split handoff

    This spans layout compatibility, project headers, thread-row subscriptions and final integration; use four sequential implementor assignments rather than one broad rewrite. I attempted propose_issue_change(type: "split"), but it returned: “Only a managed thread in this repository can propose issue changes.” No children were created.

    The repository orchestrator should submit the split with these titles (no milestone), using the numbered step's acceptance criteria in the canonical plan:

    1. Unify Projects layout access and grouped folder expansion
    2. Reuse upstream project headers and actions within custom sections — blocked by 1.
    3. Converge Projects thread rows on upstream row actions and subscriptions — blocked by 2.
    4. Finish the project-view composition boundary and remove duplicate wiring — blocked by 3.

    All children retain #423 / PR #424, the same storage format, hierarchy and controls. Resolve the two presentation questions in the plan before changing either presentation or placement policy. No implementation workers were started.

    Read-only verification: clean main at the pinned revision; nightly ancestry confirmed; source and existing regression assertions inspected. No files, branches, worktrees, live userdata, tests or browser sessions were changed/run.

  3. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    Owner decisions (2026-11-17)

    • Pinning: pinned items stay in their custom section, orchestrators first. Only upstream's pin command is reused.
    • Styling: undecided. The owner wants to see upstream's styling as a test first. A side-by-side capture of the fork's sidebar and upstream nightly's sidebar, with the same data, is being made before the decision.

    The four steps become top-level issues once styling is decided.

  4. tannerpolley commented on Nov 17, 2026

    @tannerpolley
    OwnerAuthor

    Owner decisions, 2026-11-17, made after seeing the fork and upstream nightly sidebars side by side with the same Replay data:

    • Rows: keep the fork's compact one-line rows (role, model, effort bars, time, status) and add upstream's pin icon on pinned threads. Upstream's 78 px cards were not chosen.
    • Pinning: stays in its section, orchestrators first (decided earlier).

    The plan steps are now top-level issues, chained by blocked-by: #444 → #445 → #446 → #447. #442 ("Needs you" and "Ready for review" groups) is blocked by this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions