Skip to content

v1 TestWorkerAgent writes into codeframe repo instead of target workspace #380

@frankbria

Description

@frankbria

Problem

codeframe/agents/test_worker_agent.py hardcodes its output directory to the codeframe repo itself:

# Line 74
self.project_root = Path(__file__).parent.parent.parent
self.tests_dir = self.project_root / "tests"

This means any time the test worker agent runs — even for a completely different project — it writes files into codeframe/tests/. The most visible symptom is tests/test_new_feature.py reappearing after deletion, because the fallback test name is hardcoded:

# Line 262
test_name = "test_new_feature"  # default when task description can't be parsed

Impact

  • tests/test_new_feature.py keeps reappearing (deleted 3-4 times, keeps coming back)
  • The agent could silently overwrite real test files in the codeframe repo
  • Violates v2 architecture rule: agents should operate on the target workspace, not the tool's own repo

Root Cause

TestWorkerAgent is v1 legacy code that predates the v2 workspace architecture. It doesn't accept a Workspace parameter — it uses Path(__file__) to find its output directory.

Affected files

  • codeframe/agents/test_worker_agent.py — hardcoded project_root and tests_dir
  • codeframe/agents/worker_agent.py — parent class, also v1 legacy
  • codeframe/agents/agent_pool_manager.py — only consumer of TestWorkerAgent

Suggested Fix

Two options (not mutually exclusive):

  1. Quick fix: Make TestWorkerAgent.__init__ accept a project_root parameter instead of deriving it from __file__. Fall back to current behavior only if not provided.

  2. Proper fix: Since this is v1 legacy code not used by the Golden Path, consider marking it deprecated or removing it entirely. The v2 ReactAgent handles test generation as part of its general execution flow.

Workaround

tests/test_new_feature.py has been added to .gitignore so it won't show up in git status anymore.

Labels

  • bug
  • v1-legacy

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions