[codex] Route OpenCode missing-session errors through Effect#3608
[codex] Route OpenCode missing-session errors through Effect#3608StiensWout wants to merge 1 commit into
Conversation
Co-authored-by: Codex <codex@openai.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved This is a mechanical refactor converting thrown exceptions to Effect's typed error channel in You can customize Macroscope's approvability policy. Learn more. |
Summary
main.sendTurnandstopSession.Root cause
OpenCodeAdapterused a synchronous session helper from Effect bodies, so missing or closed sessions threw defects instead of returning typed provider adapter failures.Impact
Missing and already-stopped OpenCode session operations now fail predictably through the typed provider adapter error channel. Existing stop cleanup behavior is preserved for known sessions.
Validation
PATH="$HOME/.vite-plus/bin:$PATH" vp test apps/server/src/provider/Layers/OpenCodeAdapter.test.tsPATH="$HOME/.vite-plus/bin:$PATH" vp checkPATH="$HOME/.vite-plus/bin:$PATH" vp run typecheckvp checkreports the repository's existing unrelated warnings and no errors.Note
Route OpenCode missing-session errors through the typed Effect error channel
ensureSessionContextin OpenCodeAdapter.ts from a synchronous throwing function into anEffect.fngenerator that yields typedProviderAdapterSessionNotFoundErrororProviderAdapterSessionClosedErrorfailures.sendTurn,interruptTurn,stopSession,respondToRequest,respondToUserInput,readThread,rollbackThread) now callyield* ensureSessionContext(...)and surface missing/closed session errors via the typed error channel instead of throwing.sendTurnandstopSessionfail through the typed error channel for non-existent sessions.Macroscope summarized 658754d.
Note
Medium Risk
Changes error propagation on core OpenCode session operations; behavior is more predictable for Effect callers but differs from prior synchronous throws (defects).
Overview
OpenCode adapter session guards no longer throw from inside Effect bodies.
ensureSessionContextis now anEffect.fnthat yieldsProviderAdapterSessionNotFoundErrororProviderAdapterSessionClosedError(usingRef.getfor the stopped flag instead ofRef.getUnsafe).Call sites (
sendTurn,interruptTurn,respondToRequest,respondToUserInput,readThread,rollbackThread) useyield* ensureSessionContext(...).stopSessionreturns the same not-found error viayield*when the thread is absent, instead of throwing.Tests assert that
sendTurnandstopSessionon unknown threads fail withProviderAdapterSessionNotFoundErrorthroughEffect.result, not as defects.Reviewed by Cursor Bugbot for commit 658754d. Bugbot is set up for automated code reviews on this repo. Configure here.