Spaces:
Running
Running
Commit History
-
Mission M-E β Observability & Testsβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6- ADK callback handler (callbacks.py): logs all lifecycle events to RuntimeEventLog - agent.{name}.started/completed, agent.llm_request/response, agent.error - tool.{name}.started/completed, tool error events - _redact_sensitive() strips access_token, api_key, password, token fields - runner.py: attaches LeadPilotCallbackHandler to agent after build_orchestrator() - tracks turn duration + records agent.turns_processed / avg_turn_duration_ms metrics - metrics_service.py: adds gauge() method (overwrites, not additive) - admin.py: GET /executions/{instance_id}/trace β returns chronological event timeline - 8 new tests: test_callbacks.py (5 unit), test_e2e_agent_flow.py (3 E2E) - Frontend: execution trace timeline page at /admin/executions/[executionId] - Frontend: monitoring/page.tsx β Agent Metrics tab + View Trace links in Executions tab - docs/missions/event-types.md: full event taxonomy reference Total tests: 360 (all passing) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthrβ¦87e5ad2 -
Mission M-D β Flow Builder Revampβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6- Unlocks CONDITION and WAIT_DELAY nodes (no longer blocked from publish) - Adds PARALLEL, AGENT_HANDOFF, QUALIFICATION_GATE, INTENT_ROUTER node types - builder_translator.translate() now returns dual output: (definition_json, adk_pipeline_config) - New translate_to_adk_pipeline() function maps builder graph β ADK orchestrator config - FlowVersion.adk_pipeline_config column (JSON) populated on publish - ExecutionInstance.resume_at + resume_node_id columns for WAIT_DELAY resumption - Alembic migration s9t0u1v2w3x4 - build_orchestrator() accepts pipeline_config; applies builder tone/routing overrides - build_reply_agent() accepts tone + max_length params - Celery: resume_waiting_instances_task (every 60s) resumes WAITING instances - Frontend: ActionNode multi-handle (CONDITION: true/false, QUALIFICATION_GATE: qualified/unqualified) - Frontend: NodePalette groups (Triggers, Agent Nodes, Flow Control, Routing) - Frontend: full config forms for all new node types - 352 tests passing (8 new)β¦68e389f -
Mission M-C β Session & Memoryβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6Replace InMemorySessionService with LeadPilotSessionService backed by a new AgentSession DB table. ADK sessions now persist across webhook events and server restarts β agents resume mid-qualification without re-asking answered questions. - Add AgentSession model (state+events JSON, soft-delete) - Alembic migration r8s9t0u1v2w3 creates agent_session table - LeadPilotSessionService: in-memory cache + DB persistence, 50-event cap - runner.py: get-or-create pattern, one-time history seeding, update_session after turn - Admin endpoint: GET /api/v1/admin/contacts/{contact_id}/session - 6 new tests (344 total, all passing) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>98b27e0 -
Fix Alembic migrations to be idempotent against create_all raceβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6Root cause: SQLModel.metadata.create_all in startup scripts creates tables ahead of Alembic, causing subsequent migration runs to fail with "table already exists" or wrong table name errors. Fixes: - Mission 38: make user_identity CREATE TABLE idempotent, fix table name oauth_state β oauthstate (SQLModel uses lowercase class name), make purpose column addition idempotent - Mission M-B: make qualification_status/intent ADD COLUMN idempotent Both migrations now check column/table existence before creating, allowing alembic upgrade head to run safely on any DB state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>e3db935 -
debug: surface test-chat session error for HF diagnosisβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>73428ba
-
Mission 38 β Social Login (Facebook + TikTok)β
Ashraf Al-Kassem +1: Claude Sonnet 4.6- Add UserIdentity model for multi-provider social identity storage - Add purpose field to OAuthState to separate auth vs integration flows - Add fetch_user_profile() to Facebook and TikTok OAuth adapters - New /api/v1/auth/oauth/{provider}/start + callback endpoints - Resolution logic: existing identity β email match β new user - Placeholder email for TikTok (no email scope available) - 8 new tests, all passing; fix 2 WhatsApp hardening tests (Redis mock) - Frontend: Facebook + TikTok buttons on login/signup + /auth/social/callback page Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>c324adc -
Mission 37 β Universal OAuth Provider Frameworkβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6Builds a provider-agnostic OAuth foundation for Facebook, TikTok, HubSpot, and Salesforce. Establishes the reusable patterns that all future OAuth-based integrations will extend. - DB: oauthprovider (registry), oauthconnection (encrypted tokens), oauthstate (CSRF-safe state, 10-min TTL) β migration n4o5p6q7r8s9 - Provider adapters: base ABC + Facebook, TikTok, HubSpot, Salesforce - oauth_service: state creation, authorize URL, code exchange, save connection, refresh token, revoke β all tokens Fernet-encrypted - Routes: GET /oauth/{provider}/authorize, /callback, /connections, DELETE /connections/{id}, POST /connections/{id}/refresh - Admin routes: list providers+stats, list connections, toggle provider - Idempotent seed: 4 providers seeded at startup - Frontend: generic /integrations/callback page, oauth.ts utility, admin portal OAuth Providers and Connections pages - 8 tests, all pass (317/319 total suite) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>ad82999
-
fix(ci): remove unused WorkspacePlan import to pass ruff F401β
Ashraf Al-Kassem +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>ea48905 -
fix(routing): fix broken sign-in/signup links, admin redirect, and Google OAuthβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6- Website CTAs (Header, Footer, CTASection, PlanCard, plans page) now use <a href="/app/..."> for cross-app navigation β Next.js <Link> was silently doing SPA navigation within the Website, which has no /login or /signup routes. - APP_URL changed from hardcoded localhost:3000 to /app (relative, works in any env). - nginx admin redirect changed from exact-match to regex so /admin/login, /admin/users, etc. are all covered. - Google OAuth redirect_uri now includes the /app basePath prefix to match the actual callback route at /app/auth/google/callback. NOTE: Google Cloud Console must also have /app/auth/google/callback added as an authorized redirect URI for Google OAuth to work end-to-end. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>e284c06
-
fix: normalize timezone-aware ends_at + enrich create responseβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6- Strip tzinfo from ends_at/starts_at inputs to avoid offset-naive vs offset-aware comparison error when clients send ISO8601 with Z suffix - Change create override response from flat override_id to override object {id, plan_code, starts_at, ends_at, reason} for richer client feedback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>5e4d359 -
feat: Mission 34 β Admin Plan Overrides + Expiry + Audit Trailβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6- Add PlanOverride model (time-bound workspace plan grants) - Update entitlement resolver: override > base plan precedence with self-heal - Expose plan_source + override_expires_at in GET /entitlements - Add admin_plans.py: 3 endpoints (plan-status, plan-override, revoke) - Celery beat job expire_plan_overrides_task every 5 min - Admin workspace detail UI: Plan Override card with apply/revoke form - 3 admin-api.ts methods for override CRUD - Alembic migration m3n4o5p6q7r8 for planoverride table - 6 passing tests: apply, self-heal, worker expiry, revoke, dedup, audit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>a21ab3d
-
fix: Google OAuth redirect URI mismatch + template badge UIβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6- Fix get_google_redirect_uri() to use APP_BASE_URL/FRONTEND_URL instead of the backend request URL, resolving error 400 on Google sign in (local dev: was sending localhost:8000 instead of localhost:3000) - Remove unused request param from get_google_redirect_uri and both google_auth_start / google_auth_callback route handlers - Template cards: solid-filled category badges (teal-600) and platform badges (slate-700) to match design; industry tags rendered as plain uppercase text instead of pill badges Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0ef8648 -
feat: Mission 33 β Marketing Website Alignment + DB-Driven Contentβ
Ashraf Al-Kassem +1: Claude Opus 4.6Convert all website pages from hardcoded static arrays to DB-driven content via public catalog API endpoints. Removes phantom "Pro" tier (website showed 4 plans, DB only has 3). Adds Templates and Integrations pages, parity audit script, and scroll-reveal design system classes. - Backend: public GET /catalog/templates endpoint (unauthenticated, 60s cache) - Website: api.ts client, moduleMap.ts for module-to-marketing mapping - Pages converted: home, plans (3 tiers), features (module-driven) - New pages: /templates (12 templates, category filters), /integrations (3 providers) - Components: FeatureCard gains iconName + comingSoon props - Nav: Header + Footer updated with Templates and Integrations links - Design: catalog-card, badge-platform, badge-category, scroll-reveal classes - Audit: scripts/parity-audit.ts verifies no fake feature claims (CI-friendly) - Tests: 3 new catalog tests (305 total passing) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>6acfd72 -
feat: Mission 32 β Template Catalog Expansion + 12 Pre-Made Automation Templatesβ
Ashraf Al-Kassem +1: Claude Opus 4.6Template Variables System: {{key}} placeholders in builder graphs replaced during clone with user-supplied values. Supports text, phone, url, number, textarea types with required/optional + defaults. Version Locking: Cloned flows track source_template_id and version_id. GET /automations/{id} returns latest_template_version info for "update available" badge. POST rebase-to-template endpoint re-applies stored variable values to newer template version. Analytics: TemplateUsageStat tracks clone_count, publish_count, active_flows_count. clone_count shown in catalog, sort=popular support. 12 Production Templates seeded at startup (idempotent by slug): - 6 WhatsApp: lead qualifier, appointment booking, FAQ responder, pricing gatekeeper, reactivation campaign, sales concierge - 4 Meta: Instagram DM responder, Messenger support intake, Lead Ads intake, Instagram appointment booking - 2 Omnichannel: lead qualifier, inbound-to-CRM pipeline Frontend: variable form on template detail, platfβ¦740c3bd -
feat: Mission 31 β Meta Platform: Instagram DM, Messenger, and Lead Ads Full Lifecycleβ
Ashraf Al-Kassem +1: Claude Opus 4.6- OAuth 2.0 connect flow (start + callback with JWT state, token exchange chain) - Webhook subscription API (auto-subscribe after OAuth, manual trigger endpoint) - Message normalization: Instagram DM + Messenger channel discrimination, attachment parsing - Meta delivery/read status webhooks via watermark-based updates - Lead Ads ingestion: fetch lead data from Graph API, enrich contacts - MetaAdapter: send_media implementation + get_user_profile - Dispatch service: Meta media dispatch (mirrors WhatsApp pattern) - Channel-level observability metrics (instagram/messenger discrimination) - 21 new tests (288 total), all passing + 15/15 E2E checks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>eed40fb -
feat: Mission 30 β WhatsApp Cloud Production Hardeningβ
Ashraf Al-Kassem +1: Claude Opus 4.6- Webhook signature enforcement (HMAC SHA-256) + payload size guard (1MB) - Delivery status lifecycle: DELIVERED/READ/DEAD_LETTER statuses with forward-only progression - Phone number normalization (digits-only) to prevent duplicate contacts - Media message handling: inbound image/audio/video/document parsing + local storage - Dead-letter queue: endpoints for listing and retrying permanently failed messages - Adapter abstraction: MessagingAdapter ABC for WhatsApp and Meta adapters - Observability: in-memory metrics service + admin metrics endpoint - Celery worker fix: expire_on_commit=False prevents MissingGreenlet errors - Catalog registry updated with new delivery statuses - 21 new tests (267 total), all passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>f187462 -
feat: Mission 29 β Prompt Studio Enhancements + Auth Fixes + User Seedingβ
Ashraf Al-Kassem +1: Claude Opus 4.6Mission 29: Knowledge chunking (DOCX/XLSX support, keyword retrieval), dynamic qualification criteria (relational CRUD), AI step output schema, and prompt compiler integration for all three. Auth fixes: seed demo + admin users on startup, fix Google OAuth email_verified_at bug, fix admin-api.ts 403 logout, comprehensive auth test suite (19 tests covering studio + admin flows). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>a5f93e1 -
feat: Mission 28 β Data Flow & Reference Tables End-to-End Wiringβ
Ashraf Al-Kassem +1: Claude Opus 4.6Backend: - New GET /entitlements endpoint (plan + modules + usage for active workspace) - New settings sub-endpoints: GET/PATCH /settings/profile, GET /settings/subscription, GET /settings/modules - Catalog additions: template-categories, template-platforms - required_module field on ZOHO_UPSERT_LEAD node type - WorkspaceEntitlementOverride.enabled nullable boolean for explicit module gating - Alembic migration for enabled column - Entitlements service updated: override.enabled=False blocks, True force-enables Frontend: - Settings page: Subscription tab (plan badge + usage bars) and Modules tab (enabled/source) - Templates page: catalog-driven filters replacing hardcoded labels + entitlement messaging - Node palette: locked badge for nodes requiring unavailable modules - Dashboard: Plan & Usage card with top-3 usage progress bars - Admin workspace detail: inline usage limit override editing with pencil icon Tests: 13 new tests (test_entitlements_api, test_settings_pages, test_referenβ¦fc6fc7e
-
fix: resolve 149 ruff lint violations for CI pipelineβ
Ashraf Al-Kassem +1: Claude Opus 4.6- Auto-fix 104 unused imports (F401) across 40 files - Fix F821: add missing `wrap_error` import in diagnostics.py - Fix F841: remove unused `now` variables in auth.py - Fix E722: replace bare `except` with `except Exception` in dispatch - Fix re-exports: explicit `as` syntax for meta/whatsapp __init__.py - Update pyproject.toml ruff config: - Ignore E711/E712 (SQLAlchemy needs `== None`/`== False`) - Ignore E402/E701 (intentional patterns in workers/tests) - Add per-file ignores for alembic/ and tests/ All 197 tests pass. Ruff checks clean. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>b1aa633 -
feat: Mission 27 β Automation Builder v2 + Template Catalog Foundationβ
Ashraf Al-Kassem +1: Claude Sonnet 4.6- Visual canvas editor (ReactFlow @xyflow/react v12) with TriggerNode, ActionNode, NodePalette, NodeConfigPanel - FlowDraft model: per-flow mutable builder graph, separate from immutable FlowVersion - Builder v2 endpoints: GET/PUT draft, validate, publish, simulate, rollback, versions - builder_translator.py: validate_graph, translate, simulate β 21 unit tests passing - AutomationTemplate + AutomationTemplateVersion with admin CRUD + workspace clone - GET/POST /templates/ workspace catalog; POST /templates/:slug/clone - Admin: GET/POST /admin/templates, versions, publish endpoints - Alembic migration g7h8i9j0k1l2 + merge migration 2163b9b16da8 (M20+M27) - Frontend: automations-api.ts, templates-api.ts; admin/templates pages - All 57 tests passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>d4d1956
-
feat: Mission 21 β Settings Center + Data-Driven Dropdownsβ
Ashraf Al-Kassem +1: Claude Opus 4.6- Add PATCH /auth/me for user profile updates with audit logging - Add 8 new catalog endpoints (timezones, languages, ai-models, dedupe-strategies, event-sources, event-outcomes, audit-actions, contact-fields) - Create LookupsProvider context + useLookups() hook for bulk catalog preload - Restructure Settings page with Profile section (name edit, email verification badge) - Replace 10 hardcoded dropdowns across 5 frontend pages with catalog data - Sidebar shows real user name + computed initials from /auth/me - 141 tests passing (+23 new), zero TS build errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>c626151 -
feat: Mission 19+20 β Catalog Standardization + Prompt Studio Knowledge Base v2 + Dynamic Lead Qualificationβ
Ashraf Al-Kassem +1: Claude Opus 4.6Mission 19: Catalog registry with standardized provider/trigger/action metadata, validation, and frontend catalog client. Mission 20: Single source-of-truth prompt compiler replacing two divergent AI context paths. Knowledge files now injected into AI context. Automation AI steps use goal/tasks/extra_instructions. Dynamic lead qualification with workspace-level questions/statuses and admin defaults. - 118 tests passing (was 57), frontend build clean Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>9d062e9 -
feat: Mission 18 β High-Volume Runtime Event Trailβ
Ashraf Al-Kassem +1: Claude Opus 4.6Unified runtime event logging across all subsystems (webhooks, runtime execution, dispatch, email, inbox, Zoho sync) with retention policies, correlation IDs, and support replay capabilities. - RuntimeEventLog model with 4 composite indexes + JSON related_ids - Non-throwing log_event() service with payload redaction (SG.*, Bearer, truncation) - Instrumented ~30 flows: webhook (5), runtime (8), dispatch (6), inbox (2), email (3) - Support Timeline API: workspace-scoped with JSON path filters - Admin Runtime Events: cross-workspace list/detail with full filter set - Frontend: TimelinePanel in inbox + admin runtime-events page - Celery beat daily purge (03:00 UTC, batch 1000) - Alembic migration e5f6g7h8i9j0 - 8 unit tests + 98 E2E tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>eab9f11
-
feat: Mission 17 β Enterprise Audit Logging Frameworkβ
Ashraf Al-Kassem +1: Claude Opus 4.6- Extend AdminAuditLog with 9 new columns (actor_type, outcome, ip_address, user_agent, request_path, request_method, error_code, error_message, agency_id) - Make actor_user_id nullable for failed login attempts on unknown users - Create audit_event() service with auto IP/UA/path extraction, metadata redaction, field truncation, and non-throwing error handling - Instrument 29 handlers across 8 files: auth (5), workspaces (4), integrations (3), automations (2), dispatch (1), inbox (2), admin (6), agency (6) - Add workspace-scoped GET /audit-logs endpoint with 7 filters + detail - Enhance admin GET /admin/audit-log with workspace_id, agency_id, actor_type, outcome, date range, and correlation_id filters + detail endpoint - Build dashboard Activity Log page with action/outcome badges, filters, expandable rows, and pagination - Enhance admin audit log page with actor type badges, correlation ID copy, request/IP/error detail view - Add 20 new tests (85 total pass, 0 fail) Co-β¦6d44285 -
Ready for deployment to HF and GitHub
Ashraf Al-Kassema3ba894 -
feat: Mission 14+15 β commercial entitlements + agency reseller modelβ
Ashraf Al-Kassem +1: Claude Opus 4.6Mission 14: Plan-based entitlements with per-module hard limits, usage metering, and admin plan management UI. Adds Plan, PlanEntitlement, WorkspacePlan, and UsageMeter models. Entitlement enforcement service with check_and_increment/batch helpers. Admin /plans CRUD page. Mission 15: Agency reseller model enabling multi-workspace management. Adds AgencyAccount, AgencyMember, WorkspaceOwnership models with RBAC (owner/admin/operator/viewer roles). Agency router with 9 endpoints for lifecycle, member management, and workspace provisioning. Lazy WorkspaceMember provisioning via extended get_active_workspace(). max_workspaces limit enforcement via plan entitlements. Admin agency management (list/detail/suspend/plan-assign). Frontend agency console and workspace switcher replacing hardcoded placeholder. All 56 unit tests pass. 55/55 E2E checks verified on localhost. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2bb79a1 -
fix: eliminate 307 redirects that break login and API calls behind HF proxyβ
Ashraf Al-Kassem +1: Claude Opus 4.6The previous trailing-slash normalization in api.ts inadvertently broke login (POST /auth/login/ β 307 β /auth/login, losing FormData). Root cause: FastAPI routes defined as @router.get("/") only match paths WITH trailing slash, causing 307 redirects for requests WITHOUT one. Behind HuggingFace's reverse proxy, these redirects silently fail. Fix: Change route definitions from "/" to "" so they match the exact paths the frontend sends (no trailing slash). Revert the frontend trailing-slash hack. Routes fixed: prompt_config (GET, POST), integrations (GET), workspaces (GET, POST), automations (GET). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>721b3fc
-
fix: comprehensive production bug fix β admin auth, endpoints, seedingβ
Ashraf Al-Kassem +1: Claude Opus 4.6- Create admin_auth.py with POST /login and GET /me endpoints - Register admin_auth_router in main.py - Implement ~20 missing admin endpoints in admin.py (users, workspaces, webhooks, dispatch, automations, prompt-configs, zoho-health, integrations, executions, email retry, impersonation) - Fix wrap_error() calls with invalid code= kwarg (8 call sites across auth.py, admin.py, integrations.py) - Fix SQLAlchemy == None to .is_(None) in auth.py (2 places) - Seed admin@leadpilot.io / LeadPilot@password123 in create_test_user.py - Delete broken seed_admin.py and seed_rbac.py scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>15d9ad6 -
fix: add missing backend application code (app/, migrations, tests, templates)β
Ashraf Al-Kassem +1: Claude Opus 4.6The initial full project commit omitted the core backend directories. This adds the complete backend application package including all API routes, models, services, workers, 10 Alembic migrations, 13 test files (57 tests), and email templates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8ca4657