Skip to content

fix(opencode): remove broken codesearch tool#505

Merged
Astro-Han merged 1 commit intodevfrom
codex/i477-remove-codesearch
May 8, 2026
Merged

fix(opencode): remove broken codesearch tool#505
Astro-Han merged 1 commit intodevfrom
codex/i477-remove-codesearch

Conversation

@Astro-Han
Copy link
Copy Markdown
Owner

Summary

  • Removes the broken upstream codesearch tool from PawWork's opencode runtime, registry, permissions, CLI rendering, SDK/OpenAPI schema, and app/UI display surfaces.
  • Keeps web search intact while deleting the stale Exa code-search tool path that called the removed get_code_context_exa MCP method.
  • Cleans the Effect migration checklist and focused tests so future sync work does not try to migrate or expose codesearch again.

Why

#477 tracks PawWork's upstream opencode sync after 17701628bd. Upstream opencode removed codesearch in anomalyco/opencode#24992 because Exa MCP no longer provides get_code_context_exa, which made the tool fail at runtime. PR #504 intentionally split this deletion out from the runtime safety PR because the local surface spans runtime, generated API types, app settings text, and UI rendering.

Related Issue

Refs #477

Human Review Status

Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.

Review Focus

  • Confirm the tool is no longer registered or exposed through permission config, generated schema, CLI rendering, or UI display code.
  • Confirm websearch remains unchanged and still gated by the existing web search setting.
  • Confirm historical or unknown codesearch tool parts will fall back to the generic renderer rather than keeping a dedicated broken-tool display path.

Risk Notes

Deletion behavior: existing configs that mention permission.codesearch will now be treated as an unknown permission key by the catchall config parser, but no built-in tool can use it. No dependency, lockfile, desktop packaging, Effect foundation, HttpApi listener, or workflow changes are included.

How To Verify

Dependency install: bun install --frozen-lockfile completed in this fresh worktree with no lockfile changes
Red test: registry test failed while production still exposed codesearch
Focused registry test: 19 passed after removal
Residual scan: only negative registry-test assertions mention codesearch
opencode typecheck: passed
ui typecheck: passed
app typecheck: passed
git diff --check: passed
OpenAPI JSON parse: ok

Screenshots or Recordings

Not applicable. This removes a broken tool surface; there is no intended visible workflow besides removing stale labels for a tool that can no longer run.

Checklist

  • Human review status is stated above as pending, approved, or not required
  • I linked the related issue, or stated why there is no issue
  • This PR has type, primary area, and priority labels, or I requested maintainer labeling
  • I described the review focus and any meaningful risks
  • I listed the relevant verification steps and the key result for each
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant
  • I reviewed the final diff for unrelated changes and suspicious dependency changes
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

@Astro-Han Astro-Han added bug Something isn't working P1 High priority upstream Tracked upstream or vendor behavior harness Model harness, prompts, tool descriptions, and session mechanics labels May 8, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the codesearch tool from the codebase. The changes involve deleting the tool's implementation and documentation, removing its references from permission configurations, CLI commands, and the tool registry, and updating the UI and SDK to exclude codesearch related logic and translations. I have no feedback to provide.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c25743d3-db0c-4801-abea-ac7b5091f179

📥 Commits

Reviewing files that changed from the base of the PR and between 24809a7 and f1dd92f.

