Skip to content

fix(desktop): support manual session ordering across profiles - #88123

Open
MarcoFernstaedt wants to merge 9 commits into
NousResearch:mainfrom
MarcoFernstaedt:fix/87994-sidebar-manual-ordering
Open

MarcoFernstaedt wants to merge 9 commits into
NousResearch:mainfrom
MarcoFernstaedt:fix/87994-sidebar-manual-ordering

Conversation

@MarcoFernstaedt

@MarcoFernstaedt MarcoFernstaedt commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This makes Manual session ordering reachable and safe across Hermes Desktop sidebar views. It preserves existing single profile behavior while adding connection and profile scoped persistence plus strict drag payload validation for supported grouped views.

Related Issue

Addresses #87994. This pull request covers Manual mode reachability and safe session ordering. It does not add independent profile group order customization or redesign drag feedback.

Type of Change

  1. Bug fix
  2. New feature
  3. Security fix
  4. Documentation update
  5. Tests
  6. Refactor
  7. New skill

Changes Made

  1. Always expose Manual ordering in the sidebar filter menu.
  2. Route Manual mode to a compatible reorder surface.
  3. Persist manual session order by connection and profile, with migration from the legacy global order.
  4. Preserve hidden, filtered, pinned, paginated, and not yet loaded order slots during reconciliation.
  5. Accept only the exact rendered root session identifiers and reject duplicate, incomplete, foreign, or stale drag payloads.
  6. Keep branch children attached to their root sessions and nonsortable.
  7. Cover archived sessions through the authoritative active session pool.

PR #84984 covers profile group ordering, which is a separate part of #87994. PR #43661 and PR #70223 are adjacent work around flat lists, pinned rows, and drag behavior. They do not provide this connection and profile scoped persistence or strict payload contract.

How to Test

  1. From apps/desktop, run the six focused sidebar and layout test files listed in this pull request.
  2. Run the complete UI suite, Desktop platform suite, Desktop packaging suite, and plugin tests.
  3. Run type checking, lint, Prettier, and the production build.

Verification on Debian 13 Linux x86_64:

  1. Focused sidebar and layout verification passed 67 tests.
  2. The complete UI suite passed.
  3. The Desktop platform suite passed after installing the Electron binary. An earlier harness run used npm ci --ignore-scripts, which intentionally skipped the Electron installer and produced two import errors; this was dependency provenance, not a source failure.
  4. The Desktop packaging suite and plugin tests passed.
  5. Type checking, lint, Prettier, and the production build passed.
  6. The build stamp records exact candidate 5ddcfb210bf27139e8322f11301dc712e62e5a90 with dirty: false.
  7. Manual Desktop drag interaction was not recorded.

Checklist

Code

  1. I read the Contributing Guide.
  2. The commits follow Conventional Commits.
  3. I searched for existing pull requests and disclosed adjacent work.
  4. This pull request contains only Manual ordering changes.
  5. Governing Desktop tests pass on the exact candidate.
  6. Regression tests cover the changed behavior.
  7. Automated verification ran on Debian 13 Linux x86_64.

Documentation & Housekeeping

  1. User documentation is not affected.
  2. cli-config.yaml.example is not affected.
  3. Architecture and contributor workflow documentation are not affected.
  4. Cross platform impact was considered. The implementation uses existing React, TypeScript, state, and drag contracts.
  5. Tool descriptions and schemas are not affected.

Screenshots / Logs

No screenshot is included because manual Desktop drag interaction was not recorded. Automated component coverage verifies ordering, persistence scope, stale payload rejection, and nonsortable child rows.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) labels Aug 17, 2026
@Enough1122

Copy link
Copy Markdown
Contributor

AI code review — automated review for reference; please use your judgment.

  1. apps/desktop/src/store/layout.ts:setSidebarOrdering — UX nit worth weighing: leaving Manual mode clears $sidebarSessionOrderIdsByProfile entirely, so one accidental sort-key click destroys every profile's hand-picked order at once — a much bigger blast radius than the legacy single-list version had. Suggestion: retain per-profile orders while inactive and only clear when the user re-enters and drags (or add an explicit reset), since the storage cost of keeping them is trivial.

  2. Overall — Positive: this is careful state engineering for a deceptively fiddly feature. Profile-keyed orders with normalized keys solve bare-id collisions between profiles; the legacy global order seeds each profile exactly once as a migration; reorderSubset/reorderProfileSessionOrder fail closed by reference identity on duplicates, foreign ids, stale rendered snapshots, and missing sortable ids — every one of those failure shapes has a test, including the filter→drag→clear-filter and first-page-drag→load-tail lifecycles that usually regress silently. The Manual-in-all-profiles grouping auto-switch (and its scoped-project fallback to date) is also pinned by tests.

@MarcoFernstaedt

Copy link
Copy Markdown
Contributor Author

Thank you. I implemented this in commit 7c16ffcdc100eb047cd9d3bd1d7c61e3f828b7c9.

Switching to another sort mode now leaves $sidebarSessionOrderIdsByProfile intact, so returning to Manual restores each profile's saved order. The legacy global migration list is still cleared, and Reset remains the explicit destructive path. I also added regression coverage for multiple profiles, legacy state, mode switching, and reset behavior.

Verification passed with 68 focused tests, all Desktop TypeScript configurations, ESLint, Prettier, and the diff check.

This branch has not been deployed

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

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants