feat(server): realtime handle & migration (#15487)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
  * Retry failed Copilot transcription tasks in real time.
  * Retried tasks resume processing and report updated status.
* Managed Copilot provider models can be omitted to use provider
defaults.

* **Bug Fixes**
* Improved handling of incomplete BYOK profiles, including safe
replacement of legacy records.
  * Duplicate profile creation now returns a clear validation error.
* Improved transcript processing reliability by preventing duplicate or
stale dispatches.

* **Migration**
* Consolidated legacy managed-provider settings while preserving
existing profiles and defaults.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-08-16 08:04:19 +08:00
committed by GitHub
parent ff1e3d9c94
commit 06b3d020fa
27 changed files with 1118 additions and 175 deletions
@@ -1,15 +1,3 @@
DELETE FROM "app_configs"
WHERE "id" IN (
'copilot.providers.openai',
'copilot.providers.cloudflareWorkersAi',
'copilot.providers.fal',
'copilot.providers.gemini',
'copilot.providers.geminiVertex',
'copilot.providers.anthropic',
'copilot.providers.anthropicVertex',
'copilot.providers.defaults'
);
ALTER TABLE "ai_workspace_byok_configs"
ADD COLUMN "definition" JSONB NOT NULL DEFAULT '{}',
ADD COLUMN "revision" INTEGER NOT NULL DEFAULT 1,
@@ -68,5 +56,5 @@ CREATE TABLE "ai_message_artifacts" (
CREATE INDEX "ai_message_artifacts_workspace_id_artifact_id_idx" ON "ai_message_artifacts"("workspace_id", "artifact_id");
-- After stable and beta no longer run binaries built with the 115-migration
-- schema, remove the old provider keys, obsolete local-lease rows, ai_contexts,
-- schema, remove the old provider defaults, obsolete local-lease rows, ai_contexts,
-- ai_context_embeddings, and ai_workspace_embeddings in one cleanup migration.
@@ -0,0 +1,4 @@
-- Nullable so the previous release can keep inserting transcript tasks while
-- both releases share the database.
ALTER TABLE "ai_transcript_tasks"
ADD COLUMN "dispatch_generation" VARCHAR;