Skip to content

Fix dead agents-graveyard test imports in agent-runtime - #1202

Open
nordicnode wants to merge 1 commit into
CodebuffAI:mainfrom
nordicnode:fix-agent-runtime-test-imports
Open

Fix dead agents-graveyard test imports in agent-runtime#1202
nordicnode wants to merge 1 commit into
CodebuffAI:mainfrom
nordicnode:fix-agent-runtime-test-imports

Conversation

@nordicnode

Copy link
Copy Markdown

Problem & Context

Running TypeScript typechecking on packages/agent-runtime (bun run typecheck) failed with 2 compilation errors:

src/__tests__/read-docs-tool.test.ts:17:29 - error TS2307: Cannot find module '../../../../agents-graveyard/researcher/researcher' or its corresponding type declarations.
src/__tests__/web-search-tool.test.ts:17:29 - error TS2307: Cannot find module '../../../../agents-graveyard/researcher/researcher' or its corresponding type declarations.

The agents-graveyard directory was an archived internal path that was never exported to the public repository. Both test suites crashed at import when executed in the public codebase.

Changes Made

  • In packages/agent-runtime/src/__tests__/read-docs-tool.test.ts: Replaced the dead agents-graveyard import with the active public definition from agents/researcher/researcher-docs.ts.
  • In packages/agent-runtime/src/__tests__/web-search-tool.test.ts: Replaced the dead agents-graveyard import with the active public definition from agents/researcher/researcher-web.ts.

Architecture & Conventions Conformance

  • Adheres to Dependency Injection (contracts defined in common/src/types/contracts/, no module monkey patching)
  • Terminal commands use terminalCommandBroker (no direct spawn or TUI-process bypass)
  • Environment hygiene respected (getCliEnv() for CLI, getSdkEnv() for SDK, no forbidden getProcessEnv() imports)
  • Freebuff mode compatibility (IS_FREEBUFF preserved, no paid features introduced)
  • Imports ordered and explicit (import type used for types)

Scope Verification

  • All modified files are within allowed public directories: packages/agent-runtime/src/__tests__/
  • NO modifications to web/, freebuff/web/, packages/internal/, packages/billing/, packages/bigquery/, or packages/build-tools/

Testing & Verification

  • bun run --cwd packages/agent-runtime typecheck passed with 0 errors (was 2 errors).
  • bun test packages/agent-runtime/src/__tests__/read-docs-tool.test.ts packages/agent-runtime/src/__tests__/web-search-tool.test.ts passed 15/15 tests (was failing due to missing module).
  • bun run build:sdk passed cleanly.
  • bun run build:freebuff passed cleanly.
  • bun cli/scripts/smoke-binary.ts cli/bin/freebuff passed cleanly.
  • Anti-flake principles observed.

@codebuff-team

Copy link
Copy Markdown
Contributor

Good catch — agents-graveyard isn't present in the public tree, so these two test files were dead on arrival for anyone running bun run typecheck or the test suite. Given the "graveyard" naming, it's plausible this directory was actually removed upstream too and these two test files were simply missed, which would make this a genuine bug rather than just an export artifact.

The fix itself is minimal and in-scope (packages/agent-runtime/src/__tests__/*), which is exactly the right size for a PR like this.

One thing worth double-checking before this gets ported: in both files you do const researcherAgent = { ...researcherDocsAgent, id: 'researcher' } / { ...researcherWebAgent, id: 'researcher' }. That patches the type error and gets tests green, but it's not obviously equivalent to what the original researcher agent from the graveyard exposed — researcher-docs and researcher-web may have different tool sets, prompts, or behavior than whatever the tests were originally written against. If the assertions in read-docs-tool.test.ts and web-search-tool.test.ts depend on specific agent config (allowed tools, system prompt, etc.), silently swapping in a different agent and overriding just the id field could make the tests pass for the wrong reasons rather than actually validating the intended behavior. Worth a comment in the test file explaining why researcher-docs/researcher-web are the correct stand-ins, or ideally confirming the swapped agent's tool surface matches what the test exercises.

Overall: right instinct, correct scope, small diff — just flag the substitution rationale so a maintainer porting this can verify semantic equivalence rather than just compile success.

@codebuff-team codebuff-team added bot:triaged Classified by the community triage bot pr:port-candidate Worth porting into the private source tree labels Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:triaged Classified by the community triage bot pr:port-candidate Worth porting into the private source tree

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants