Skip to content

Conversation

@taeold
Copy link
Contributor

@taeold taeold commented Nov 27, 2025

Rollback #9464

Firebase CLI will now synchronizes Cloud Scheduler's attemptDeadline with the function's timeoutSeconds for v2 scheduled functions, capped at 1800 seconds.

This is a change from original attempt where we tried to expose a new configuration for scheduled function that allowed users to directly set the attemptDeadline. We don't know why they would ever drift, so we'll simplify make sure the Scheduler's timeout is in sync with functions timeout.

Note that Cloud Scheduler has an attempt deadline range of [15s, 1800s], and defaults to 180s. We floor at 180s to be safe, even if the function timeout is shorter.

This is because GCF/Cloud Run will already terminate the function at its configured timeout, so Cloud Scheduler won't actually wait the full 180s unless GCF itself fails to respond. Setting it shorter than 180s might cause premature retries due to network latency.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @taeold, 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 streamlines the management of scheduled Firebase functions by removing the explicit attemptDeadlineSeconds configuration. Instead, the Firebase CLI will now automatically align Cloud Scheduler's attemptDeadline with the function's timeoutSeconds, ensuring consistent behavior. This synchronization includes intelligent capping at 1800 seconds and a minimum floor of 180 seconds to optimize retry mechanisms and prevent unexpected function executions. The change simplifies the user experience while maintaining robust scheduling.

Highlights

  • Rollback of attemptDeadlineSeconds configuration: The previous attempt to expose attemptDeadlineSeconds as a direct configuration for scheduled functions has been rolled back.
  • Automatic Synchronization: Cloud Scheduler's attemptDeadline will now automatically synchronize with the function's timeoutSeconds for v2 scheduled functions.
  • Deadline Capping: The synchronized attemptDeadline will be capped at a maximum of 1800 seconds (30 minutes), aligning with Cloud Scheduler's limits.
  • Minimum Deadline Enforcement: The attemptDeadline will be floored at 180 seconds (3 minutes) to prevent premature retries due to network latency, even if the function's timeoutSeconds is shorter.
  • User Warning for Exceeded Timeout: A warning will now be issued if a scheduled function's timeoutSeconds exceeds 1800 seconds, informing the user about the capping behavior and potential implications.
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 simplifies the configuration for scheduled functions by removing the user-facing attemptDeadlineSeconds and instead synchronizing the Cloud Scheduler's attempt deadline with the function's timeoutSeconds. The implementation correctly caps the deadline at 30 minutes and floors it at 180 seconds to prevent premature retries, which is a sensible default. The changes are consistently applied across interfaces, validation logic, and tests. Overall, this is a solid improvement that reduces complexity for users.

### Description
Automatically synchronizes Cloud Scheduler's attemptDeadline with the function's timeoutSeconds for v2 scheduled functions, capped at 1800 seconds.
- Removes attemptDeadlineSeconds as a user-configurable field in the manifest.
- Adds a warning when timeoutSeconds exceeds 1800 seconds for scheduled functions.
- Refactors validation logic for scheduled timeouts.

### Scenarios Tested
- Unit tests for cloudscheduler.ts and validate.ts.
- Verified that attemptDeadline is correctly set and capped.
- Verified warning message is logged when timeout exceeds 1800s.
@taeold taeold force-pushed the feat/sync-scheduled-timeout branch from 6a9d74a to e06fb91 Compare November 27, 2025 00:35
@taeold
Copy link
Contributor Author

taeold commented Nov 27, 2025

/gemini review

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 correctly synchronizes the Cloud Scheduler attemptDeadline with the function's timeoutSeconds, including the capping and flooring logic. The removal of the user-facing attemptDeadlineSeconds configuration is a good simplification and has been applied consistently. I've added a few suggestions to improve maintainability by removing magic numbers and duplicated constants, and to clarify a comment in a test. Overall, this is a solid improvement.

@taeold
Copy link
Contributor Author

taeold commented Nov 27, 2025

/gemini review

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 synchronizes the Cloud Scheduler's attemptDeadline with the function's timeoutSeconds for v2 scheduled functions, which is a great simplification from the previous approach. The implementation looks solid, and the new tests cover the capping and flooring logic correctly. I've added a few suggestions to improve code clarity by renaming some constants for better descriptiveness and using a template literal for a warning message to enhance readability. Overall, great work on this feature.

@taeold
Copy link
Contributor Author

taeold commented Nov 27, 2025

/gemini review

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 rolls back a previous change and introduces a more straightforward approach for handling scheduled function timeouts. It synchronizes the Cloud Scheduler's attemptDeadline with the function's timeoutSeconds, applying a floor of 180s and a cap of 1800s. The changes are consistently applied across the codebase, removing the user-configurable attemptDeadlineSeconds and updating interfaces, validation, and tests accordingly. A helpful warning has also been added for when a function's timeout exceeds the maximum deadline. The implementation is solid, and I have one minor suggestion to improve code readability.

@taeold taeold enabled auto-merge (squash) December 2, 2025 18:47
@taeold taeold merged commit 0001855 into master Dec 2, 2025
48 checks passed
@taeold taeold deleted the feat/sync-scheduled-timeout branch December 2, 2025 18:59
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