Skip to content

Codex/login trim username#1297

Closed
pratzrao wants to merge 54 commits intomainfrom
codex/login-trim-username
Closed

Codex/login trim username#1297
pratzrao wants to merge 54 commits intomainfrom
codex/login-trim-username

Conversation

@pratzrao
Copy link
Copy Markdown

@pratzrao pratzrao commented Apr 8, 2026

Summary by CodeRabbit

  • New Features

    • Added dashboard chat capability enabling users to ask questions about dashboards with AI-powered answers.
    • Introduced AI data sharing preferences and consent management.
    • Added suggested prompts to guide dashboard chat interactions.
    • Implemented chat message feedback mechanism (thumbs up/down).
  • Improvements

    • Enhanced login robustness by trimming whitespace from usernames.
  • Dependencies

    • Added vector database, LLM orchestration, and embedding support libraries.

pratzrao and others added 30 commits March 20, 2026 02:04
…-fixes

fix(ai-chat): harden chroma collection creation flow
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3a4b27a5-103a-4a8c-8ff4-5a1132e171f7

📥 Commits

Reviewing files that changed from the base of the PR and between 9865172 and 33b941a.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (122)
  • .env.template
  • Docker/docker-compose.dev.yml
  • Docker/docker-compose.yml
  • README.md
  • ddpui/api/dashboard_native_api.py
  • ddpui/api/org_preferences_api.py
  • ddpui/api/user_org_api.py
  • ddpui/celeryworkers/tasks.py
  • ddpui/core/dashboard_chat/CLAUDE.md
  • ddpui/core/dashboard_chat/README.md
  • ddpui/core/dashboard_chat/__init__.py
  • ddpui/core/dashboard_chat/agents/__init__.py
  • ddpui/core/dashboard_chat/agents/final_answer_formatting.py
  • ddpui/core/dashboard_chat/agents/llm_client_interface.py
  • ddpui/core/dashboard_chat/agents/openai_llm_client.py
  • ddpui/core/dashboard_chat/agents/prompt_template_store.py
  • ddpui/core/dashboard_chat/config.py
  • ddpui/core/dashboard_chat/context/__init__.py
  • ddpui/core/dashboard_chat/context/dashboard_table_allowlist.py
  • ddpui/core/dashboard_chat/context/dbt_docs_artifacts.py
  • ddpui/core/dashboard_chat/contracts/conversation_contracts.py
  • ddpui/core/dashboard_chat/contracts/event_contracts.py
  • ddpui/core/dashboard_chat/contracts/intent_contracts.py
  • ddpui/core/dashboard_chat/contracts/response_contracts.py
  • ddpui/core/dashboard_chat/contracts/retrieval_contracts.py
  • ddpui/core/dashboard_chat/contracts/sql_contracts.py
  • ddpui/core/dashboard_chat/orchestration/__init__.py
  • ddpui/core/dashboard_chat/orchestration/checkpoints.py
  • ddpui/core/dashboard_chat/orchestration/conversation_context.py
  • ddpui/core/dashboard_chat/orchestration/intent_routing.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/__init__.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/implementations/__init__.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/implementations/dbt_tools.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/implementations/schema_tools.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/implementations/sql_corrections.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/implementations/sql_execution_tools.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/implementations/sql_parsing.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/implementations/sql_validation.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/implementations/vector_retrieval_tool.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/runtime/__init__.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/runtime/tool_loop.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/runtime/tool_specifications.py
  • ddpui/core/dashboard_chat/orchestration/llm_tools/runtime/turn_context.py
  • ddpui/core/dashboard_chat/orchestration/nodes/__init__.py
  • ddpui/core/dashboard_chat/orchestration/nodes/compose_response.py
  • ddpui/core/dashboard_chat/orchestration/nodes/finalize.py
  • ddpui/core/dashboard_chat/orchestration/nodes/handle_follow_up_context.py
  • ddpui/core/dashboard_chat/orchestration/nodes/handle_follow_up_sql.py
  • ddpui/core/dashboard_chat/orchestration/nodes/handle_irrelevant.py
  • ddpui/core/dashboard_chat/orchestration/nodes/handle_needs_clarification.py
  • ddpui/core/dashboard_chat/orchestration/nodes/handle_query_with_sql.py
  • ddpui/core/dashboard_chat/orchestration/nodes/handle_query_without_sql.py
  • ddpui/core/dashboard_chat/orchestration/nodes/handle_small_talk.py
  • ddpui/core/dashboard_chat/orchestration/nodes/load_context.py
  • ddpui/core/dashboard_chat/orchestration/nodes/route_intent.py
  • ddpui/core/dashboard_chat/orchestration/orchestrator.py
  • ddpui/core/dashboard_chat/orchestration/response_composer.py
  • ddpui/core/dashboard_chat/orchestration/retrieval_support.py
  • ddpui/core/dashboard_chat/orchestration/runtime_signals.py
  • ddpui/core/dashboard_chat/orchestration/source_identifier_parsing.py
  • ddpui/core/dashboard_chat/orchestration/state/__init__.py
  • ddpui/core/dashboard_chat/orchestration/state/graph_state.py
  • ddpui/core/dashboard_chat/orchestration/timing_breakdown.py
  • ddpui/core/dashboard_chat/orchestration/tool_loop_message_builder.py
  • ddpui/core/dashboard_chat/sessions/__init__.py
  • ddpui/core/dashboard_chat/sessions/session_service.py
  • ddpui/core/dashboard_chat/suggested_prompts.py
  • ddpui/core/dashboard_chat/vector/__init__.py
  • ddpui/core/dashboard_chat/vector/org_vector_context_build_service.py
  • ddpui/core/dashboard_chat/vector/org_vector_store.py
  • ddpui/core/dashboard_chat/vector/vector_documents.py
  • ddpui/core/dashboard_chat/warehouse/__init__.py
  • ddpui/core/dashboard_chat/warehouse/sql_guard.py
  • ddpui/core/dashboard_chat/warehouse/warehouse_access_tools.py
  • ddpui/management/commands/seed_dashboard_chat_prompts.py
  • ddpui/migrations/0157_dashboard_chat_orgdbt_and_org_preferences_changes.py
  • ddpui/migrations/0158_dashboard_chat_ai_contexts_org_and_dashboard.py
  • ddpui/migrations/0159_dashboard_chat_config_tables.py
  • ddpui/models/__init__.py
  • ddpui/models/dashboard_chat.py
  • ddpui/models/org.py
  • ddpui/models/org_preferences.py
  • ddpui/schemas/dashboard_schema.py
  • ddpui/schemas/org_preferences_schema.py
  • ddpui/services/dashboard_service.py
  • ddpui/tests/api_tests/test_dashboard_chat_settings_api.py
  • ddpui/tests/api_tests/test_dashboard_native_api.py
  • ddpui/tests/api_tests/test_user_org_api.py
  • ddpui/tests/core/dashboard_chat/conftest.py
  • ddpui/tests/core/dashboard_chat/test_langgraph_checkpointing.py
  • ddpui/tests/core/dashboard_chat/test_llm_client.py
  • ddpui/tests/core/dashboard_chat/test_prompt_store.py
  • ddpui/tests/core/dashboard_chat/test_response_payloads.py
  • ddpui/tests/core/dashboard_chat/test_runtime.py
  • ddpui/tests/core/dashboard_chat/test_session_service.py
  • ddpui/tests/core/dashboard_chat/test_session_service_background_runner.py
  • ddpui/tests/core/dashboard_chat/test_suggested_prompts.py
  • ddpui/tests/core/dashboard_chat/test_tasks.py
  • ddpui/tests/core/dashboard_chat/test_vector_building.py
  • ddpui/tests/core/dashboard_chat/test_vector_store.py
  • ddpui/tests/core/dashboard_chat/test_warehouse_tools.py
  • ddpui/tests/models/test_dashboard_chat_models.py
  • ddpui/tests/utils/test_feature_flags.py
  • ddpui/tests/websockets/test_base_consumer.py
  • ddpui/tests/websockets/test_dashboard_chat_consumer.py
  • ddpui/urls.py
  • ddpui/utils/feature_flags.py
  • ddpui/utils/openai_client.py
  • ddpui/utils/vector/__init__.py
  • ddpui/utils/vector/backends/__init__.py
  • ddpui/utils/vector/backends/chroma.py
  • ddpui/utils/vector/interface.py
  • ddpui/utils/warehouse/client/bigquery.py
  • ddpui/utils/warehouse/client/postgres.py
  • ddpui/utils/warehouse/client/warehouse_interface.py
  • ddpui/websockets/__init__.py
  • ddpui/websockets/dashboard_chat_consumer.py
  • docker-compose.chroma.yml
  • docs/docs/features/dashboard-chat-chromadb-sizing.md
  • pyproject.toml
  • seed/002_permissions.json
  • seed/003_role_permissions.json

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

