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

[Ellipsis] refactor: move execution logic to queries and update imports #987

Closed

Conversation

ellipsis-dev[bot]
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot commented Dec 24, 2024

This change addresses review comments left by @creatorrr on PR #986: **feat(agents-api): Configure routes **

⚠️ We couldn't build/test your project to verify our changes. Add a Dockerfile to significantly improve code quality.

Summary:

Refactor codebase by moving execution logic to queries, updating imports, and modifying database connection handling.

Key points:

  • Refactor:
    • Move execution-related logic from models/execution to queries/executions.
    • Update imports in routers and other modules to use new queries paths.
  • Database:
    • Modify app.py to use environment variable DB_DSN for database connection.
    • Ensure postgres_pool is properly initialized and closed in app.py.
  • Routers:
    • Update all router files to use async functions and new queries paths.
    • Add or modify endpoints in agents, docs, files, sessions, tasks, and users routers.
  • Tests:
    • Update test fixtures and test cases to align with refactored code.
    • Ensure tests use the new queries paths and async functions.

You can configure Ellipsis to address comments with a direct commit or a side PR, see docs.


Something look wrong? If this Pull Request doesn't address the comments left on the above pull request, create a new PR review with more details. For more information, check the documentation.

Generated with ❤️ by ellipsis.dev

@ellipsis-dev ellipsis-dev bot requested a review from creatorrr December 24, 2024 10:34
Copy link

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

CI Failure Feedback 🧐

(Checks updated until commit b982b25)

Action: Typecheck

Failed stage: Typecheck [❌]

Failed test name: pytype

Failure summary:

