Skip to content

effect: move tool flags into RuntimeFlags#27198

Merged
kitlangton merged 1 commit into
devfrom
effect/runtime-flags-tools
May 13, 2026
Merged

effect: move tool flags into RuntimeFlags#27198
kitlangton merged 1 commit into
devfrom
effect/runtime-flags-tools

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

@kitlangton kitlangton commented May 13, 2026

Summary

  • Adds tool-selection runtime flags to RuntimeFlags using ConfigService definitions.
  • Migrates ToolRegistry tool visibility decisions from direct Flag reads to RuntimeFlags.
  • Migrates WebSearchTool provider selection to use the same RuntimeFlags values as registry visibility.
  • Updates tool registry tests to use explicit RuntimeFlags.layer(...) variants instead of mutating Flag.OPENCODE_EXPERIMENTAL_SCOUT.
  • Provides explicit default RuntimeFlags.layer() in open ToolRegistry.layer test compositions.

Notes

  • I started on OPENCODE_EXPERIMENTAL_WORKSPACES first, but it is too coupled to legacy mutable Flag and closed default layers for a small safe PR. This tool-registry cluster is a smaller step that proves the pattern.
  • No compatibility bridge was added: tests that need different runtime flags now choose a different layer.

Verification

  • bun run test -- test/effect/runtime-flags.test.ts test/tool/registry.test.ts test/tool/websearch.test.ts test/session/snapshot-tool-race.test.ts
  • bunx prettier --check packages/opencode/src/effect/runtime-flags.ts packages/opencode/src/tool/registry.ts packages/opencode/src/tool/websearch.ts packages/opencode/test/effect/runtime-flags.test.ts packages/opencode/test/tool/registry.test.ts packages/opencode/test/session/snapshot-tool-race.test.ts packages/opencode/test/session/prompt.test.ts
  • git diff --check

Simplify review

  • Removed the mutable Flag compatibility bridge.
  • Switched scout tests to explicit layer variants.
  • Reused the local bool(...) helper for all false-default boolean flags.
  • Fixed websearch execution to use the same runtime flags as registry visibility.

Typecheck

bun typecheck currently fails on unrelated provider/tool metadata type issues already present in this worktree dependency state; focused tests pass.

@kitlangton kitlangton force-pushed the effect/runtime-flags-tools branch from 51355ef to 9ef5459 Compare May 13, 2026 01:26
@kitlangton kitlangton force-pushed the effect/runtime-flags-tools branch from 9ef5459 to a3c2b87 Compare May 13, 2026 01:36
@kitlangton kitlangton merged commit da689d7 into dev May 13, 2026
12 checks passed
@kitlangton kitlangton deleted the effect/runtime-flags-tools branch May 13, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant