Skip to content

refactor: extract Tool Search code controller - #113237

Merged
steipete merged 1 commit into
mainfrom
codex/z-tool-search-extract
Jul 24, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/z-tool-search-extract

Conversation

@steipete

@steipete steipete commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

src/agents/tool-search.ts mixed the host-side Tool Search catalog runtime with a self-contained 7.5 KB child-process controller/model bridge program, making an already oversized owner module harder to navigate and maintain.

Why This Change Was Made

Extract the embedded child program verbatim into tool-search-code-mode-child.ts behind one narrow source-string export. The host runtime still passes the exact same bytes to Node's --eval; no protocol, config, schema, fallback, or runtime behavior changes. This is AI-assisted maintainer-commissioned LOC-reduction work.

The grandfathered max-lines suppression remains: live lint counts 2,157 code lines after extraction against the 700-line limit, so removing it or its baseline entry would weaken/break the ratchet rather than shrink it correctly.

User Impact

No user-visible impact. Tool Search code mode keeps the same sandbox, bridge behavior, error handling, logging, timeout, and IPC protocol while the source ownership is easier to follow.

Evidence

  • LOC: production +250/-254 (net -4); tests +0/-0.
  • Byte golden, before vs. after:
    • child source: 7,546 bytes, SHA-256 02c26ae9023afe85f6d289a5a33fb03a3e6b5832cc89df9920ec16402ead046e
    • generated controller source: 2,795 bytes, SHA-256 592068f1bbff051e5c073462ced3d320ef0eb83ead957420cf6e17761a44fb6c
    • generated sample model source: 100 bytes, SHA-256 e0ae86b3690148471d656abaf12640b4b883094777130dd94f69d860d7c56260
  • node scripts/run-vitest.mjs src/agents/tool-search.test.ts src/agents/tool-search.stream-errors.test.ts — 2 files, 81 tests passed.
  • node scripts/check-changed.mjs -- src/agents/tool-search.ts src/agents/tool-search-code-mode-child.ts — passed on Blacksmith Testbox; typechecks, targeted lint, formatting, ratchets, import-cycle analysis, plugin boundaries, and selected guards green (run 30069913329).
  • Exact-head hosted CI — 57 jobs green on 034d812865bbf2c7422835dbc954d097f3e0c1cb (run 30070641030).
  • Patch-identical rebase onto f479afb589c2f6b9886c0572d3dd8c3a4f431716 — stable patch ID 672b602b3c1edc332eba71e39d1b114b18723df0 before and after.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main ... — clean on the final branch, no accepted/actionable findings.
  • Latest final-head ClawSweeper comment is still a queue placeholder and contains no Rank-up moves: section to apply; fleet status showed 726 OpenClaw reviews pending (comment).
  • git diff --check — passed.

@steipete
steipete marked this pull request as ready for review July 24, 2026 05:43
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Jul 24, 2026
@steipete
steipete force-pushed the codex/z-tool-search-extract branch from 1902a67 to 034d812 Compare July 24, 2026 05:52
@steipete
steipete merged commit 26bed57 into main Jul 24, 2026
129 checks passed
@steipete
steipete deleted the codex/z-tool-search-extract branch July 24, 2026 06:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant