fix(web): surface BYOK migration validation errors - #6280
Conversation
Preserve structured daemon errors during legacy credential migration and reserve offline guidance for fetch failures. Keep legacy browser credentials until migration succeeds, and cover HTTP validation, malformed responses, and network failures. Validated with focused web tests, web typecheck, workspace guard, and workspace typecheck.
|
ℹ️ The |
|
🧪 This PR has changes that need a manual QA pass before merge — please hold off self-merging for now; we'll loop QA in once it's merge-ready (and design/product have signed off, where applicable). |
mrcfps
left a comment
There was a problem hiding this comment.
@app/open-design-crew I verified the legacy BYOK migration path now preserves the daemon’s structured validation message, reserves the offline guidance for fetch failures, and keeps browser-stored credentials intact until migration succeeds. The full config test file passes (71 tests), along with web typecheck, repository guard, full workspace typecheck, and diff checks. Thanks for the careful error classification and focused regression coverage—this is a solid, user-helpful fix. 🙌
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.Map secure-profile HTTP and network failures to semantic error codes before emitting settings_byok_test_result, while preserving existing fallback behavior for unrelated connection-test errors. Validated with the complete web test suite, web typecheck, workspace typecheck, guard, and git diff --check.
QA 验收通过已在 PR head
QA 结论:通过,可合并。 备注:本记录为 QA 验收结论,不代替 maintainer 的代码 review approval。 |
AmyShang-alt
left a comment
There was a problem hiding this comment.
QA verified on PR head fcbfa54. Legacy BYOK HTTP 400 errors surface the daemon validation message, offline guidance is reserved for network failures, and regression/CI checks are green.
|
Successfully created backport PR for |
* fix(web): surface BYOK migration validation errors Preserve structured daemon errors during legacy credential migration and reserve offline guidance for fetch failures. Keep legacy browser credentials until migration succeeds, and cover HTTP validation, malformed responses, and network failures. Validated with focused web tests, web typecheck, workspace guard, and workspace typecheck. * fix(web): stabilize BYOK persistence error telemetry Map secure-profile HTTP and network failures to semantic error codes before emitting settings_byok_test_result, while preserving existing fallback behavior for unrelated connection-test errors. Validated with the complete web test suite, web typecheck, workspace typecheck, guard, and git diff --check. --------- (cherry picked from commit 4a6c2da) Co-authored-by: open-design-crew[bot] <299007234+open-design-crew[bot]@users.noreply.github.com> Co-authored-by: Cheems <94773058+itscheems@users.noreply.github.com>




























































Fixes #6279
Why
Use case: While validating the Codex plugin flow added in #6055, an existing legacy BYOK configuration failed its automatic secure-profile migration during startup.
Pain: The daemon returned a safe, actionable HTTP 400 validation reason, but the web client discarded it and told the user that the local daemon might be offline. That false diagnosis prevents the user from correcting the legacy field and leaves the credential in browser storage until migration can succeed. Because #6055 was backported by #6262, the same bug is present on the pre-tag release/v0.17.0 branch.
What users will see
When legacy BYOK migration receives an HTTP error from the daemon, the startup toast shows the daemon's concrete validation reason. The generic offline message is now reserved for network failures where the daemon could not be reached. Failed migrations continue to preserve the legacy browser credential until a later migration succeeds.
Surface area
apps/weborapps/desktop(including Electron menu bar)odsubcommand or flag, newtools-dev/tools-packflag, or newOD_*env var/api/*endpoint, new SSE event, or changed shape inpackages/contractsskills/,design-systems/,design-templates/, orcraft/, or change to the skills protocolTRANSLATIONS.mdfor the locale workflow)package.json(dependenciesordevDependencies); workspace-packagepackage.jsonfiles are out of scope. Include a paragraph on what we get vs. what bytes we ship (seeCONTRIBUTING.md→ Code style)Screenshots
Not applicable.
Bug fix verification
apps/web/tests/state/config.test.tsmain: yesBYOK baseUrl...validation message and receivedFailed to save BYOK credential (400). The same spec and the HTTP-fallback/network-classification coverage pass on this branch.Validation
mise exec -- pnpm --filter @open-design/web exec vitest run -c vitest.config.ts tests/state/config.test.ts -t "surfaces the daemon validation reason|keeps the HTTP status fallback|classifies fetch rejection"mise exec -- pnpm --filter @open-design/web exec vitest run -c vitest.config.ts tests/state/config.test.tsmise exec -- pnpm --filter @open-design/web exec vitest run -c vitest.config.ts tests/components/App.project-create-race.test.tsxmise exec -- pnpm --filter @open-design/web typecheckmise exec -- pnpm guardmise exec -- pnpm typecheckgit diff --checkAdjacent issues
/api/byok/profiles; no Vela change is required for this bug.