Skip to content

src/tool/session.ts breaks monorepo typecheck #218

Description

@OpenCodeEngineer

Bug

Running `bun typecheck` from the repo root fails on `packages/opencode/src/tool/session.ts:18` and `:30`:

```
src/tool/session.ts(18,3): error TS2345: Argument of type 'Effect<{ description: string; parameters: Struct<{ readonly title: optional; }>; execute: (params: { readonly title?: string | undefined; }, ctx: Context) => Effect<...>; }, never, Service>' is not assignable to parameter of type 'Effect<Init<Struct<{ readonly title: optional; }>, Metadata>, never, Service>'.
src/tool/session.ts(30,7): error TS2322: Type '(params, ctx) => Effect.Effect<{ title: string; output: string; metadata: {}; }, NamedError.create.result, never>' is not assignable to type '(args, ctx) => Effect<ExecuteResult, never, never>'.
```

`Tool.Def.execute` requires `Effect<ExecuteResult, never, never>`, but the body uses `session.get` which returns `Effect<Info, NotFound>`. The error escapes the execute signature.

Reproduction

```
git checkout dev
bun typecheck
```

Errors appear in `packages/opencode`. This is also what makes `git push` fail via the pre-push hook.

Fix

Pipe the inner `Effect.gen` through `Effect.orDie` — the established pattern across every other tool in `src/tool/` (glob, read, edit, codesearch, autopilot, etc.).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions