Skip to content

M1: Replace mutable module globals and sync-async bridges #60

Backlog

Description

@h45sh

Context

Mutable module globals and sync-async bridges prevent multiple isolated engine instances from running in one process:

  • _lhost_cache in gateway/network.py
  • _default_engine in common/embeddings.py
  • sys.modules lookup in gateway/gate.py
  • asyncio.run() plus ThreadPoolExecutor in gateway/preflight.py and cli/router.py

Acceptance criteria

  • Introduce explicit runtime wiring for caches and engines.
  • Remove the sync-async bridges; use one asyncio.run() at CLI main().
  • Two engine instances can run concurrently in-process without sharing state.
  • Tests cover isolation.

Out of scope

CyGuide coupling; that is #34.

Part of #24

Activity

  1. added this to the M1 Truth milestone on Nov 29, 2026
  2. added
    type:debt
    area:hygiene
    priority:P1
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:hygienepriority:P1type:debt

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions