Skip to content

fix: initialize FixedWindowCallRatePolicy next_reset_ts to 1 minute instead of 10 days#989

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1776356495-fix-fixed-window-rate-policy-default
Open

fix: initialize FixedWindowCallRatePolicy next_reset_ts to 1 minute instead of 10 days#989
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1776356495-fix-fixed-window-rate-policy-default

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented Apr 16, 2026

Summary

Changes the initial next_reset_ts for FixedWindowCallRatePolicy from now + 10 days to now + 1 minute. The 10-day default caused a deadlock when the API did not return a ratelimit-reset header: on a 429 response, the rate limiter would sleep for ~10 days instead of recovering promptly. This was the root cause of heartbeat timeouts on the HappyFox connector (oncall#11924).

Also updated the FixedWindowCallRatePolicy component description in the YAML schema to document the 1-minute default reset behavior when no ratelimit-reset header is present.

The generated Pydantic models (declarative_component_schema.py) were regenerated via poe build, which picked up pre-existing drift between the schema and the generated file — these extra changes are not from this PR's edits.

Review & Testing Checklist for Human

  • Verify the generated model diff is safe to merge: The declarative_component_schema.py regeneration includes class reordering (ScopesJoinStrategy, BlockSimultaneousSyncsAction moved), renames (OAuthScopeScope/OptionalScope), and a type change on StreamGroup.streams (List[str]List[DeclarativeStream]). These came from schema changes already on main that hadn't been regenerated. Confirm these are expected and won't break downstream consumers.
  • Evaluate the hardcoded 1-minute default: The initial next_reset_ts is now always 1 minute regardless of the configured period. This is a safe floor, but confirm this is acceptable for connectors with very short or very long rate limit windows.
  • No new unit tests were added — consider whether the default initialization behavior should have a dedicated test case to prevent regression.

Suggested test plan: Run an existing connector that uses FixedWindowCallRatePolicy (with and without a ratelimit-reset header) and verify that (a) the initial window resets after ~1 minute, and (b) subsequent windows still align to server-provided reset timestamps when the header is present.

Notes

  • The actual behavior change is isolated to a single line in model_to_component_factory.py: datetime.timedelta(days=10)datetime.timedelta(minutes=1). Everything else is schema description updates and auto-generated model drift.
  • Connectors whose APIs do send ratelimit-reset headers are unaffected — the header value overwrites next_reset_ts on the first response regardless of the initial default.

Link to Devin session: https://app.devin.ai/sessions/00d699574c2b4fc084fb0a38d131584e


Open with Devin

… instead of 10 days

Previously, the initial reset timestamp was set to 10 days from now.
If the API did not return a ratelimit-reset header (e.g. only retry-after),
this value was never updated, causing the rate limiter to sleep for ~10 days
on a 429 response instead of respecting the configured period.

This caused a deadlock where the heartbeat monitor would kill the process
after 1.5 hours of no records emitted.

Now the initial reset timestamp defaults to now + period (e.g. 1 minute),
so the window resets promptly even when the API does not provide reset headers.

Also updated the FixedWindowCallRatePolicy component description to document
the default reset behavior when no ratelimit-reset header is present.

Resolves: airbytehq/oncall#11924
Co-Authored-By: bot_apk <apk@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This CDK Version

You can test this version of the CDK using the following:

# Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1776356495-fix-fixed-window-rate-policy-default#egg=airbyte-python-cdk[dev]' --help

# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1776356495-fix-fixed-window-rate-policy-default

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /prerelease - Triggers a prerelease publish with default arguments
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment
📚 Show Repo Guidance

Helpful Resources

📝 Edit this welcome message.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

PyTest Results (Fast)

4 018 tests  ±0   4 007 ✅ ±0   7m 9s ⏱️ -31s
    1 suites ±0      11 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 2dd1f88. ± Comparison against base commit 1256a1f.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 16, 2026

PyTest Results (Full)

4 021 tests  ±0   4 009 ✅ ±0   11m 23s ⏱️ -10s
    1 suites ±0      12 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 2dd1f88. ± Comparison against base commit 1256a1f.

♻️ This comment has been updated with latest results.

Changed from using the period variable to a hardcoded 1 minute default
as explicitly requested.

Co-Authored-By: bot_apk <apk@cognition.ai>
@devin-ai-integration devin-ai-integration Bot changed the title fix: initialize FixedWindowCallRatePolicy next_reset_ts to one period instead of 10 days fix: initialize FixedWindowCallRatePolicy next_reset_ts to 1 minute instead of 10 days Apr 16, 2026
Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

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.

0 participants