fix: page ready agents during health-check startup#345
Open
scale-sf wants to merge 1 commit into
Open
Conversation
8586b34 to
dd0e73d
Compare
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests
Greptile Summary
This PR fixes startup health-check workflow scheduling to page through only
READYagents rather than loading the entire agent table into Python memory and filtering client-side. A stableorder_by="id"sort is included, and a new unit test file covers the two critical pagination boundary conditions.run_healthcheck_workflow.py: adds awhile Truepagination loop that fetches up to 200 READY agents per page, breaks on an empty page or a partial page, and removes the old in-Python status filter.test_run_healthcheck_workflow.py: two async unit tests — one exercising multi-page traversal and one verifying the empty-page break when total count is an exact multiple of page size.Confidence Score: 5/5
Safe to merge — the pagination loop is logically sound, both break conditions are correct, and the stable sort by id was included from the start.
The change is narrowly scoped to startup agent enumeration, eliminates a full table scan, and the pagination logic correctly handles empty pages, partial pages, and exact-multiple page counts. The previous review concerns (stable sort key, boundary test) are both addressed in this PR.
No files require special attention.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[start main] --> B[load GlobalDependencies] B --> C{env configured?} C -- no --> Z1[return] C -- yes --> D{health-check enabled?} D -- no --> Z2[return] D -- yes --> E{Temporal configured?} E -- no --> Z3[return] E -- yes --> F[init AgentRepository + TemporalAdapter] F --> G[page_number = 1] G --> H[agent_repo.list\nfilters=READY\norder_by=id\npage=page_number] H --> I{agents empty?} I -- yes --> Z4[done] I -- no --> J[for each agent:\nstart_workflow or log skip] J --> K{len agents < PAGE_SIZE?} K -- yes, last page --> Z4 K -- no --> L[page_number += 1] L --> H%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A[start main] --> B[load GlobalDependencies] B --> C{env configured?} C -- no --> Z1[return] C -- yes --> D{health-check enabled?} D -- no --> Z2[return] D -- yes --> E{Temporal configured?} E -- no --> Z3[return] E -- yes --> F[init AgentRepository + TemporalAdapter] F --> G[page_number = 1] G --> H[agent_repo.list\nfilters=READY\norder_by=id\npage=page_number] H --> I{agents empty?} I -- yes --> Z4[done] I -- no --> J[for each agent:\nstart_workflow or log skip] J --> K{len agents < PAGE_SIZE?} K -- yes, last page --> Z4 K -- no --> L[page_number += 1] L --> HReviews (3): Last reviewed commit: "fix: page ready agents for health checks" | Re-trigger Greptile