Skip to content

hotfix(cron): invoke pending-jobs endpoint alongside evaluations#882

Open
vprashrex wants to merge 2 commits into
mainfrom
fix/invoke-cron-add-pending-jobs-endpoint
Open

hotfix(cron): invoke pending-jobs endpoint alongside evaluations#882
vprashrex wants to merge 2 commits into
mainfrom
fix/invoke-cron-add-pending-jobs-endpoint

Conversation

@vprashrex
Copy link
Copy Markdown
Collaborator

@vprashrex vprashrex commented May 23, 2026

Target issue is #881

Summary

Explain the motivation for making this change. What existing problem does the pull request solve?
In the previous PR that added pending job monitoring, the invoke-cron.py script was modified locally but the changes were never pushed/included in the PR. The server-side implementation existed, but since the updated script wasn't shipped, the cron script was never calling /api/v1/cron/pending-jobs — so pending job monitoring was never actually running. This PR ships that missing change.

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran fastapi run --reload app/main.py or docker compose up in the repository root and test.
  • If you've fixed a bug or added code that is tested and has test cases.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

Warning

Review limit reached

@vprashrex, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 53 minutes and 42 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1c75a34c-317d-4422-b4c9-982632e7f45f

📥 Commits

Reviewing files that changed from the base of the PR and between a0a4b3c and 30285db.

📒 Files selected for processing (1)
  • scripts/python/invoke-cron.py
📝 Walkthrough

Walkthrough

The cron invocation script is refactored to support invoking multiple API endpoints sequentially. A new ENDPOINTS list replaces the single ENDPOINT constant. The EndpointInvoker class now accepts and iterates over multiple endpoints, with the invoke_endpoint method parameterized to target each endpoint individually. Startup and per-endpoint logging are updated to report the full endpoint list.

Changes

Multi-endpoint cron invocation

Layer / File(s) Summary
Endpoint configuration and invocation loop
scripts/python/invoke-cron.py
Configuration changes from single ENDPOINT to ENDPOINTS list with two API paths. Constructor and invoke_endpoint method signature updated to accept endpoint as parameter. Request URL building, token retry logic, startup logging, and periodic loop all updated to iterate over and invoke each configured endpoint sequentially.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • Issue #881: Implements the direct request to invoke both /api/v1/cron/evaluations and /api/v1/cron/pending-jobs by refactoring ENDPOINT to ENDPOINTS and updating EndpointInvoker.invoke_endpoint to accept an endpoint parameter.

Suggested reviewers

  • Prajna1999

Poem

🐰 Multiple endpoints now in flight,
The cron script loops both left and right,
Evaluations, jobs—no endpoint alone,
Sequential invokes in one periodic zone,
Configuration lists where single strings shone! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main change: adding support for invoking the pending-jobs endpoint alongside the existing evaluations endpoint in the cron script.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/invoke-cron-add-pending-jobs-endpoint

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vprashrex vprashrex self-assigned this May 23, 2026
@vprashrex vprashrex added bug Something isn't working ready-for-review labels May 23, 2026
@vprashrex vprashrex linked an issue May 23, 2026 that may be closed by this pull request
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/python/invoke-cron.py`:
- Around line 96-97: Update the log messages that currently read
logger.debug(f"Request URL: {self.base_url}{endpoint}") and
logger.debug(f"Request headers: {headers}") (and the other changed statements at
the same function: lines around 136–137, 147–151) to include the required
function-name prefix in square brackets; replace them with messages like
logger.debug(f"[<enclosing_function_name>] Request URL:
{self.base_url}{endpoint}") and logger.debug(f"[<enclosing_function_name>]
Request headers: {mask_string(headers)}") (substitute <enclosing_function_name>
with the actual name of the function/method that contains these logger calls and
mask any sensitive values using mask_string where appropriate). Ensure all four
affected logger calls use the same pattern and include the function name prefix.
- Around line 149-151: The loop over self.endpoints currently lets a raised
exception from invoke_endpoint abort the whole cycle; modify the for endpoint in
self.endpoints loop to wrap the await self.invoke_endpoint(client, endpoint)
call in a per-endpoint try/except so one failing endpoint does not stop others,
e.g. call invoke_endpoint inside try, on success log via
logger.info(f"[{endpoint}] invoked successfully: {result}"), and on except catch
the exception, log it with logger.error including endpoint and exception
details, then continue to the next endpoint; keep the outer exception handling
for cycle-level failures but ensure per-endpoint errors are handled locally.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 733966bd-f710-45eb-b363-4594ffe23dc5

📥 Commits

Reviewing files that changed from the base of the PR and between 5888b7e and a0a4b3c.

📒 Files selected for processing (1)
  • scripts/python/invoke-cron.py

Comment thread scripts/python/invoke-cron.py Outdated
Comment thread scripts/python/invoke-cron.py Outdated
@vprashrex vprashrex changed the title fix(cron): invoke pending-jobs endpoint alongside evaluations hotfix(cron): invoke pending-jobs endpoint alongside evaluations May 23, 2026
@sentry
Copy link
Copy Markdown

sentry Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready-for-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invoke Cron: Add pending jobs check

1 participant