Skip to content

CLI sync commands fail: discover_assistants() never called #232

@neuromechanist

Description

@neuromechanist

Bug

All CLI sync commands fail with "Unknown community" for every community because src/cli/sync.py imports registry but never calls discover_assistants(). The registry is empty when CLI sync commands run.

$ osa sync github --community hed
Error: Unknown community 'hed'
Available communities:

Root Cause

sync.py imports from src.assistants import registry at module level, but discover_assistants() is never called -- neither in sync.py nor in main.py. The API server calls it at startup via lifespan, but the CLI path doesn't.

Fix

Add a @sync_app.callback() that calls discover_assistants() before any sync command runs:

@sync_app.callback()
def sync_callback() -> None:
    """Ensure assistants are discovered before sync commands."""
    from src.assistants import discover_assistants
    discover_assistants()

Workaround

Trigger syncs directly via Python instead of CLI:

docker exec osa python -c "
from src.assistants import discover_assistants; discover_assistants()
from src.knowledge.github_sync import sync_repos
sync_repos('hed')
"

Introduced in

PR #218 (Release 0.7.0) -- the CLI refactor moved sync commands to a separate module without ensuring discovery runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Priority 1: Critical, fix as soon as possiblebugSomething isn't workingoperationsOperations, monitoring, and observability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions