Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f/switch to pg #959

Merged
merged 374 commits into from
Jan 5, 2025
Merged

f/switch to pg #959

merged 374 commits into from
Jan 5, 2025

Conversation

creatorrr
Copy link
Contributor

@creatorrr creatorrr commented Dec 13, 2024

User description

  • wip: Minor refactors
  • feat(agents-api): Use uuid7 instead of uuid4 (has database benefits)
  • refactor: Lint agents-api (CI)
  • wip(agents-api): Initial migrations for postgres

PR Type

Enhancement, Tests, Configuration changes, Error handling, Miscellaneous


Description

  • Migrated the codebase from Cozo to PostgreSQL, including database queries, test fixtures, and environment configurations.

  • Enhanced session, task, and agent models with new fields and improved validation.

  • Added utility functions for PostgreSQL query execution, database exception handling, and safe operations.

  • Introduced a state machine for managing execution state transitions and improved workflow management.

  • Refactored multiple components for better readability, maintainability, and error handling.

  • Added comprehensive tests for SQL queries, API routes, and workflows, ensuring PostgreSQL compatibility.

  • Implemented a changelog generation script using Julep API.

  • Updated environment configurations to support PostgreSQL DSN and removed Cozo-specific settings.

  • Enhanced interceptors with blob storage integration and modular error handling.

  • Deprecated or disabled outdated test cases and removed unused files and logic.


Changes walkthrough 📝

Relevant files
Tests
14 files
test_execution_workflow.py
Transition tests from Cozo to PostgreSQL integration.       

