refactor(core): move database schema ownership (#29068)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Dax
2026-05-30 21:08:38 -04:00
committed by GitHub
co-authored by copilot-swe-agent[bot]
parent 6bcb9cb9bb
commit 7f571d36ea
390 changed files with 11127 additions and 9164 deletions
+5 -4
View File
@@ -1,4 +1,5 @@
import type { NamedError } from "@opencode-ai/core/util/error"
import { SessionLegacy } from "@opencode-ai/core/session/legacy"
import { Cause, Clock, Duration, Effect, Schedule } from "effect"
import { MessageV2 } from "./message-v2"
import { iife } from "@/util/iife"
@@ -31,7 +32,7 @@ function cap(ms: number) {
return Math.min(ms, RETRY_MAX_DELAY)
}
export function delay(attempt: number, error?: MessageV2.APIError) {
export function delay(attempt: number, error?: SessionLegacy.APIError) {
if (error) {
const headers = error.data.responseHeaders
if (headers) {
@@ -66,8 +67,8 @@ export function delay(attempt: number, error?: MessageV2.APIError) {
export function retryable(error: Err, provider: string) {
// context overflow errors should not be retried
if (MessageV2.ContextOverflowError.isInstance(error)) return undefined
if (MessageV2.APIError.isInstance(error)) {
if (SessionLegacy.ContextOverflowError.isInstance(error)) return undefined
if (SessionLegacy.APIError.isInstance(error)) {
const status = error.data.statusCode
// 5xx errors are transient server failures and should always be retried,
// even when the provider SDK doesn't explicitly mark them as retryable.
@@ -183,7 +184,7 @@ export function policy(opts: {
const retry = retryable(error, opts.provider)
if (!retry) return Cause.done(meta.attempt)
return Effect.gen(function* () {
const wait = delay(meta.attempt, MessageV2.APIError.isInstance(error) ? error : undefined)
const wait = delay(meta.attempt, SessionLegacy.APIError.isInstance(error) ? error : undefined)
const now = yield* Clock.currentTimeMillis
yield* opts.set({
attempt: meta.attempt,