Skip to content

tech debt: optimize_agents is forked into two modules sharing one import name, with a test each #14873

Open

Description

@mrveiss

Found while fixing #14518.

optimize_agents exists twice, forked, with a separate test file each:

copy shape test
autobot-infrastructure/shared/scripts/optimize_agents.py function-based process_agent_files, atomic writes, dry-run guard (#14546) scripts/optimize_agents_test.py
autobot-infrastructure/shared/scripts/utilities/optimize_agents.py older class-based AgentOptimizer scripts/utilities/optimize_agents_test.py

Neither is deleted here, per "consolidate, never fork — measure before picking
the survivor". This issue is the measurement and the survivor decision.

Why it is not merely cosmetic

Both modules want the top-level name optimize_agents. In a shared pytest
process the first one imported binds sys.modules["optimize_agents"] — and
scripts/optimize_agents_test.py:51 does exactly that binding explicitly. The
sibling test was routed through the utilities. namespace in the #14518 pass
specifically so the two cannot collide, but that is a containment measure, not
a fix: whichever module loses the race would otherwise have its tests run
against the other implementation and pass.

That is the same failure shape as the rest of this cluster — a test that is
green while exercising something other than what it names.

Acceptance criteria

  • One survivor chosen, with the measurement recorded here (which callers
    each has, which behaviours only one has — the newer copy has atomic
    writes and a dry-run guard the older lacks)
  • The other's unique behaviour is merged into the survivor before it goes
  • One test file, exercising the survivor
  • No module name is bound by two different files

Related

Activity

  1. modified the milestones: Backlog, v0.12.0 on Sep 12, 2026
  2. mrveiss commented on Oct 10, 2026

    @mrveiss
    OwnerAuthor

    Owner decision (2026-10-10): meet the ACs in full, no re-scope. The newer function-based copy survives and absorbs the old class's unique behaviour. One test file; the other module is deleted, so no module name is bound twice.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions