Skip to content

fix(api): eliminate silent in-memory and fake LLM fallbacks in API dependencies - #48

Merged
getdownandcode merged 2 commits into
mainfrom
fix/api-deps-strict-infrastructure
Oct 1, 2026
Merged

getdownandcode merged 2 commits into
mainfrom
fix/api-deps-strict-infrastructure

Conversation

@getdownandcode

Copy link
Copy Markdown
Owner

Summary

Eliminate silent fallbacks to FakeLLMClient, InMemoryMemoryStore, and InMemoryTraceSink in production API dependencies (resolving AUD-01, AUD-02, and AUD-03).

What Changed

  • In agentkit/api/deps.py:
    • get_memory_store now explicitly requires session_factory and redis_client, raising ServiceUnavailableError (HTTP 503) if absent rather than silently falling back to InMemoryMemoryStore.
    • get_trace_sink now requires session_factory, raising ServiceUnavailableError (HTTP 503) if absent rather than silently falling back to InMemoryTraceSink.
    • get_llm_client now creates the configured provider directly; if initialization fails for a live provider, it raises an exception rather than silently falling back to FakeLLMClient.
    • Unused in-memory and fake imports removed from deps.py.
  • In tests/integration/test_api_deps_strict.py:
    • Added test suite asserting strict 503 raising on missing infrastructure and verifying that live LLM providers do not silently degrade to fake clients.

How Tested

  • pytest tests/integration/test_api_deps_strict.py
  • Full test suite: 242 passed, 24 skipped (real infra flag).
  • Linting and typing: ruff and mypy 100% clean.

@getdownandcode getdownandcode left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peer Review: Strict Infrastructure Resolution in API Dependencies

  • Correctness: Verified. get_memory_store and get_trace_sink strictly require configured database and Redis clients, raising ServiceUnavailableError (HTTP 503) instead of falling back to in-memory stand-ins.
  • LLM Provider Error Surfacing: Verified. get_llm_client now creates the configured provider directly and allows initialization and authentication errors to propagate rather than falling back to FakeLLMClient.
  • Code Cleanliness: Unused in-memory and fake imports removed from deps.py.
  • Testing & Safety: All unit and integration tests pass cleanly with 92% coverage.

LGTM.

@getdownandcode
getdownandcode merged commit 409ea3c into main Oct 1, 2026
1 check passed
@getdownandcode
getdownandcode deleted the fix/api-deps-strict-infrastructure branch October 1, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant