Skip to content

Commit affc1c0

Browse files
committed
fix rebase
1 parent 16344e5 commit affc1c0

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

packages/opencode/src/session/prompt.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ import { NamedError } from "@opencode-ai/shared/util/error"
3636
import { SessionProcessor } from "./processor"
3737
import { Tool } from "@/tool"
3838
import { Permission } from "@/permission"
39+
import { Instance } from "@/project/instance"
3940
import { SessionStatus } from "./status"
4041
import { LLM } from "./llm"
4142
import { Shell } from "@/shell/shell"
4243
import { AppFileSystem } from "@opencode-ai/shared/filesystem"
4344
import { Truncate } from "@/tool"
4445
import { decodeDataUrl } from "@/util/data-url"
4546
import { Process } from "@/util"
46-
import { Cause, Effect, Exit, Layer, Option, Scope, Context } from "effect"
47+
import { Cause, Effect, Exit, Fiber, Layer, Option, Scope, Context } from "effect"
4748
import { EffectLogger } from "@/effect"
4849
import { InstanceState } from "@/effect"
4950
import { TaskTool, type TaskPromptOps } from "@/tool/task"
@@ -986,19 +987,20 @@ NOTE: At any point in time through this workflow you should feel free to ask the
986987

987988
let retried = false
988989
let reason: SandboxSpawn.RetryReason | undefined
989-
let result
990-
try {
991-
result = yield* exec(proactive ? raw : call)
992-
} catch (error) {
990+
let result: { code: number; stderr: string }
991+
const first = yield* exec(proactive ? raw : call).pipe(Effect.exit)
992+
if (Exit.isFailure(first)) {
993+
const error = Cause.squash(first.cause)
993994
if (rejected && !proactive && sandbox.active) {
994995
const message = error instanceof Error ? error.message : String(error)
995996
throw new Error(
996997
`Explicit unsandboxed request was rejected; sandboxed fallback failed before command start: ${message}`,
997998
error instanceof Error ? { cause: error } : undefined,
998999
)
9991000
}
1000-
throw error
1001+
return yield* Effect.failCause(first.cause)
10011002
}
1003+
result = first.value
10021004

10031005
if (!proactive) {
10041006
reason = SandboxSpawn.retryReason({

0 commit comments

Comments
 (0)