Skip to content

Fix CI: make PostgreSQL optional, resolve lint/type errors, add gatekeeper ablation#3

Merged
harsh-kr11 merged 4 commits into
mainfrom
fix/ci-and-production-ready
May 19, 2026
Merged

Fix CI: make PostgreSQL optional, resolve lint/type errors, add gatekeeper ablation#3
harsh-kr11 merged 4 commits into
mainfrom
fix/ci-and-production-ready

Conversation

@harsh-kr11

Copy link
Copy Markdown
Owner

Summary

  • Make PostgreSQL deps optional: sqlalchemy, psycopg, pgvector, langchain-postgres moved to [postgres] extra. import behavioral_memory now works without PostgreSQL installed — the blocking CI test failure is fixed.
  • Fix all lint/type errors: 22 mypy errors resolved, ruff format applied to all 69 Python files, CI now lints agent/, examples/, and server.py too.
  • Add gatekeeper ablation study (Section IV.D.5): Script with 8 poisoned traces demonstrating how the gatekeeper prevents memory contamination.
  • Repo standardization: Makefile, py.typed (PEP 561), PR template, CHANGELOG with real date.

Changes

  • pyproject.toml: Core deps no longer include PostgreSQL; new [postgres] extra
  • src/behavioral_memory/__init__.py: Lazy __getattr__ for TraceStore import
  • src/behavioral_memory/memory/store.py: Guard langchain_postgres import with try/except
  • All dict type annotations fixed with dict[str, Any] across 11 files
  • scipy, typer, rich added to mypy ignore list
  • examples/gatekeeper_ablation.py: New ablation study with 3-condition comparison
  • .github/workflows/ci.yml: Updated to lint/test all directories
  • Makefile: 15 targets for common dev tasks
  • .github/PULL_REQUEST_TEMPLATE.md: Standardized PR format

Test Plan

  • ruff check passes on all files (0 errors)
  • ruff format --check passes (69 files formatted)
  • mypy src/ passes (0 errors)
  • pytest tests/ passes (104/104 tests)
  • import behavioral_memory works without PostgreSQL deps
  • python examples/gatekeeper_ablation.py runs successfully
  • python examples/validate_pipeline.py passes all 30 checks

Made with Cursor

harskuma and others added 4 commits May 18, 2026 20:11
- server.py: LangGraph-compatible server entry point that works with
  Agent Chat UI and `langgraph dev`. Uses MessagesState for compatibility.
- langgraph.json: Configuration for LangGraph CLI dev server.
- docker-compose.yml: One-command PostgreSQL+pgvector setup (works with
  both Docker and Podman).
- docs/GETTING_STARTED.md: Comprehensive setup guide covering all
  scenarios (InMemory, PostgreSQL, Langfuse, Agent Chat UI, BYOA).
- Updated .env.example with all options and documentation.
- Added server optional deps to pyproject.toml.
- Updated .gitignore for benchmark results and Chainlit files.

Co-authored-by: Cursor <cursoragent@cursor.com>
…add gatekeeper ablation

- Move sqlalchemy/psycopg/pgvector/langchain-postgres to [postgres] optional extra
- Guard TraceStore import with lazy __getattr__ so 'import behavioral_memory' works
  without PostgreSQL deps installed
- Fix all 22 mypy errors (dict type args, scipy/typer stubs, Any returns)
- Run ruff format on all 69 Python files across src/, tests/, agent/, examples/
- Update CI workflow to lint/test all directories, not just src/tests
- Add gatekeeper ablation script (Section IV.D.5) with 8 poisoned traces
- Add Makefile with common dev tasks (make lint, test, ci, ablation, etc.)
- Add PEP 561 py.typed marker for downstream type checking
- Add PR template for consistent contributions
- Update CHANGELOG with real date and all features
- Update README with ablation study docs, Makefile usage, postgres extra

Co-authored-by: Cursor <cursoragent@cursor.com>
- store.py: Replace `PGVector = None  # type: ignore` with proper
  TYPE_CHECKING import + deferred factory function. Avoids unused-ignore
  error when langchain-postgres is transitively installed.
- pyproject.toml: Remove global disallow_untyped_decorators=false and
  warn_unused_ignores=false. Add scoped [[tool.mypy.overrides]] for
  behavioral_memory.cli only, since typer decorators lack type stubs.

Co-authored-by: Cursor <cursoragent@cursor.com>
- tracer.py: Replace deprecated client.trace() with
  client.start_observation() + span.start_observation() for child
  generations. Matches Langfuse SDK v4.6+ API.
- feedback.py: Replace client.fetch_traces/fetch_scores with
  client.api.trace.list/scores.list for v4 compatibility.

Co-authored-by: Cursor <cursoragent@cursor.com>
@harsh-kr11 harsh-kr11 merged commit d9b50cd into main May 19, 2026
5 checks passed
@harsh-kr11 harsh-kr11 deleted the fix/ci-and-production-ready branch May 19, 2026 10:56
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.

2 participants