The pytype type checking action failed due to multiple errors:

  • Name errors in env.py: Undefined variables cozo_host and cozo_auth
  • Import error in cozo.py: Missing module pycozo
  • Python compiler error in list_executions.py: Empty file with invalid syntax
  • Type comment errors in test_workflow_routes.py: Stray type comments

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    1258:  Generated API key since not set in the environment: 90973186618684255078691383996600
    1259:  Generated API key since not set in the environment: 47716230444899264645790105241091
    1260:  Generated API key since not set in the environment: 90530378982843707352937697064369
    1261:  Generated API key since not set in the environment: 89534291466333636509743090260807
    1262:  Generated API key since not set in the environment: 71269419488584665256185144144219ninja: Entering directory `.pytype'
    1263:  [1/372] check agents_api.autogen.Common
    1264:  [2/372] check agents_api.autogen.Docs
    1265:  [3/372] check agents_api.env
    1266:  FAILED: /home/runner/work/julep/julep/agents-api/.pytype/pyi/agents_api/env.pyi 
    1267:  /home/runner/work/julep/julep/agents-api/.venv/bin/python -m pytype.main --disable pyi-error --imports_info /home/runner/work/julep/julep/agents-api/.pytype/imports/agents_api.env.imports --module-name agents_api.env --platform linux -V 3.12 -o /home/runner/work/julep/julep/agents-api/.pytype/pyi/agents_api/env.pyi --analyze-annotated --nofail --none-is-not-bool --quick --strict-none-binding /home/runner/work/julep/julep/agents-api/agents_api/env.py
    1268:  /home/runner/work/julep/julep/agents-api/agents_api/env.py:153:15: error: in <module>: Name 'cozo_host' is not defined [name-error]
    1269:  cozo_host=cozo_host,
    1270:  ~~~~~~~~~
    1271:  /home/runner/work/julep/julep/agents-api/agents_api/env.py:154:15: error: in <module>: Name 'cozo_auth' is not defined [name-error]
    1272:  cozo_auth=cozo_auth,
    1273:  ~~~~~~~~~
    1274:  For more details, see https://google.github.io/pytype/errors.html#name-error
    ...
    
    1282:  [11/372] check agents_api.autogen.Entries
    1283:  [12/372] check agents_api.common.utils.datetime
    1284:  [13/372] check agents_api.exceptions
    1285:  [14/372] check agents_api.autogen.Agents
    1286:  [15/372] check agents_api.autogen.Tasks
    1287:  [16/372] check agents_api.common.exceptions.__init__
    1288:  [17/372] check agents_api.clients.__init__
    1289:  [18/372] check agents_api.common.utils.cozo
    1290:  FAILED: /home/runner/work/julep/julep/agents-api/.pytype/pyi/agents_api/common/utils/cozo.pyi 
    1291:  /home/runner/work/julep/julep/agents-api/.venv/bin/python -m pytype.main --disable pyi-error --imports_info /home/runner/work/julep/julep/agents-api/.pytype/imports/agents_api.common.utils.cozo.imports --module-name agents_api.common.utils.cozo --platform linux -V 3.12 -o /home/runner/work/julep/julep/agents-api/.pytype/pyi/agents_api/common/utils/cozo.pyi --analyze-annotated --nofail --none-is-not-bool --quick --strict-none-binding /home/runner/work/julep/julep/agents-api/agents_api/common/utils/cozo.py
    1292:  /home/runner/work/julep/julep/agents-api/agents_api/common/utils/cozo.py:9:1: error: in <module>: Can't find module 'pycozo'. [import-error]
    1293:  from pycozo import Client
    1294:  ~~~~~~~~~~~~~~~~~~~~~~~~~
    1295:  For more details, see https://google.github.io/pytype/errors.html#import-error
    ...
    
    1317:  [40/372] check agents_api.routers.tasks.router
    1318:  [41/372] check agents_api.routers.agents.router
    1319:  [42/372] check agents_api.common.nlp
    1320:  [43/372] check agents_api.common.utils.types
    1321:  [44/372] check agents_api.activities.summarization
    1322:  [45/372] check agents_api.rec_sum.utils
    1323:  [46/372] check agents_api.activities.truncation
    1324:  [47/372] check agents_api.queries.executions.list_executions
    1325:  FAILED: /home/runner/work/julep/julep/agents-api/.pytype/pyi/agents_api/queries/executions/list_executions.pyi 
    1326:  /home/runner/work/julep/julep/agents-api/.venv/bin/python -m pytype.main --disable pyi-error --imports_info /home/runner/work/julep/julep/agents-api/.pytype/imports/agents_api.queries.executions.list_executions.imports --module-name agents_api.queries.executions.list_executions --platform linux -V 3.12 -o /home/runner/work/julep/julep/agents-api/.pytype/pyi/agents_api/queries/executions/list_executions.pyi --analyze-annotated --nofail --none-is-not-bool --quick --strict-none-binding /home/runner/work/julep/julep/agents-api/agents_api/queries/executions/list_executions.py
    1327:  /home/runner/work/julep/julep/agents-api/agents_api/queries/executions/list_executions.py:1:1: error: : invalid syntax. Perhaps you forgot a comma? [python-compiler-error]
    1328:  [the existing file is empty]~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1329:  [the existing file is empty]
    1330:  For more details, see https://google.github.io/pytype/errors.html#python-compiler-error
    ...
    
    1351:  [68/372] check tests.test_sessions
    1352:  [69/372] check agents_api.activities.logger
    1353:  [70/372] check agents_api.__init__
    1354:  [71/372] check agents_api.worker.__init__
    1355:  [72/372] check agents_api.common.__init__
    1356:  [73/372] check agents_api.clients.worker.__init__
    1357:  [74/372] check agents_api.workflows.__init__
    1358:  [75/372] check tests.test_workflow_routes
    1359:  /home/runner/work/julep/julep/agents-api/tests/test_workflow_routes.py:65:1: error: : Stray type comment: object [ignored-type-comment]
    1360:  #   type: object~~~~~~~~~~~~~~~
    1361:  #   type: object
    1362:  /home/runner/work/julep/julep/agents-api/tests/test_workflow_routes.py:114:1: error: : Stray type comment: object [ignored-type-comment]
    1363:  #   type: object~~~~~~~~~~~~~~~
    1364:  #   type: object
    1365:  For more details, see https://google.github.io/pytype/errors.html#ignored-type-comment
    1366:  [76/372] check tests.test_chat_routes
    1367:  [77/372] check tests.sample_tasks.test_find_selector
    1368:  [78/372] check agents_api.common.exceptions.sessions
    1369:  [79/372] check agents_api.common.exceptions.users
    1370:  [80/372] check agents_api.common.utils.debug
    1371:  ninja: build stopped: cannot make progress due to previous errors.
    ...
    
    1420:  Generated API key since not set in the environment: 38406871884258369785684036998391
    1421:  Generated API key since not set in the environment: 17125430609101441718968624327239
    1422:  Generated API key since not set in the environment: 27662805884745522179813565432202
    1423:  Generated API key since not set in the environment: 77728862488391138123302789810925
    1424:  Generated API key since not set in the environment: 86792042790061142534594401342124
    1425:  Generated API key since not set in the environment: 45675014289211974356672949799990
    1426:  Analyzing 347 sources with 0 local dependencies
    1427:  Leaving directory '.pytype'
    1428:  ##[error]Process completed with exit code 1.
    

    ✨ 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.

    @creatorrr creatorrr closed this Dec 24, 2024
    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.

    1 participant