Skip to content

fix(app): preserve workspace sessions when path normalization mismatches#1839

Open
Dwij1704 wants to merge 1 commit into
different-ai:devfrom
Dwij1704:fix/1140-workspace-sessions-disappear
Open

fix(app): preserve workspace sessions when path normalization mismatches#1839
Dwij1704 wants to merge 1 commit into
different-ai:devfrom
Dwij1704:fix/1140-workspace-sessions-disappear

Conversation

@Dwij1704
Copy link
Copy Markdown

Summary

  • Extracts the sidebar/settings session-list filter into a shared filterSessionsToWorkspace helper.
  • Makes the filter fail open: if the strict path comparison would empty a non-empty server response, the server's list is returned unchanged and a console.warn is emitted for diagnosis.
  • Replaces the inline filter at both call sites (session-route.tsx, settings-route.tsx).

Why

The openwork server already proxies session listing to the workspace's own OpenCode instance (apps/server/src/server.ts:3010), so the response is already scoped to that workspace. The client-side filter is defensive double-filtering. When workspace.path and session.directory differ in form — resolved vs unresolved symlinks, NFC vs NFD unicode on macOS, trailing separators, case, or path-format changes across app versions — the strict-equality comparison drops every session even though the data is intact. The user experience is "all my workspace sessions disappeared," matching the three variants in #1140.

The filter was introduced in fa3c9c4d ("fix session loading") as a port of the legacy context/workspace.ts::listWorkspaceSessions filter. Failing open preserves its defensive intent against a hypothetical cross-workspace response while no longer hiding the user's data when the comparison drifts.

Issue

Scope

  • apps/app/src/app/lib/session-scope.ts — new filterSessionsToWorkspace helper
  • apps/app/src/react-app/shell/session-route.tsx — sidebar session load
  • apps/app/src/react-app/shell/settings-route.tsx — settings session load
  • apps/app/tests/session-scope-filter.test.ts — 7 bun tests

Out of scope

  • Investigating why paths drift (symlink resolution differences, version-to-version format changes); the fail-open warning gives us telemetry to chase that next.
  • Server-side session listing in apps/server — already correct.

Testing

Ran

  • `bun test apps/app/tests/session-scope-filter.test.ts` — 7 pass / 0 fail
  • `pnpm typecheck` — exit 0
  • `pnpm test:e2e` — exit 0 (`test:local-file-path → e2e → session-switch → fs-engine → browser-entry`)
  • `node scripts/i18n-audit.mjs --ci` — pass

Result

  • pass

CI status

  • pass:
  • code-related failures:
  • external/env/auth blockers:

Manual verification

  1. `pnpm install`
  2. `bun test apps/app/tests/session-scope-filter.test.ts`
  3. `pnpm typecheck`
  4. `pnpm test:e2e`
  5. Open a workspace that previously had sessions; confirm the session list renders. If a path mismatch occurs, check the renderer console for `[openwork] sidebar session list did not match workspace path …` — the sessions still appear and the warning helps trace the underlying path drift.

Evidence

  • No UI-flow change for the happy path (paths already match). Video/screenshot not applicable; the user-visible effect is "session list is no longer empty when the previously-buggy mismatch occurs," which requires reproducing the path drift to capture.
  • Local test output:
    ```
    bun test v1.3.14
    apps/app/tests/session-scope-filter.test.ts:
    7 pass, 0 fail, 13 expect() calls
    ```

Risk

  • Low. Happy path is unchanged (filter still strips truly out-of-scope sessions). The fail-open branch only fires when the strict filter would otherwise yield an empty list from a non-empty server response — same situation that currently shows the user an empty workspace.

Rollback

  • Revert this commit. No data migration, no persisted schema change. The filter reverts to strict equality.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 May 18, 2026 11:20pm

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 18, 2026

@Dwij1704 is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

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.

[Bug]: Workspace sessions disappear or fail to persist after worker switch or update

1 participant