Skip to content

✨ feat(device): switch device cwd handling to structured workingDirs#15353

Merged
arvinxx merged 1 commit into
canaryfrom
feat/device-working-dirs
Jun 4, 2026
Merged

✨ feat(device): switch device cwd handling to structured workingDirs#15353
arvinxx merged 1 commit into
canaryfrom
feat/device-working-dirs

Conversation

@arvinxx

@arvinxx arvinxx commented May 31, 2026

Copy link
Copy Markdown
Member

πŸ’» Change Type

  • ✨ feat

πŸ”— Related Issue

The DB layer (working_dirs column + WorkingDirEntry) is already on canary (landed via the workspace-id migration batch). This PR is the consumer layer.

πŸ”€ Description of Change

Switch device cwd handling from the flat recentCwds: string[] to workingDirs: WorkingDirEntry[] ({ path, repoType?: 'git' | 'github' }), backed by the working_dirs column already on canary.

  • model / tRPC (updateDevice input, listDevices output): use workingDirs (input capped at 20, validated { path, repoType? })
  • tRPC listDevices: coalesces the nullable working_dirs read to [] so the API contract stays an always-array
  • client deviceCwd: nextRecentCwds β†’ nextWorkingDirs over WorkingDirEntry
  • UI: DeviceWorkingDirectory, WorkingDirectory, DeviceDetailPanel, DeviceItem render the detected repo type via the new shared renderDirIcon

πŸ§ͺ How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed
cd packages/database && bunx vitest run src/models/__tests__/device.test.ts   # 7 passed
bunx vitest run src/features/ChatInput/RuntimeConfig/deviceCwd.test.ts         # 6 passed

πŸ“ Additional Information

  • recent_cwds remains on the table as a @deprecated legacy column; this PR stops reading/writing it. A later cleanup can drop the column.

@arvinxx arvinxx requested review from nekomeowww and tjx666 as code owners May 31, 2026 11:21

@sourcery-ai sourcery-ai 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.

Sorry @arvinxx, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lobehub Ready Ready Preview, Comment Jun 4, 2026 5:13pm

Request Review

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 31, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5bb06bc340

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/database/migrations/0105_device_add_working_dirs.sql Outdated
@codecov

codecov Bot commented May 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 39.21569% with 31 lines in your changes missing coverage. Please review.
βœ… Project coverage is 70.85%. Comparing base (cd171d3) to head (9448742).
⚠️ Report is 2 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #15353      +/-   ##
==========================================
- Coverage   70.85%   70.85%   -0.01%     
==========================================
  Files        3255     3256       +1     
  Lines      321270   321282      +12     
  Branches    29340    29340              
==========================================
+ Hits       227640   227647       +7     
- Misses      93448    93453       +5     
  Partials      182      182              
Flag Coverage Ξ”
app 61.52% <39.21%> (-0.01%) ⬇️
database 92.54% <ΓΈ> (ΓΈ)
packages/agent-manager-runtime 49.69% <ΓΈ> (ΓΈ)
packages/agent-runtime 81.08% <ΓΈ> (ΓΈ)
packages/builtin-tool-lobe-agent 18.52% <ΓΈ> (ΓΈ)
packages/context-engine 84.19% <ΓΈ> (ΓΈ)
packages/conversation-flow 91.29% <ΓΈ> (ΓΈ)
packages/device-gateway-client 90.51% <ΓΈ> (ΓΈ)
packages/eval-dataset-parser 95.15% <ΓΈ> (ΓΈ)
packages/eval-rubric 76.11% <ΓΈ> (ΓΈ)
packages/fetch-sse 85.57% <ΓΈ> (ΓΈ)
packages/file-loaders 87.89% <ΓΈ> (ΓΈ)
packages/memory-user-memory 74.99% <ΓΈ> (ΓΈ)
packages/model-bank 99.99% <ΓΈ> (ΓΈ)
packages/model-runtime 84.51% <ΓΈ> (ΓΈ)
packages/prompts 72.51% <ΓΈ> (ΓΈ)
packages/python-interpreter 92.90% <ΓΈ> (ΓΈ)
packages/ssrf-safe-fetch 0.00% <ΓΈ> (ΓΈ)
packages/types 35.38% <ΓΈ> (ΓΈ)
packages/utils 84.98% <ΓΈ> (ΓΈ)
packages/web-crawler 88.08% <ΓΈ> (ΓΈ)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Ξ”
Store 68.53% <ΓΈ> (ΓΈ)
Services 54.75% <ΓΈ> (ΓΈ)
Server 71.83% <ΓΈ> (+<0.01%) ⬆️
Libs 57.03% <ΓΈ> (ΓΈ)
Utils 81.48% <ΓΈ> (ΓΈ)
πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arvinxx arvinxx force-pushed the feat/device-working-dirs branch from 5bb06bc to b29cd81 Compare May 31, 2026 12:08
@arvinxx arvinxx changed the title ✨ feat(device): store device working directories as structured entries ✨ feat(device): switch device cwd handling to structured workingDirs May 31, 2026
@arvinxx arvinxx changed the base branch from canary to feat/device-working-dirs-schema May 31, 2026 12:08
@arvinxx arvinxx force-pushed the feat/device-working-dirs-schema branch from 8ee8dd8 to 0752b4e Compare May 31, 2026 12:24
@arvinxx arvinxx force-pushed the feat/device-working-dirs branch from b29cd81 to 6ba3300 Compare May 31, 2026 12:25
Consume the `working_dirs` column: model `updateDevice`, tRPC `updateDevice`
input + `listDevices` output, and the client cwd pickers now operate on
`WorkingDirEntry[]` instead of the flat `recentCwds: string[]`.

- model / tRPC: `workingDirs` (input capped at 20, validated `{ path, repoType? }`)
- client `deviceCwd`: `nextRecentCwds` β†’ `nextWorkingDirs`
- UI: DeviceWorkingDirectory / WorkingDirectory / DeviceDetailPanel / DeviceItem
  render the detected repo type via the shared `renderDirIcon`

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@arvinxx arvinxx force-pushed the feat/device-working-dirs branch from 6ba3300 to 9448742 Compare June 4, 2026 17:03
@arvinxx arvinxx changed the base branch from feat/device-working-dirs-schema to canary June 4, 2026 17:03
@arvinxx arvinxx merged commit f5d78d3 into canary Jun 4, 2026
30 of 31 checks passed
@arvinxx arvinxx deleted the feat/device-working-dirs branch June 4, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant