Repository navigation
Commit 4ee49cf
committed
fix(effect): propagate InstanceRef into ScopedCache lookups in InstanceState.get
When InstanceState.make runs during app initialization, InstanceRef
is not yet in scope. ScopedCache captures the Effect context at
construction time, so all subsequent lookups via ScopedCache.get use
stale context without InstanceRef.
This caused downstream issues like project-level skills (.opencode/skills/)
being unavailable in REST API sessions, because Skill.state uses
InstanceState (backed by ScopedCache) and the lookup fell back to
Instance.current (Node ALS), which is empty after the REST middleware
returns.
Fix: eagerly resolve InstanceRef from the calling fiber's context (where
it IS available) and explicitly pipe Effect.provideService(InstanceRef, ctx)
onto the ScopedCache.get call, overriding the stale captured context.
Upstream issue: anomalyco/opencode#25686
Closes #4191 parent 8e29f84 commit 4ee49cf
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
0 commit comments