⛔ Files ignored due to path filters (2)
  • packages/opencode/test/tool/__snapshots__/parameters.test.ts.snap is excluded by !**/*.snap
  • packages/sdk/js/src/v2/gen/types.gen.ts is excluded by !**/gen/**
📒 Files selected for processing (33)
  • packages/app/src/i18n/en.ts
  • packages/app/src/i18n/zh.ts
  • packages/opencode/specs/effect-migration.md
  • packages/opencode/src/agent/agent.ts
  • packages/opencode/src/cli/cmd/run.ts
  • packages/opencode/src/config/permission.ts
  • packages/opencode/src/tool/codesearch.ts
  • packages/opencode/src/tool/codesearch.txt
  • packages/opencode/src/tool/question.txt
  • packages/opencode/src/tool/registry.ts
  • packages/opencode/test/tool/registry.test.ts
  • packages/sdk/openapi.json
  • packages/ui/src/components/message-part.tsx
  • packages/ui/src/components/tool-error-card.stories.tsx
  • packages/ui/src/components/tool-error-card.tsx
  • packages/ui/src/components/tool-info.ts
  • packages/ui/src/i18n/ar.ts
  • packages/ui/src/i18n/br.ts
  • packages/ui/src/i18n/bs.ts
  • packages/ui/src/i18n/da.ts
  • packages/ui/src/i18n/de.ts
  • packages/ui/src/i18n/en.ts
  • packages/ui/src/i18n/es.ts
  • packages/ui/src/i18n/fr.ts
  • packages/ui/src/i18n/ja.ts
  • packages/ui/src/i18n/ko.ts
  • packages/ui/src/i18n/no.ts
  • packages/ui/src/i18n/pl.ts
  • packages/ui/src/i18n/ru.ts
  • packages/ui/src/i18n/th.ts
  • packages/ui/src/i18n/tr.ts
  • packages/ui/src/i18n/zh.ts
  • packages/ui/src/i18n/zht.ts
💤 Files with no reviewable changes (29)
  • packages/ui/src/components/tool-info.ts
  • packages/ui/src/i18n/th.ts
  • packages/app/src/i18n/en.ts
  • packages/ui/src/components/tool-error-card.tsx
  • packages/ui/src/components/message-part.tsx
  • packages/ui/src/i18n/zh.ts
  • packages/ui/src/i18n/da.ts
  • packages/opencode/src/agent/agent.ts
  • packages/ui/src/i18n/es.ts
  • packages/ui/src/i18n/de.ts
  • packages/app/src/i18n/zh.ts
  • packages/ui/src/i18n/br.ts
  • packages/opencode/src/config/permission.ts
  • packages/ui/src/i18n/bs.ts
  • packages/ui/src/i18n/fr.ts
  • packages/opencode/src/tool/codesearch.txt
  • packages/ui/src/i18n/no.ts
  • packages/opencode/src/tool/registry.ts
  • packages/ui/src/i18n/ko.ts
  • packages/ui/src/i18n/ru.ts
  • packages/ui/src/i18n/tr.ts
  • packages/ui/src/i18n/ja.ts
  • packages/ui/src/i18n/zht.ts
  • packages/ui/src/i18n/pl.ts
  • packages/opencode/specs/effect-migration.md
  • packages/ui/src/i18n/en.ts
  • packages/ui/src/i18n/ar.ts
  • packages/opencode/src/tool/codesearch.ts
  • packages/opencode/src/cli/cmd/run.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (2)
packages/opencode/**/*.ts

📄 CodeRabbit inference engine (packages/opencode/AGENTS.md)

packages/opencode/**/*.ts: Use Effect.gen(function* () { ... }) for Effect composition
Use Effect.fn("Domain.method") for named/traced effects and Effect.fnUntraced for internal helpers; these accept pipeable operators as extra arguments to avoid unnecessary outer .pipe() wrappers
Use Effect.callback for callback-based APIs
Prefer DateTime.nowAsDate over new Date(yield* Clock.currentTimeMillis) when you need a Date in Effect code
Use Schema.Class for multi-field data in Effect schemas
Use branded schemas (Schema.brand) for single-value types in Effect
Use Schema.TaggedErrorClass for typed errors in Effect schemas
Use Schema.Defect instead of unknown for defect-like causes in Effect code
In Effect.gen / Effect.fn, prefer yield* new MyError(...) over yield* Effect.fail(new MyError(...)) for direct early-failure branches
Use makeRuntime from src/effect/run-service.ts for all services; it returns { runPromise, runFork, runCallback } backed by a shared memoMap that deduplicates layers
Use InstanceState from src/effect/instance-state.ts for per-directory or per-project state that needs per-instance cleanup; do work directly in the InstanceState.make closure where ScopedCache handles run-once semantics
Use Effect.addFinalizer or Effect.acquireRelease inside the InstanceState.make closure for cleanup (subscriptions, process teardown, etc.)
Use Effect.forkScoped inside the InstanceState.make closure for background stream consumers — the fiber is interrupted when the instance is disposed
Prefer FileSystem.FileSystem instead of raw fs/promises for effectful file I/O in Effect services
Prefer ChildProcessSpawner.ChildProcessSpawner with ChildProcess.make(...) instead of custom process wrappers in Effect services
Prefer HttpClient.HttpClient instead of raw fetch in Effect services
Prefer Path.Path, Config, Clock, and DateTime services when those concerns are already inside Effect code
For backgroun...

Files:

  • packages/opencode/test/tool/registry.test.ts