agents-api/tests/test_execution_workflow.py

  • Replaced cozo_clients_with_migrations with pg_dsn and create_db_pool
    for PostgreSQL integration.
  • Updated test fixtures to use PostgreSQL connection pools instead of
    Cozo clients.
  • Adjusted task creation and execution logic to align with
    PostgreSQL-based workflow.
  • Removed redundant client parameters and replaced them with connection
    pool usage.
  • +485/-513
    fixtures.py
    Refactored test fixtures for PostgreSQL integration.         

    agents-api/tests/fixtures.py

  • Migrated fixtures from Cozo to PostgreSQL, utilizing create_db_pool
    for database interactions.
  • Added new fixtures for developers, agents, and sessions with
    PostgreSQL support.
  • Removed Cozo-specific client initialization and replaced with
    PostgreSQL-based logic.
  • Introduced utility functions for generating random emails and managing
    test data.
  • +225/-288
    test_task_queries.py
    Add and enhance tests for task-related SQL queries.           

    agents-api/tests/test_task_queries.py

  • Added comprehensive tests for task-related SQL queries, including
    create, update, delete, and list operations.
  • Introduced tests for new patch_task functionality.
  • Replaced UUID4 with UUID7 for task identifiers.
  • Enhanced error handling in test cases.
  • +258/-97
    test_docs_queries.py
    Add tests for document-related SQL queries and search.     

    agents-api/tests/test_docs_queries.py

  • Added tests for document-related SQL queries, including create,
    delete, and search operations.
  • Introduced tests for hybrid and embedding-based document search.
  • Improved test coverage for user and agent document ownership.
  • +269/-103
    test_session_queries.py
    Add and enhance tests for session-related SQL queries.     

    agents-api/tests/test_session_queries.py

  • Added tests for session-related SQL queries, including create, update,
    delete, and list operations.
  • Enhanced test coverage for session filtering and counting.
  • Improved error handling in test cases.
  • +188/-101
    test_task_routes.py
    Add and enhance tests for task-related API routes.             

    agents-api/tests/test_task_routes.py

  • Added tests for task-related API routes, including task creation and
    execution.
  • Enhanced test coverage for execution transitions and error scenarios.
  • Improved test data setup and validation.
  • +149/-71
    test_files_queries.py
    Add and enhance tests for file-related SQL queries.           

    agents-api/tests/test_files_queries.py

  • Added tests for file-related SQL queries, including create, delete,
    and list operations.
  • Improved test coverage for user and agent file ownership.
  • Enhanced error handling in test cases.
  • +226/-32
    test_agent_queries.py
    Migrate agent query tests to PostgreSQL backend.                 

    agents-api/tests/test_agent_queries.py

  • Replaced Cozo client with PostgreSQL connection pool for tests.
  • Updated test cases to use async functions and new database queries.
  • Added new test cases for agent-related SQL queries.
  • Removed redundant test cases and Cozo-specific logic.
  • +99/-93 
    test_entry_queries.py
    Update entry query tests for PostgreSQL integration.         

    agents-api/tests/test_entry_queries.py

  • Migrated entry query tests to PostgreSQL backend.
  • Added async test cases for entry creation, listing, and deletion.
  • Replaced Cozo client with PostgreSQL connection pool.
  • Improved error handling for missing sessions in tests.
  • +75/-91 
    test_find_selector.py
    Disable find-selector workflow sample tests.                         

    agents-api/tests/sample_tasks/test_find_selector.py

  • Commented out all test cases for the find-selector workflow.
  • Marked tests as deprecated or temporarily disabled.
  • +125/-126
    test_user_queries.py
    Update user query tests for PostgreSQL integration.           

    agents-api/tests/test_user_queries.py

  • Migrated user query tests to PostgreSQL backend.
  • Added async test cases for user creation, updates, and deletion.
  • Replaced Cozo client with PostgreSQL connection pool.
  • Improved test coverage for patch and delete operations.
  • +107/-46
    test_tool_queries.py
    Update tool query tests for PostgreSQL integration.           

    agents-api/tests/test_tool_queries.py

  • Migrated tool query tests to PostgreSQL backend.
  • Added async test cases for tool creation, updates, and deletion.
  • Replaced Cozo client with PostgreSQL connection pool.
  • Improved test coverage for patch and list operations.
  • +58/-57 
    test_execution_queries.py
    Update execution query tests for PostgreSQL integration. 

    agents-api/tests/test_execution_queries.py

  • Migrated execution query tests to PostgreSQL backend.
  • Added async test cases for execution creation, transitions, and
    counts.
  • Replaced Cozo client with PostgreSQL connection pool.
  • Improved test coverage for temporal data lookups.
  • +65/-56 
    utils.py
    Enhance test utilities with PostgreSQL and LocalStack support.

    agents-api/tests/utils.py

  • Added utility functions for setting up PostgreSQL and LocalStack
    containers.
  • Refactored temporal testing setup for better resource management.
  • Removed in-memory S3 client and replaced with LocalStack integration.
  • Improved test utility functions for database and service mocking.
  • +57/-72 
    Enhancement
    17 files
    Sessions.py
    Enhanced session models with system templates and recall options.

    agents-api/agents_api/autogen/Sessions.py

  • Added system_template field to session models for customizable system
    prompts.
  • Introduced forward_tool_calls field to control tool call forwarding
    behavior.
  • Enhanced RecallOptions with additional fields like limit, lang, and
    metadata_filter.
  • Replaced hardcoded situation templates with optional fields for
    flexibility.
  • +83/-12 
    Sessions.py
    Updated session models with system templates and recall options.

    integrations-service/integrations/autogen/Sessions.py

  • Added system_template field for session customization.
  • Introduced forward_tool_calls field to manage tool call forwarding.
  • Expanded RecallOptions with new fields for search configuration.
  • Made situation field optional for greater flexibility.
  • +83/-12 
    utils.py
    Add security-limited utility functions and safe operation handlers.

    agents-api/agents_api/activities/utils.py

  • Introduced security-limited utility functions for safe operations like
    safe_range, safe_json_loads, and safe_base64_decode.
  • Added a restricted set of allowed functions with safe alternatives for
    potentially unsafe operations.
  • Enhanced error handling and validation for string and collection size
    limits.
  • Refactored imports and removed unused modules.
  • +193/-99
    __init__.py
    Refactor workflow execution logic and error handling.       

    agents-api/agents_api/workflows/task_execution/init.py

  • Refactored workflow execution logic for better error handling and
    logging.
  • Simplified input preparation and removed redundant steps.
  • Improved exception messages for clarity.
  • Adjusted logic for handling tool calls and transitions.
  • +67/-106
    Tasks.py
    Enhance task models with canonical name and documentation.

    agents-api/agents_api/autogen/Tasks.py

  • Added canonical_name field to task models with validation constraints.
  • Improved field documentation for task-related models.
  • Refactored model definitions for better readability and consistency.
  • +91/-74 
    Tasks.py
    Synchronize task model changes with agents API.                   

    integrations-service/integrations/autogen/Tasks.py

  • Synchronized task model changes with the agents API, including
    canonical_name field.
  • Updated field documentation and validation constraints.
  • Improved consistency with task-related models.
  • +91/-74 
    utils.py
    Add utility functions for PostgreSQL query execution.       

    agents-api/agents_api/queries/utils.py

  • Introduced utility functions for preparing and executing PostgreSQL
    queries.
  • Added decorators for query execution, exception handling, and result
    transformation.
  • Implemented concurrent execution support for query batching.
  • +300/-0 
    wait_for_input_step.py
    Refactor `wait_for_input_step` activity for clarity.         

    agents-api/agents_api/activities/task_steps/wait_for_input_step.py

  • Refactored wait_for_input_step activity for better error handling and
    logging.
  • Simplified the function definition and removed redundant mock logic.
  • Improved readability and maintainability.
  • +2/-12   
    openapi_model.py
    Refactor and cleanup OpenAPI model utilities and imports.

    agents-api/agents_api/autogen/openapi_model.py

  • Removed unused imports and refactored string formatting.
  • Consolidated error message assignments into variables for clarity.
  • Adjusted formatting for dictionary unpacking in configurations.
  • Removed RemoteObject references and related logic.
  • +48/-56 
    interceptors.py
    Enhance interceptors with blob storage and error handling.

    agents-api/agents_api/common/interceptors.py

  • Added logic to offload large results to blob storage.
  • Introduced error handling for execution functions.
  • Refactored activity and workflow interceptors for better modularity.
  • Added utility functions for blob storage integration.
  • +115/-75
    create_or_update_task.py
    Implement create or update task query with versioning.     

    agents-api/agents_api/queries/tasks/create_or_update_task.py

  • Added SQL query logic for creating or updating tasks.
  • Implemented version control for task updates.
  • Added support for inserting workflows and tools associated with tasks.
  • Integrated exception handling for database operations.
  • +225/-0 
    execute_system.py
    Refactor execute_system activity with dependency injection.

    agents-api/agents_api/activities/execute_system.py

  • Refactored execute_system to use dependency injection for database
    connections.
  • Added support for session and user update operations.
  • Improved error handling and type validation.
  • Removed redundant blob store logic.
  • +71/-16 
    state_machine.py
    Introduce execution state machine for workflow management.

    agents-api/agents_api/common/protocol/state_machine.py

  • Added a new state machine for managing execution state transitions.
  • Defined enums for transition types and execution statuses.
  • Implemented validation for state transitions.
  • Added context manager for safe state transitions.
  • +206/-0 
    generate_changelog.py
    Add changelog generation script with Julep API integration.

    scripts/generate_changelog.py

  • Added a script for generating changelogs using Julep API.
  • Implemented logic for processing PR data and generating markdown.
  • Integrated environment variable validation and error handling.
  • Added support for preserving HTML content in changelogs.
  • +189/-0 
    patch_task.py
    Implement patch task query with workflow updates.               

    agents-api/agents_api/queries/tasks/patch_task.py

  • Added SQL query logic for patching tasks with version control.
  • Implemented logic for copying or creating workflows during patch
    operations.
  • Integrated exception handling for database operations.
  • Added support for partial updates to task fields.
  • +187/-0 
    04-hook-generator-trending-reels.py
    Update trending reels hook generator task definition.       

    cookbooks/04-hook-generator-trending-reels.py

  • Updated task definition for the trending reels hook generator.
  • Modified API call parameters and response evaluation logic.
  • Improved data extraction and formatting for reels metadata.
  • Adjusted task name and tool configuration.
  • +24/-25 
    prompt_step.py
    Refactor prompt step activity for improved clarity.           

    agents-api/agents_api/activities/task_steps/prompt_step.py

  • Refactored prompt evaluation logic for better readability.
  • Improved error handling for invalid prompt expressions.
  • Added support for rendering templates in prompt steps.
  • Removed redundant blob store logic.
  • +21/-27 
    Formatting
    1 files
    Chat.py
    Code formatting improvements in Chat models.                         

    agents-api/agents_api/autogen/Chat.py

  • Simplified field annotations for better readability.
  • Reformatted long field definitions for consistency.
  • No functional changes, purely formatting improvements.
  • +13/-21 
    Error handling
    1 files
    db_exceptions.py
    Add common database exception handling utilities.               

    agents-api/agents_api/common/utils/db_exceptions.py

  • Added utility functions for handling common database exceptions.
  • Mapped asyncpg exceptions to HTTP exceptions with detailed messages.
  • Integrated support for operation-specific error handling.
  • Added validation for foreign key and unique constraint violations.
  • +192/-0 
    Configuration changes
    1 files
    env.py
    Update environment configuration for PostgreSQL integration.

    agents-api/agents_api/env.py

  • Replaced Cozo configuration with PostgreSQL DSN.
  • Added support for query timeout and max payload size.
  • Refactored environment variable parsing for clarity.
  • Removed unused Cozo-related environment variables.
  • +38/-44 
    Miscellaneous
    1 files
    constants.py
    Add constant for execution output unnesting.                         

    agents-api/agents_api/queries/executions/constants.py

    • Added a constant for unnesting execution output keys.
    [link]   
    Additional files
    101 files
    generate-changelog.yml +83/-0   
    lint-agents-api-pr.yml +5/-0     
    test-agents-api-pr.yml +5/-0     
    typecheck-agents-api-pr.yml +5/-0     
    CHANGELOG.md +102/-9 
    Dockerfile +1/-1     
    Dockerfile.migration +0/-22   
    Dockerfile.worker +1/-1     
    container.py +12/-0   
    demo.py +3/-4     
    embed_docs.py +0/-75   
    excecute_api_call.py +8/-10   
    execute_integration.py +21/-18 
    mem_mgmt.py +0/-192 
    mem_rating.py +0/-100 
    summarization.py +0/-86   
    sync_items_remote.py +4/-8     
    __init__.py +1/-1     
    base_evaluate.py +13/-27 
    cozo_query_step.py +0/-30   
    evaluate_step.py +4/-21   
    for_each_step.py +1/-12   
    get_value_step.py +5/-14   
    if_else_step.py +2/-14   
    log_step.py +3/-13   
    map_reduce_step.py +1/-12   
    pg_query_step.py +24/-0   
    raise_complete_async.py +0/-2     
    return_step.py +2/-14   
    set_value_step.py +4/-16   
    switch_step.py +2/-12   
    tool_call_step.py +3/-6     
    transition_step.py +12/-32 
    yield_step.py +6/-18   
    truncation.py +0/-60   
    types.py +0/-36   
    app.py +116/-0 
    Agents.py +40/-35 
    Docs.py +24/-0   
    Entries.py +1/-0     
    Executions.py +1/-3     
    Tools.py +8/-18   
    __init__.py +1/-4     
    async_s3.py +44/-74 
    cozo.py +0/-29   
    integrations.py +2/-2     
    litellm.py +31/-39 
    pg.py +18/-0   
    temporal.py +10/-13 
    __init__.py +0/-3     
    types.py +0/-41   
    worker.py +0/-21   
    agents.py +3/-9     
    sessions.py +1/-3     
    tools.py +0/-2     
    users.py +2/-6     
    nlp.py +2/-4     
    remote.py +20/-77 
    sessions.py +11/-15 
    tasks.py +29/-38 
    storage_handler.py +0/-226 
    __init__.py +1/-1     
    cozo.py +0/-26   
    datetime.py +2/-2     
    debug.py +2/-2     
    template.py +4/-15   
    types.py +5/-13   
    auth.py +2/-5     
    content_length.py +7/-0     
    developer_id.py +12/-14 
    query_filter.py +3/-4     
    exceptions.py +9/-0     
    counters.py +2/-1     
    model_registry.py +11/-13 
    __init__.py +0/-20   
    __init__.py +0/-22   
    create_agent.py +0/-147 
    create_or_update_agent.py +0/-186 
    delete_agent.py +0/-134 
    get_agent.py +0/-117 
    list_agents.py +0/-122 
    patch_agent.py +0/-132 
    update_agent.py +0/-149 
    get_cached_response.py +0/-15   
    prepare_chat_context.py +0/-143 
    set_cached_response.py +0/-19   
    get_developer.py +0/-74   
    create_doc.py +0/-140 
    delete_doc.py +0/-102 
    embed_snippets.py +0/-102 
    get_doc.py +0/-103 
    list_docs.py +0/-141 
    search_docs_by_embedding.py +0/-369 
    search_docs_by_text.py +0/-206 
    search_docs_hybrid.py +0/-138 
    __init__.py +0/-19   
    create_entries.py +0/-127 
    delete_entries.py +0/-153 
    get_history.py +0/-150 
    list_entries.py +0/-112 
    Additional files not shown

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    gitguardian bot commented Dec 13, 2024

    ⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

    Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

    🔎 Detected hardcoded secret in your pull request
    GitGuardian id GitGuardian status Secret Commit Filename
    14144715 Triggered Generic Password 7798826 memory-store/docker-compose.yml View secret
    🛠 Guidelines to remediate hardcoded secrets
    1. Understand the implications of revoking this secret by investigating where it is used in your code.
    2. Replace and store your secret safely. Learn here the best practices.
    3. Revoke and rotate this secret.
    4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

    To avoid such incidents in the future consider


    🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

    @creatorrr
    Copy link
    Contributor Author

    creatorrr commented Dec 14, 2024

    • switch to golang-migrate from pgmigrate

    Copy link
    Contributor

    qodo-merge-pro-for-open-source bot commented Dec 17, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit 03ecd21)

    Action: Test

    Failed stage: Run tests [❌]

    Failed test name: chat: check that chat route calls both mocks

    Failure summary:

    The action failed because the test 'chat: check that chat route calls both mocks' failed.
    Specifically:

  • The test expected a mock function called aembedding to be called during the test execution
  • However, aembedding was never called, causing an AssertionError
  • The test is located in 'tests/test_chat_routes.py'

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    1331:  PASS  test_agent_queries:44 query: create or update agent sql                2%
    1332:  PASS  test_agent_queries:63 query: update agent sql                          2%
    1333:  PASS  test_agent_queries:85 query: get agent not exists sql                  3%
    1334:  PASS  test_agent_queries:96 query: get agent exists sql                      3%
    1335:  PASS  test_agent_queries:111 query: list agents sql                          4%
    1336:  PASS  test_agent_queries:122 query: patch agent sql                          4%
    1337:  PASS  test_agent_queries:143 query: delete agent sql                         5%
    1338:  INFO:httpx:HTTP Request: POST http://testserver/agents "HTTP/1.1 403 Forbidden"
    1339:  PASS  test_agent_routes:9 route: unauthorized should fail                    6%
    ...
    
    1433:  PASS  test_execution_workflow:29 workflow: evaluate step single             37%
    1434:  PASS  test_execution_workflow:68 workflow: evaluate step multiple           37%
    1435:  PASS  test_execution_workflow:110 workflow: variable access in expressions  38%
    1436:  PASS  test_execution_workflow:152 workflow: yield step                      38%
    1437:  PASS  test_execution_workflow:201 workflow: sleep step                      39%
    1438:  PASS  test_execution_workflow:251 workflow: return step direct              39%
    1439:  PASS  test_execution_workflow:295 workflow: return step nested              40%
    1440:  PASS  test_execution_workflow:346 workflow: log step                        40%
    1441:  ERROR:temporalio.activity:Error in log_step: 'dict object' has no attribute 'hell' ({'activity_id': '1', 'activity_type': 'log_step', 'attempt': 1, 'namespace': 'default', 'task_queue': 'julep-task-queue', 'workflow_id': '30863cb5-3c87-4cc3-8163-27e26c480e87', 'workflow_run_id': '54b60ee1-4bc0-4d44-9e64-9b3c832a301f', 'workflow_type': 'TaskExecutionWorkflow'})
    1442:  ERROR:temporalio.workflow:Error in step 1: 'dict object' has no attribute 'hell' ({'attempt': 1, 'namespace': 'default', 'run_id': '54b60ee1-4bc0-4d44-9e64-9b3c832a301f', 'task_queue': 'julep-task-queue', 'workflow_id': '30863cb5-3c87-4cc3-8163-27e26c480e87', 'workflow_type': 'TaskExecutionWorkflow'})
    1443:  PASS  test_execution_workflow:396 workflow: log step expression fail        41%
    1444:  SKIP  test_execution_workf… workflow: system call   workflow: thread race   42%
    1445:  - list agents                 condition            
    1446:  INFO:httpx:HTTP Request: GET https://httpbin.org/get?test=input "HTTP/1.1 200 OK"
    1447:  PASS  test_execution_workflow:509 workflow: tool call api_call              42%
    1448:  INFO:httpx:HTTP Request: GET https://httpbin.org/status/408,429,503,504?test=input "HTTP/1.1 429 TOO MANY REQUESTS"
    1449:  ERROR:temporalio.activity:Error in execute_api_call: Client error '429 TOO MANY REQUESTS' for url 'https://httpbin.org/status/408,429,503,504?test=input'
    1450:  For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 ({'activity_id': '3', 'activity_type': 'execute_api_call', 'attempt': 1, 'namespace': 'default', 'task_queue': 'julep-task-queue', 'workflow_id': '06778d9e-3181-7f5d-8000-11ff19a1fe80', 'workflow_run_id': '0faa8dcc-fbf3-4a24-b1ec-ea68573d6ebc', 'workflow_type': 'TaskExecutionWorkflow'})
    1451:  INFO:httpx:HTTP Request: GET https://httpbin.org/status/408,429,503,504?test=input "HTTP/1.1 408 REQUEST TIMEOUT"
    1452:  ERROR:temporalio.activity:Error in execute_api_call: Client error '408 REQUEST TIMEOUT' for url 'https://httpbin.org/status/408,429,503,504?test=input'
    1453:  For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408 ({'activity_id': '3', 'activity_type': 'execute_api_call', 'attempt': 2, 'namespace': 'default', 'task_queue': 'julep-task-queue', 'workflow_id': '06778d9e-3181-7f5d-8000-11ff19a1fe80', 'workflow_run_id': '0faa8dcc-fbf3-4a24-b1ec-ea68573d6ebc', 'workflow_type': 'TaskExecutionWorkflow'})
    1454:  INFO:httpx:HTTP Request: GET https://httpbin.org/status/408,429,503,504?test=input "HTTP/1.1 503 SERVICE UNAVAILABLE"
    1455:  ERROR:temporalio.activity:Error in execute_api_call: Server error '503 SERVICE UNAVAILABLE' for url 'https://httpbin.org/status/408,429,503,504?test=input'
    1456:  For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503 ({'activity_id': '3', 'activity_type': 'execute_api_call', 'attempt': 3, 'namespace': 'default', 'task_queue': 'julep-task-queue', 'workflow_id': '06778d9e-3181-7f5d-8000-11ff19a1fe80', 'workflow_run_id': '0faa8dcc-fbf3-4a24-b1ec-ea68573d6ebc', 'workflow_type': 'TaskExecutionWorkflow'})
    1457:  INFO:httpx:HTTP Request: GET https://httpbin.org/status/408,429,503,504?test=input "HTTP/1.1 429 TOO MANY REQUESTS"
    1458:  ERROR:temporalio.activity:Error in execute_api_call: Client error '429 TOO MANY REQUESTS' for url 'https://httpbin.org/status/408,429,503,504?test=input'
    1459:  For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 ({'activity_id': '3', 'activity_type': 'execute_api_call', 'attempt': 4, 'namespace': 'default', 'task_queue': 'julep-task-queue', 'workflow_id': '06778d9e-3181-7f5d-8000-11ff19a1fe80', 'workflow_run_id': '0faa8dcc-fbf3-4a24-b1ec-ea68573d6ebc', 'workflow_type': 'TaskExecutionWorkflow'})
    1460:  INFO:httpx:HTTP Request: GET https://httpbin.org/status/408,429,503,504?test=input "HTTP/1.1 503 SERVICE UNAVAILABLE"
    1461:  ERROR:temporalio.activity:Error in execute_api_call: Server error '503 SERVICE UNAVAILABLE' for url 'https://httpbin.org/status/408,429,503,504?test=input'
    ...
    
    1510:  PASS  test_session_queries:102 query: get session does not exist            62%
    1511:  PASS  test_session_queries:116 query: list sessions                         62%
    1512:  PASS  test_session_queries:133 query: list sessions with filters            63%
    1513:  PASS  test_session_queries:152 query: count sessions                        63%
    1514:  PASS  test_session_queries:166 query: update session sql                    64%
    1515:  PASS  test_session_queries:201 query: patch session sql                     65%
    1516:  PASS  test_session_queries:228 query: delete session sql                    65%
    1517:  INFO:httpx:HTTP Request: GET http://testserver/sessions "HTTP/1.1 403 Forbidden"
    1518:  PASS  test_session_routes:7 route: unauthorized should fail                 66%
    ...
    
    1546:  PASS  test_task_queries:136 query: delete task sql - not exists             75%
    1547:  PASS  test_task_queries:155 query: list tasks sql - with filters            76%
    1548:  PASS  test_task_queries:176 query: list tasks sql - no filters              76%
    1549:  PASS  test_task_queries:194 query: update task sql - exists                 77%
    1550:  PASS  test_task_queries:230 query: update task sql - not exists             78%
    1551:  PASS  test_task_queries:257 query: patch task sql - exists                  78%
    1552:  PASS  test_task_queries:305 query: patch task sql - not exists              79%
    1553:  INFO:httpx:HTTP Request: POST http://testserver/agents/06778da2-5b1e-7111-8000-1540c05d30db/tasks "HTTP/1.1 403 Forbidden"
    1554:  PASS  test_task_routes:27 route: unauthorized should fail                   79%
    ...
    
    1585:  PASS  test_user_queries:37 query: create user sql                           89%
    1586:  PASS  test_user_queries:52 query: create or update user sql                 90%
    1587:  PASS  test_user_queries:68 query: update user sql                           90%
    1588:  PASS  test_user_queries:88 query: get user not exists sql                   91%
    1589:  PASS  test_user_queries:104 query: get user exists sql                      92%
    1590:  PASS  test_user_queries:119 query: list users sql                           92%
    1591:  PASS  test_user_queries:134 query: patch user sql                           93%
    1592:  PASS  test_user_queries:155 query: delete user sql                          93%
    1593:  PASS  test_user_routes:9 route: unauthorized should fail                    94%
    ...
    
    1619:  INFO:httpx:HTTP Request: POST http://testserver/tasks/06778da3-03a5-746c-8000-c53de64236c0/executions "HTTP/1.1 201 Created"
    1620:  PASS  test_workflow_routes:41 workflow route: evaluate step single with     99%
    1621:  yaml                                             
    1622:  INFO:httpx:HTTP Request: POST http://testserver/agents/06778da3-071b-7224-8000-60fc7319ff2c/tasks/06778da3-0746-7d71-8000-b72d3823af61 "HTTP/1.1 201 Created"
    1623:  INFO:httpx:HTTP Request: POST http://testserver/tasks/06778da3-0746-7d71-8000-b72d3823af61/executions "HTTP/1.1 201 Created"
    1624:  PASS  test_workflow_routes:83 workflow route: create or update: evaluate   100%
    1625:  step single with yaml                            
    1626:  ───────────────── chat: check that chat route calls both mocks ─────────────────
    1627:  Failed at tests/test_chat_routes.py                                           
    ...
    
    1646:  │                                                                          │  
    1647:  │ /home/runner/.local/share/uv/python/cpython-3.12.8-linux-x86_64-gnu/lib/ │  
    1648:  │ python3.12/asyncio/runners.py:118 in run                                 │  
    1649:  │                                                                          │  
    1650:  │   115 │   │                                                              │  
    1651:  │   116 │   │   self._interrupt_count = 0                                  │  
    1652:  │   117 │   │   try:                                                       │  
    1653:  │ ❱ 118 │   │   │   return self._loop.run_until_complete(task)             │  
    1654:  │   119 │   │   except exceptions.CancelledError:                          │  
    ...
    
    1659:  │ │        context = <_contextvars.Context object at 0x7f5572a54300>     │ │  
    1660:  │ │           coro = <coroutine object _ at 0x7f556a93fcc0>              │ │  
    1661:  │ │           self = <asyncio.runners.Runner object at 0x7f55709087a0>   │ │  
    1662:  │ │ sigint_handler = functools.partial(<bound method Runner._on_sigint   │ │  
    1663:  │ │                  of <asyncio.runners.Runner object at                │ │  
    1664:  │ │                  0x7f55709087a0>>, main_task=<Task finished          │ │  
    1665:  │ │                  name='Task-415' coro=<_() done, defined at          │ │  
    1666:  │ │                  /home/runner/work/julep/julep/agents-api/tests/tes… │ │  
    1667:  │ │                  exception=AssertionError("Expected 'aembedding' to  │ │  
    1668:  │ │                  have been called.")>)                               │ │  
    1669:  │ │           task = <Task finished name='Task-415' coro=<_() done,      │ │  
    1670:  │ │                  defined at                                          │ │  
    1671:  │ │                  /home/runner/work/julep/julep/agents-api/tests/tes… │ │  
    1672:  │ │                  exception=AssertionError("Expected 'aembedding' to  │ │  
    ...
    
    1714:  │ ╰──────────────────────────────────────────────────────────────────────╯ │  
    1715:  │                                                                          │  
    1716:  │ /home/runner/.local/share/uv/python/cpython-3.12.8-linux-x86_64-gnu/lib/ │  
    1717:  │ python3.12/unittest/mock.py:918 in assert_called                         │  
    1718:  │                                                                          │  
    1719:  │    915 │   │   if self.call_count == 0:                                  │  
    1720:  │    916 │   │   │   msg = ("Expected '%s' to have been called." %         │  
    1721:  │    917 │   │   │   │      (self._mock_name or 'mock'))                   │  
    1722:  │ ❱  918 │   │   │   raise AssertionError(msg)                             │  
    ...
    
    1724:  │    920 │   def assert_called_once(self):                                 │  
    1725:  │    921 │   │   """assert that the mock was called only once.             │  
    1726:  │                                                                          │  
    1727:  │ ╭───────────────────────── locals ──────────────────────────╮            │  
    1728:  │ │  msg = "Expected 'aembedding' to have been called."       │            │  
    1729:  │ │ self = <AsyncMock name='aembedding' id='140004969401040'> │            │  
    1730:  │ ╰───────────────────────────────────────────────────────────╯            │  
    1731:  ╰──────────────────────────────────────────────────────────────────────────╯  
    1732:  AssertionError: Expected 'aembedding' to have been called.                    
    1733:  ────────────────────────────────────────────────────────────────────────────────
    1734:  ╭───────────── Results ─────────────╮
    1735:  │  178  Tests Encountered           │
    1736:  │  175  Passes             (98.3%)  │
    1737:  │    1  Failures           (0.6%)   │
    1738:  │    2  Skips              (1.1%)   │
    1739:  ╰───────────────────────────────────╯
    1740:  ─────────────────────────── FAILED in 179.18 seconds ───────────────────────────
    1741:  ##[error]Process completed with exit code 1.
    ...
    
    1743:  [command]/usr/bin/git version
    1744:  git version 2.47.1
    1745:  Temporarily overriding HOME='/home/runner/work/_temp/63edf951-a24c-4b41-b8f1-5594041923ab' before making global git config changes
    1746:  Adding repository directory to the temporary git global config as a safe directory
    1747:  [command]/usr/bin/git config --global --add safe.directory /home/runner/work/julep/julep
    1748:  [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
    1749:  [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
    1750:  fatal: No url found for submodule path 'drafts/cozo' in .gitmodules
    1751:  ##[warning]The process '/usr/bin/git' failed with exit code 128
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    whiterabbit1983 and others added 25 commits December 20, 2024 15:21
    feat(agents-api): Remove auto_blob_store in favor of interceptor based system
    feat(agents-api,memory-store): Tasks queries
    Signed-off-by: Diwank Singh Tomer <[email protected]>
    HamadaSalhab and others added 28 commits January 3, 2025 01:19
    fix(agents-api,memory-store): Fix docs tests and some migrations
    Co-authored-by: qodo-merge-pro-for-open-source[bot] <189517486+qodo-merge-pro-for-open-source[bot]@users.noreply.github.com>
    feat(agents-api): added mmr to chat
    @whiterabbit1983 whiterabbit1983 merged commit 101e318 into dev Jan 5, 2025
    11 of 14 checks passed
    @whiterabbit1983 whiterabbit1983 deleted the f/switch-to-pg branch January 5, 2025 09:24
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    [Bug]: Integration tests are not working
    5 participants