Skip to content

Conversation

@CaptWake
Copy link

@CaptWake CaptWake commented Dec 5, 2025

When submitting a sample through the API without specifying the clock, the parse_request_arguments() function automatically sets the clock to the submission time. Later, the analysis manager tries to update the clock before running the task. However, the clock update only works correctly if the timestamp is set to 0 (database.py)

This behavior can cause problems in large-scale analyses, where there can be a significant delay (even days) between submission and execution. In such cases, if the sample makes network requests, they can fail due to the large discrepancy between the submission time and the actual task execution time.

Setting the clock to 0 instead of the submission time ensures that the clock update in the analysis manager works correctly, preventing this issue

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CaptWake, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue in how CAPEv2 handles clock synchronization for API-submitted tasks. By adjusting the default clock value to the Unix epoch when not specified, it ensures that the analysis manager can properly set the task's clock, preventing failures in network requests that arise from significant time differences between submission and execution. This enhancement improves the reliability and robustness of analyses, especially in environments with potential processing delays.

Highlights

  • API Clock Handling: Modified the parse_request_arguments function to set the default clock value to datetime.utcfromtimestamp(0) when no clock is explicitly provided in API submissions. Previously, it defaulted to the current submission time.
  • Improved Analysis Stability: This change resolves an issue where a large delay between API submission and task execution could cause network requests to fail due to time discrepancies. Setting the clock to 0 ensures the analysis manager can correctly update the clock before the task runs.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to fix an issue with clock handling for API submissions by setting the clock to epoch when it's not specified. The change correctly handles an empty clock parameter but misses the case where the parameter is not provided at all, which would still default to the submission time. I've suggested a simplification that addresses both scenarios and makes the code's intent clearer.

@kevoreilly
Copy link
Owner

Thanks very much.

I am certainly intrigued by what scale might see days of delay!

@CaptWake
Copy link
Author

CaptWake commented Dec 5, 2025

Thanks very much.

I am certainly intrigued by what scale might see days of delay!

I’ve experienced this when submitting around 20k PE samples, with the timeout set to 3 minutes and using 10 VMs.

I was submitting the samples through the API using a simple sequential submission script, and some tasks started to run several days later after the submission

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