Adds a complete "dashboard chat" feature: new backend orchestration, LLM/vector integrations (OpenAI, Chroma), DB models/migrations, WebSocket consumer, Celery tasks, config/ENV, client/warehouse adapters, extensive tests, docs, and seed data. All feature gates and consent checks are included.

Changes

Cohort / File(s) Summary
Environment & Compose
\.env.template, Docker/docker-compose.dev\.yml, Docker/docker-compose\.yml, docker-compose\.chroma\.yml, README\.md, pyproject\.toml, seed/002_permissions\.json, seed/003_role_permissions\.json
Added OpenAI & Chroma env vars, Chroma compose file, updated dev compose ordering/newline, README step to run Chroma, added dependencies and permission seed entries.
API: dashboard & org preferences
ddpui/api/dashboard_native_api.py, ddpui/api/org_preferences_api.py, ddpui/schemas/dashboard_schema.py, ddpui/schemas/org_preferences_schema.py
New endpoints for dashboard export, AI context CRUD, chat bootstrap, message feedback, and org-level AI-dashboard-chat settings/status with feature-flag and consent gating.
Auth / Websockets
ddpui/api/user_org_api.py, ddpui/websockets/__init__\.py, ddpui/urls.py
Trim login username whitespace; WebSocket BaseConsumer reads access token from cookie when query token absent; added WebSocket route for dashboard chat.
Database models & migrations
ddpui/models/dashboard_chat.py, ddpui/models/org\.py, ddpui/models/org_preferences\.py, ddpui/migrations/0157_*, 0158_*, 0159_*, ddpui/models/__init__\.py
New dashboard-chat models (session, message, turn, prompt templates, org/dashboard AI contexts); Org/OrgPreferences fields for AI consent and DBT timestamps; three migrations and model re-exports.
Core orchestration & runtime
ddpui/core/dashboard_chat/orchestration/..., ddpui/core/dashboard_chat/config.py, ddpui/core/dashboard_chat/contracts/*
LangGraph-based runtime, checkpointing, timing/progress signals, graph state, nodes (intent routing, handlers, compose/finalize), runtime config from env, and Pydantic contracts for intents/responses/events.
LLM client & prompts
ddpui/core/dashboard_chat/agents/openai_llm_client.py, ddpui/core/dashboard_chat/agents/llm_client_interface.py, ddpui/core/dashboard_chat/agents/prompt_template_store.py, ddpui/core/dashboard_chat/agents/final_answer_formatting.py, ddpui/management/commands/seed_dashboard_chat_prompts.py
OpenAI-backed LLM adapter (classification, tool-loop, final-answer composition), prompt-store with DB overrides, final-answer formatting helpers, and seed command.
Tool loop & tools
ddpui/core/dashboard_chat/orchestration/llm_tools/runtime/*, .../implementations/*
Tool-loop runtime, tool specifications, turn context, and implementations for retrieval, schema tools, dbt tools, SQL parsing/validation/corrections, SQL execution tool.
Vector documents & store
ddpui/core/dashboard_chat/vector/*, ddpui/utils/vector/interface.py, ddpui/utils/vector/backends/chroma.py
Vector document datamodels, deterministic IDs, OpenAI embedding provider, OrgVectorStore wrapper, Chroma backend, and embedding/usage tracking.
Vector ingestion & retrieval support
ddpui/core/dashboard_chat/vector/org_vector_context_build_service.py, ddpui/core/dashboard_chat/context/dbt_docs_artifacts.py, ddpui/core/dashboard_chat/context/dashboard_table_allowlist.py, ddpui/core/dashboard_chat/orchestration/retrieval_support.py
DBT docs generation, allowlist builder, vector document builders, org-level ingestion service with garbage collection, and retrieval/citation helpers.
Warehouse & SQL guard
ddpui/core/dashboard_chat/warehouse/sql_guard.py, ddpui/core/dashboard_chat/warehouse/warehouse_access_tools.py, ddpui/utils/warehouse/client/*.py, ddpui/utils/warehouse/client/warehouse_interface.py
SQL validation guard, BigQuery/Postgres distinct-value helpers, warehouse access wrapper for schema/distinct/execute with BigQuery quoting and error handling.
Sessions & background execution
ddpui/core/dashboard_chat/sessions/session_service.py, ddpui/celeryworkers/tasks.py
Session/message persistence with idempotency, turns, websocket event publishing, background runner and cancellation handling; Celery tasks to schedule and build org vector contexts.
Websocket consumer
ddpui/websockets/dashboard_chat_consumer.py
Authenticated consumer handling send_message and cancel_message flows, session/turn lifecycle, availability/consent checks, and event forwarding.
Service & utils
ddpui/services/dashboard_service.py, ddpui/core/dashboard_chat/suggested_prompts.py, ddpui/utils/openai_client.py, ddpui/utils/feature_flags.py, ddpui/core/dashboard_chat/* README/CLAUDE.md
Dashboard export helpers, suggested-prompt builder, shared OpenAI client factory, feature flag entry, and documentation/spec files.
Tests
ddpui/tests/** (many files under core/dashboard_chat, api_tests, websockets, models, utils)
Extensive unit/integration tests for runtime, LLM client, prompt store, vector building/store, warehouse tools, session service, websockets, migrations, and API endpoints. Major new test coverage added.
Docs
ddpui/core/dashboard_chat/README.md, ddpui/core/dashboard_chat/CLAUDE.md, docs/docs/features/dashboard-chat-chromadb-sizing.md
Architecture README, detailed CLAUDE spec for runtime/tooling, and Chroma sizing guidance.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant WS as WebSocket Consumer
    participant DB as Postgres (sessions/turns)
    participant Runtime
    participant Vec as VectorStore (Chroma)
    participant LLM as OpenAI
    participant WH as Warehouse
    participant Celery

    Client->>WS: send_message (dashboard_id, message)
    WS->>DB: create/reuse session & user message, create turn (QUEUED)
    WS->>WS: publish initial progress
    WS->>Celery: start background turn (turn_id)
    Celery->>Runtime: run turn (session_id, user_query)
    Runtime->>Vec: get_or_embed_query / retrieve documents
    Runtime->>LLM: classify intent / run tool-loop
    alt SQL path
        Runtime->>WH: get_schema_snippets / execute_sql
    end
    Runtime->>DB: persist assistant message & turn updates
    Runtime->>WS: publish assistant message event
    WS->>Client: assistant message (via websocket)
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested reviewers

  • Ishankoradia
  • siddhant3030
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/login-trim-username

@pratzrao pratzrao deleted the codex/login-trim-username branch April 8, 2026 09:48
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