Fix CI: make PostgreSQL optional, resolve lint/type errors, add gatekeeper ablation#3
Merged
Merged
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sqlalchemy,psycopg,pgvector,langchain-postgresmoved to[postgres]extra.import behavioral_memorynow works without PostgreSQL installed — the blocking CI test failure is fixed.ruff formatapplied to all 69 Python files, CI now lintsagent/,examples/, andserver.pytoo.Makefile,py.typed(PEP 561), PR template,CHANGELOGwith real date.Changes
pyproject.toml: Core deps no longer include PostgreSQL; new[postgres]extrasrc/behavioral_memory/__init__.py: Lazy__getattr__forTraceStoreimportsrc/behavioral_memory/memory/store.py: Guardlangchain_postgresimport with try/exceptdicttype annotations fixed withdict[str, Any]across 11 filesscipy,typer,richadded to mypy ignore listexamples/gatekeeper_ablation.py: New ablation study with 3-condition comparison.github/workflows/ci.yml: Updated to lint/test all directoriesMakefile: 15 targets for common dev tasks.github/PULL_REQUEST_TEMPLATE.md: Standardized PR formatTest Plan
ruff checkpasses on all files (0 errors)ruff format --checkpasses (69 files formatted)mypy src/passes (0 errors)pytest tests/passes (104/104 tests)import behavioral_memoryworks without PostgreSQL depspython examples/gatekeeper_ablation.pyruns successfullypython examples/validate_pipeline.pypasses all 30 checksMade with Cursor