packages/opencode/test/**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (packages/opencode/test/AGENTS.md)

packages/opencode/test/**/*.test.{ts,tsx}: Use the tmpdir function from fixture/fixture.ts to create temporary directories for tests with automatic cleanup. Use await using syntax to ensure automatic cleanup when the variable goes out of scope.
When using the tmpdir function with git repository support, pass the git: true option to initialize a git repo with a root commit.
Use the config option in tmpdir to write an opencode.json config file during test setup by passing a partial Config.Info object.
Use the init option in tmpdir to define custom setup functions that can return extra data accessible via tmp.extra, and use the dispose option for custom cleanup logic.
Use testEffect(...) from test/lib/effect.ts for tests that exercise Effect services or Effect-based workflows.
Use it.effect(...) when the test should run with TestClock and TestConsole. Use it.live(...) when the test depends on real time, filesystem mtimes, child processes, git, locks, or other live OS behavior.
Prefer Effect-aware helpers from fixture/fixture.ts over building manual runtimes in tests: use tmpdirScoped() for scoped temp directories, provideInstance(dir)(effect) for low-level binding without directory creation, provideTmpdirInstance(...) for single temp instance binding, or provideTmpdirServer(...) for tests that also need the test LLM server.
Define const it = testEffect(...) near the top of the test file and keep the test body inside Effect.gen(function* () { ... }). Yield services directly with yield* MyService.Service or yield* MyTool.
Avoid custom ManagedRuntime, attach(...), or ad hoc run(...) wrappers in Effect tests when testEffect(...) already provides the runtime.
When a test needs instance-local state, prefer provideTmpdirInstance(...) or provideInstance(...) over manual Instance.provide(...) inside Promise-style tests.

Files:

  • packages/opencode/test/tool/registry.test.ts
🧠 Learnings (2)
📚 Learning: 2026-05-06T11:18:14.761Z
Learnt from: Astro-Han
Repo: Astro-Han/pawwork PR: 460
File: packages/ui/src/components/sheet.stories.tsx:1-1
Timestamp: 2026-05-06T11:18:14.761Z
Learning: In the pawwork repo, all Storybook story files under packages/ui/src/components/ use a file-wide // ts-nocheck suppression by convention. Do not flag or nitpick this suppression during reviews. A dedicated PR is planned to migrate ~53 files to typed Meta<T> / StoryObj<typeof meta> patterns. This convention applies to current and newly added stories within that directory (including subdirectories). When reviewing, accept the ts-nocheck suppression for these files and focus on other issues; only flag story files outside this convention. After migration is completed, ensure the repository maintains the new Meta/StoryObj typing guidance.

Applied to files:

  • packages/ui/src/components/tool-error-card.stories.tsx
