Skip to content

refactor(app): list sessions through opencode SDK - #4192

Merged
benjaminshafii merged 1 commit into
devfrom
thin/app-native-session-list
Aug 28, 2026
Merged

benjaminshafii merged 1 commit into
devfrom
thin/app-native-session-list

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

Stack

Stacked on #4191 → #4190 → #4189 → #4188. Review only commit ec4d8bf7 / the diff against thin/headless-threads-opencode-sdk.

Why

The app still replaced the SDK’s native session.list with an OpenWork wrapper endpoint and separately called OpenworkServerClient.listSessions in both route loaders. This removes that duplication while leaving get/messages/todo/snapshot/delete/abort for the next isolated PR.

What changed

  • Removed the custom session.list override and old-server fallback from app/lib/opencode.ts.
  • Removed OpenworkServerClient.listSessions; no production callers remain.
  • Added one listRouteSessions helper that:
    • uses endpoint.opencodeBaseUrl from the existing workspace endpoint source of truth
    • authenticates with the resolved local/remote OpenWork token
    • calls native SDK session.list({limit: 200})
    • preserves HTTP status/error code metadata used by retry and remote diagnostics
  • Migrated both loaders:
    • background sidebar workspace loads
    • Settings route multi-workspace loads
  • Preserved retries, local directory defense-in-depth filtering, pending-session merge, remote connection diagnostics, and connection-state messaging.
  • Tests inject only the transport operation, avoiding Bun’s global SDK module mock leaking across the full suite; production defaults to the native SDK transport.
  • Server session routes remain for unmigrated consumers.

Verification

  • Focused route/workspace suite — 21 pass / 0 fail
  • Workspace session load-budget eval — 1 pass / 0 fail
  • pnpm --filter @openwork/app typecheck — pass
  • pnpm --filter @openwork/app build — pass (6704 modules)
  • Full app suite — 1066 pass / 5 fail. The five failures are the existing unrelated global-mock/browser fixtures (Connect inventory, cloud overlay matchMedia, provider-auth mock, extensions header matchMedia). Before making tests transport-injected, the new list tests added two failures; after the fix, no list tests fail in the full suite. Hosted CI must be green.
  • git diff --check — pass

Coverage

  • local mounted opencode URL + local token
  • remote owning-worker URL, server-side workspace ID, and remote token
  • bare native session-array shape
  • retry after native 503 with status/code preservation
  • endpoint URL/token resolution for local and remote workspaces
  • fixed limit=200 load budget

@vercel

vercel Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview Aug 28, 2026 7:01pm
openwork-den Ready Ready Preview Aug 28, 2026 7:01pm
openwork-diagnostics Ready Ready Preview Aug 28, 2026 7:01pm
openwork-landing Ready Ready Preview, v0 Aug 28, 2026 7:01pm

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (cce5b3b05a0f673e3f188af7fbda18f588b70b25). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Deploying openwork with  Cloudflare Pages  Cloudflare Pages

Latest commit: f32b841
Status: ✅  Deploy successful!
Preview URL: https://0ac734bd.openwork.pages.dev
Branch Preview URL: https://thin-app-native-session-list.openwork.pages.dev

View logs

diff-warden[bot]
diff-warden Bot previously approved these changes Aug 28, 2026

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (f21e6507045216b05c267b4f4bd8f15492319458). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (97ff7f9889db30a35703598d7ded29f46dd4d4b4). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

Base automatically changed from thin/headless-threads-opencode-sdk to dev August 28, 2026 19:00

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (f32b841c15adc9f965b6c69ccbf3ab3409e508b4). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@benjaminshafii
benjaminshafii merged commit 51176e9 into dev Aug 28, 2026
19 checks passed

This branch was successfully deployed

4 active deployments
Preview – openwork-landing — f32b841c Deployed Aug 28, 2026 by vercel[bot]
Preview – openwork-den — f32b841c Deployed Aug 28, 2026 by vercel[bot]
Preview – openwork-app — f32b841c Deployed Aug 28, 2026 by vercel[bot]
Preview – openwork-diagnostics — f32b841c Deployed Aug 28, 2026 by vercel[bot]
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