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

TOTP code db + agent support for fetching totp_code from db #784

Merged
merged 2 commits into from
Sep 8, 2024

Conversation

ykeremy
Copy link
Contributor

@ykeremy ykeremy commented Sep 8, 2024

🚀 This description was created by Ellipsis for commit 931092d

Summary:

This PR adds a totp_codes table and updates models and functions to support TOTP verification with a totp_identifier.

Key points:

  • Add totp_codes table via Alembic migration.
  • Introduce TOTPCodeModel with fields: totp_code_id, totp_identifier, organization_id, task_id, workflow_id, content, code, source, created_at, modified_at, expired_at.
  • Add totp_identifier column to tasks, workflow_runs, workflows tables.
  • Create indices for created_at, expired_at, totp_identifier in totp_codes table.
  • Update create_task and create_workflow functions to handle totp_identifier.
  • Modify TaskBlock and Workflow classes to include totp_identifier.
  • Update poll_verification_code function to use totp_identifier.
  • Modify cloud/prompts/cloud/parse-verification.j2 to include reasoning and code_found fields.

Generated with ❤️ by ellipsis.dev

<!-- ELLIPSIS_HIDDEN -->

| 🚀 | This description was created by [Ellipsis](https://www.ellipsis.dev) for commit b9b2ccac68229959264888b7141bbaa74f9e100f  |
|--------|--------|

### Summary:
This PR adds a `totp_codes` table and updates models, functions, and templates for TOTP verification using a `totp_identifier`.

**Key points**:
- Add `totp_codes` table via Alembic migration.
- Introduce `TOTPCodeModel` with fields: `totp_code_id`, `totp_identifier`, `organization_id`, `task_id`, `workflow_id`, `content`, `code`, `source`, `created_at`, `modified_at`, `expired_at`.
- Add `totp_identifier` column to `tasks`, `workflow_runs`, `workflows` tables.
- Create indices for `created_at`, `expired_at`, `totp_identifier` in `totp_codes` table.
- Update `create_task` and `create_workflow` functions to handle `totp_identifier`.
- Modify `TaskBlock` and `Workflow` classes to include `totp_identifier`.
- Update `poll_verification_code` function to use `totp_identifier`.
- Modify `cloud/prompts/cloud/parse-verification.j2` to include `reasoning` and `code_found` fields.

----
Generated with ❤️ by [ellipsis.dev](https://www.ellipsis.dev)

<!-- ELLIPSIS_HIDDEN -->
@ykeremy ykeremy added the sync label Sep 8, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 0b248e9 in 30 seconds

More details
  • Looked at 566 lines of code in 13 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. skyvern/webeye/actions/handler.py:1997
  • Draft comment:
    If get_totp_codes already filters out expired codes, this check might be redundant. Consider removing it to improve performance slightly.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The function _get_verification_code_from_db in skyvern/webeye/actions/handler.py has a potential issue with the expiration check. The check totp_code.expired_at < datetime.utcnow() might not be necessary if the get_totp_codes function already filters out expired codes. This could lead to redundant checks and slight performance inefficiency.

Workflow ID: wflow_eWcpSbmB5K3JHoOz


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 0b248e9 in 35 seconds

More details
  • Looked at 565 lines of code in 13 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. skyvern/webeye/actions/handler.py:1941
  • Draft comment:
    Consider adding a maximum number of iterations or a maximum wait time to prevent potential infinite loops in the poll_verification_code function.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The function poll_verification_code in skyvern/webeye/actions/handler.py has a potential issue with the timeout logic. The current implementation checks if the current time exceeds the timeout, but it does not handle the case where the loop might run indefinitely if the timeout is not reached. It would be better to ensure that the loop exits after a certain number of iterations or a maximum wait time to prevent potential infinite loops.

Workflow ID: wflow_fsiTeESpaspUkkvu


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 931092d in 16 seconds

More details
  • Looked at 75 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. alembic/versions/2024_09_08_2159-c5848cc524b1_create_totp_codes_table_and_add_task_.py:35
  • Draft comment:
    The modified_at column should be nullable to allow for initial creation without modification. Consider setting nullable=True.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment is relevant to the changes made in the diff, as it addresses a potential issue with the 'modified_at' column being non-nullable. Making 'modified_at' nullable could be a valid suggestion to prevent issues during initial record creation. The comment is actionable and clear, suggesting a specific change to the code.
    The comment might be considered speculative if the current implementation is intentional and the 'modified_at' field is always expected to have a value. However, the suggestion is practical and could prevent potential issues.
    Even if the current implementation is intentional, the suggestion to make 'modified_at' nullable is a common practice to avoid issues during initial creation. It's a valid point to consider.
    Keep the comment as it provides a clear and actionable suggestion related to the changes made in the diff.

Workflow ID: wflow_DN6NbqyBG8IfgMSu


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@wintonzheng wintonzheng merged commit b9f5e33 into main Sep 8, 2024
2 checks passed
@wintonzheng wintonzheng deleted the shu/totp_code_system branch September 8, 2024 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants