Skip to content

fix(dashboard): local import misses Devin-desktop logins — add Devin flavor + lift 128KB value cap - #264

Open
Rostopher wants to merge 1 commit into
dwgx:masterfrom
Rostopher:fix/local-import-devin-dir
Open

fix(dashboard): local import misses Devin-desktop logins — add Devin flavor + lift 128KB value cap#264
Rostopher wants to merge 1 commit into
dwgx:masterfrom
Rostopher:fix/local-import-devin-dir

Conversation

@Rostopher

Copy link
Copy Markdown

改了什么 / What changed

「登录取号」页的从本地 Windsurf 导入在只有新 Devin 桌面端(Windsurf 改名后的安装)的机器上找不到任何账号。

  • 之前GET /accounts/import-local 只扫描 Windsurf / Windsurf - Next / Windsurf-Next / Windsurf Insiders 四个数据目录,且单条 state 记录上限 128KB。改名后的 Devin 桌面端把数据放在 %APPDATA%\Devin(macOS ~/Library/Application Support/Devin),扫描全部 not_found;即使手动把目录加进清单,活的 windsurfAuthStatus 实测约 160KB(apiKey + base64 的 userStatus / allowedCommandModelConfigs proto),超过 128KB 上限被静默跳过,导入仍报 0 个账号。
  • 现在:扫描清单加入 Devin flavor(置于首位,旧 Windsurf flavor 保留给老安装);MAX_STATE_VALUE_BYTES 128KB → 512KB 并在注释里写明原因。

为什么 / Why

在一台只装了 Devin 桌面端(无 Devin CLI、无老 Windsurf 目录)的 Windows 机器上实测:导入面板显示四个 state.vscdb — not_found + config.json — not_found + credentials.toml — not_found。逐项排查:

  1. 用户数据实际位于 C:\Users\<u>\AppData\Roaming\Devin\User\globalStorage\state.vscdbwindsurfAuthStatus key 存在且含可用的 devin-session-token$... —— 只是目录名不在 flavors 清单里。
  2. 把目录加进清单后依然 0 账号:该 key 的 value 实测 159,537 字节,被 MAX_STATE_VALUE_BYTES(128KB) 静默丢弃(extractFromStateDbvalue.length > MAX_STATE_VALUE_BYTES 分支无日志)。

两处都是保守上限/清单滞后于上游改名,不涉及协议改动。

测试 / Testing

node --import ./test/setup-env.mjs --test --test-force-exit test/local-windsurf-import.test.js test/local-windsurf-security.test.js
# tests 20
# suites 8
# pass 20
# fail 0

改动后在同一台机器上实测 discoverWindsurfCredentials():找到 1 个账号(source state.vscdb:windsurfAuthStatus,apiKey masked 正确),sources 报告 ok: true。(本地为 Node 22,npm run test:release 的权威门禁由 CI 复跑。)

Checklist

  • 代码风格和现有文件一致 / Code style matches existing files
  • 没有引入 npm 运行时依赖 / No new npm runtime dependencies (project is zero-dep)
  • 测试跑过了,贴了结果 / Tests run, output pasted above
  • 新行为有测试,且断言行为而不是 grep 源码文本 / New behaviour has tests that assert behaviour, not source text
  • 新开关默认关;若默认开,已加进 test/default-on-switch-registry.test.js 台账(未新增开关)
  • 加了开关就同步了文档(未新增开关)
  • 涉及 wire 协议改动时,注明字段号来源(无 wire 改动)
  • 涉及 dashboard UI 用 App.confirm / App.prompt(无 UI 改动)
  • commit message 没有任何 AI 署名尾注Co-Authored-ByGenerated with 等)

…flavor + lift 128KB value cap

- src/dashboard/local-windsurf.js: add 'Devin' to the state.vscdb scan flavors (rebranded desktop app keeps its data dir at %APPDATA%\Devin, so fresh installs were never discovered); raise MAX_STATE_VALUE_BYTES 128KB -> 512KB — live windsurfAuthStatus payloads measure ~160KB (apiKey plus base64 userStatus / allowedCommandModelConfigs protos) and over-cap rows were silently skipped, so the import reported 0 accounts even when the DB was found
- test/local-windsurf-import.test.js: assert the Devin flavor is present in the candidate paths
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