test(core): avoid models cache recovery race (#33525)

This commit is contained in:
Aiden Cline 2026-06-23 11:40:08 -05:00 committed by GitHub
parent e0c0411003
commit a3825286cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -157,15 +157,12 @@ describe("ModelsDev Service", () => {
Effect.gen(function* () {
yield* writeCacheText("{")
const state = yield* Ref.make({ ...initialState, body: JSON.stringify(fixture2) })
const context = yield* Layer.build(buildLayer(state))
const result = yield* Effect.acquireUseRelease(
Effect.sync(() => {
Flag.OPENCODE_DISABLE_MODELS_FETCH = false
}),
() =>
provided(
state,
ModelsDev.Service.use((s) => s.get()),
),
() => ModelsDev.Service.use((s) => s.get()).pipe(Effect.provide(context)),
() =>
Effect.sync(() => {
Flag.OPENCODE_DISABLE_MODELS_FETCH = true