📚 Learning: 2026-04-23T08:51:00.819Z
Learnt from: Astro-Han
Repo: Astro-Han/pawwork PR: 186
File: packages/opencode/test/plugin/workspace-adaptor.test.ts:139-144
Timestamp: 2026-04-23T08:51:00.819Z
Learning: For pawwork tests under packages/opencode/test/**, auth.json teardown may intentionally combine `Filesystem.write` (from `packages/opencode/src/util/filesystem.ts`) with `node:fs/promises` `unlink` for cleanup. Do not flag this as inconsistent style; it is the established/intentional pattern because `Filesystem` does not provide a `remove`/`unlink` helper.

Applied to files:

  • packages/opencode/test/tool/registry.test.ts
🔇 Additional comments (5)
packages/ui/src/components/tool-error-card.stories.tsx (1)

71-71: Good alignment of Storybook controls with current tool set.

Replacing codesearch with websearch in the tool options keeps the story controls consistent with supported tools and the samples list.

packages/opencode/src/tool/question.txt (1)

20-20: Text update correctly aligns with tool deprecation scope.

Line 20 now avoids the removed codesearch reference and points users to supported discovery paths (explore agent / search tools), which matches this PR’s intent.

packages/sdk/openapi.json (1)

11154-11215: Permission schema update aligns with tool removal plan.

PermissionConfig now models websearch/webfetch/question and no longer carries codesearch, while preserving unknown-key compatibility via additionalProperties. This matches the PR objective and avoids breaking older configs.

packages/opencode/test/tool/registry.test.ts (2)

552-561: LGTM — clean regression guard for the codesearch removal.

The test correctly mirrors the pattern used by the lsp-exclusion tests (no withMockedConfigInstall wrapper needed for built-in tool absence) and will catch any accidental re-registration of codesearch in ToolRegistry.


605-629: LGTM — description and added assertion accurately reflect the codesearch removal.

The renamed description is precise, and expect(ids).not.toContain("codesearch") at Line 623 provides an integration-level safety net that ToolRegistry.tools() never surfaces the removed tool on any provider path.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Web Fetch and Web Search tools are now available as primary tools.
  • Removed Features

    • Code Search tool has been deprecated and removed.
  • Documentation

    • Updated tool instructions and guidance to recommend Web Search as an alternative for exploration tasks.
  • Localization

    • Updated translations across all supported languages to reflect tool changes.

Walkthrough

This PR removes the CodeSearch tool entirely and replaces it with WebFetch and WebSearch tools. Changes span permission configuration, tool registry, CLI dispatch, UI components, and localization across 17 languages.

Changes

CodeSearch Tool Removal & WebFetch/WebSearch Migration

Layer / File(s) Summary
Permission Schema & Configuration
packages/opencode/src/config/permission.ts, packages/sdk/openapi.json, packages/app/src/i18n/...
Permission configuration schema updated to remove codesearch and add question, webfetch, and websearch as explicit typed fields in both InputObject and InfoZod schemas. OpenAPI schema replaced codesearch key with websearch. App i18n updated with new permission tool descriptions for webfetch and websearch.
Tool Implementation & Registry
packages/opencode/src/tool/codesearch.ts, packages/opencode/src/tool/codesearch.txt, packages/opencode/src/tool/registry.ts
Entire codesearch tool module deleted (62 lines). Registry refactored to remove CodeSearchTool import and instantiation, add WebFetchTool/WebSearchTool initialization. Built-in tools updated to drop tool.code and conditionally include tool.search based on webSearchEnabled(). Provider filtering updated to replace CodeSearchTool availability gate with WebSearchTool gate.
CLI & Agent Integration
packages/opencode/src/cli/cmd/run.ts, packages/opencode/src/agent/agent.ts, packages/opencode/src/tool/question.txt
CLI removes CodeSearchTool import and codesearch dispatch case. Explore agent permission defaults updated to remove codesearch and add bash, webfetch, websearch as allowed actions. Question tool instructions updated to recommend search tools instead of codesearch.
UI Components & Tool Rendering
packages/ui/src/components/message-part.tsx, packages/ui/src/components/tool-info.ts, packages/ui/src/components/tool-error-card.tsx, packages/ui/src/components/tool-error-card.stories.tsx
Message-part removes codesearch case from getToolInfo switch and deletes codesearch ToolRegistry registration. Tool-info adds webfetch and websearch cases with window-cursor icon and subtitle from input.url/query. Error card removes codesearch from tool translation map and Storybook story updates options to exclude codesearch and include websearch.
UI Internationalization
packages/ui/src/i18n/ar.ts, packages/ui/src/i18n/br.ts, packages/ui/src/i18n/bs.ts, packages/ui/src/i18n/da.ts, packages/ui/src/i18n/de.ts, packages/ui/src/i18n/en.ts, packages/ui/src/i18n/es.ts, packages/ui/src/i18n/fr.ts, packages/ui/src/i18n/ja.ts, packages/ui/src/i18n/ko.ts, packages/ui/src/i18n/no.ts, packages/ui/src/i18n/pl.ts, packages/ui/src/i18n/ru.ts, packages/ui/src/i18n/th.ts, packages/ui/src/i18n/tr.ts, packages/ui/src/i18n/zh.ts, packages/ui/src/i18n/zht.ts
All 17 language files remove ui.tool.codesearch translation entries. Several languages (bs, de, es, tr, zh) also add new tool label translations for ui.tool.grep, ui.tool.webfetch, and ui.tool.websearch.
Tests & Documentation
packages/opencode/test/tool/registry.test.ts, packages/opencode/specs/effect-migration.md
New test added to verify codesearch tool is not registered when broken. Existing websearch test description updated to clarify behavior for non-opencode providers. Effect migration documentation removes codesearch.ts from pending-migrations checklist.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Astro-Han/pawwork#270: Related through shared removal/rewiring of codesearch tool and addition of webfetch/websearch across registry, permissions, tool files, and i18n.
  • Astro-Han/pawwork#271: Related through continuation of the same CodeSearch → WebSearch/WebFetch migration across permissions, tool registry, UI, and i18n.

Poem

🐰 The old Code Search hops away,
Web tools arrive to save the day,
Registry rewired with gleeful care,
Seventeen tongues sing translations fair,
One tool gone, two tools born anew,
The rabbit's work is finally through! 🌐

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main change: removing the broken codesearch tool from the opencode system.
Description check ✅ Passed The PR description is comprehensive and follows the template structure with all major sections completed including Summary, Why, Related Issue, Review Focus, Risk Notes, and verification steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/i477-remove-codesearch

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Astro-Han Astro-Han merged commit a3d978c into dev May 8, 2026
22 checks passed
@Astro-Han Astro-Han deleted the codex/i477-remove-codesearch branch May 8, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working harness Model harness, prompts, tool descriptions, and session mechanics P1 High priority upstream Tracked upstream or vendor behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant