Skip to content

Sweep status 30 seconds default frequency with env#1454

Merged
dadmobile merged 2 commits intomainfrom
update/sweep_update_frequency
Mar 4, 2026
Merged

Sweep status 30 seconds default frequency with env#1454
dadmobile merged 2 commits intomainfrom
update/sweep_update_frequency

Conversation

@dadmobile
Copy link
Copy Markdown
Member

No description provided.

@paragon-review
Copy link
Copy Markdown

paragon-review bot commented Mar 4, 2026

Paragon Summary

This pull request review identified 3 issues across 2 categories in 1 file. The review analyzed code changes, potential bugs, security vulnerabilities, performance issues, and code quality concerns using automated analysis tools.

This PR configures the sweep status service to use a default polling frequency of 30 seconds while allowing customization via an environment variable.

Key changes:

  • I don't have the actual diff content for api/transformerlab/services/sweep_status_service.py. Could you provide the git diff or the changed code so I can summarize the key changes?

Confidence score: 3/5

  • This PR has moderate risk due to 1 high-priority issue that should be addressed
  • Score reflects significant bugs, performance issues, or architectural concerns
  • Review high-priority findings carefully before merging

1 file reviewed, 3 comments

Severity breakdown: High: 1, Medium: 2


Tip: @paragon-run <instructions> to chat with our agent or push fixes!

Dashboard

ACTIVE_SWEEP_PARENT_STATUSES = {"RUNNING", "LAUNCHING"}
RUNNING_CHILD_STATUSES = {"RUNNING", "LAUNCHING"}
SWEEP_STATUS_INTERVAL_SECONDS = 3
SWEEP_STATUS_INTERVAL_SECONDS = int(os.getenv("SWEEP_STATUS_INTERVAL_SECONDS", "30"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Performance: Default sweep status interval changed from 3s to 30s

Default sweep status interval changed from 3s to 30s. Status updates appear 10x slower for users. Restore '3' as default value.

View Details

Location: api/transformerlab/services/sweep_status_service.py (lines 14)

Analysis

Default sweep status interval changed from 3s to 30s. Status updates appear 10x slower for users

What fails Default polling interval changed from 3 seconds to 30 seconds, causing 10x slower status updates
Result Users experience 30 second delays between sweep status refreshes
Expected Should either maintain backward compatibility with 3s default or document this as intentional breaking change
Impact Poor UX - users expecting near real-time updates see significant delays
How to reproduce
Start application without SWEEP_STATUS_INTERVAL_SECONDS env var, observe sweep status updates take 30s instead of 3s
AI Fix Prompt
Fix this issue: Default sweep status interval changed from 3s to 30s. Status updates appear 10x slower for users. Restore '3' as default value.

Location: api/transformerlab/services/sweep_status_service.py (lines 14)
Problem: Default polling interval changed from 3 seconds to 30 seconds, causing 10x slower status updates
Current behavior: Users experience 30 second delays between sweep status refreshes
Expected: Should either maintain backward compatibility with 3s default or document this as intentional breaking change
Steps to reproduce: Start application without SWEEP_STATUS_INTERVAL_SECONDS env var, observe sweep status updates take 30s instead of 3s

Provide a code fix.


Tip: Reply with @paragon-run to automatically fix this issue

ACTIVE_SWEEP_PARENT_STATUSES = {"RUNNING", "LAUNCHING"}
RUNNING_CHILD_STATUSES = {"RUNNING", "LAUNCHING"}
SWEEP_STATUS_INTERVAL_SECONDS = 3
SWEEP_STATUS_INTERVAL_SECONDS = int(os.getenv("SWEEP_STATUS_INTERVAL_SECONDS", "30"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Zero value creates CPU busy loop

Zero value creates CPU busy loop. asyncio.sleep(0) returns immediately causing rapid polling. Add validation for minimum value of 1.

View Details

Location: api/transformerlab/services/sweep_status_service.py (lines 14)

Analysis

Zero value creates CPU busy loop. asyncio.sleep(0) returns immediately causing rapid polling

What fails Setting SWEEP_STATUS_INTERVAL_SECONDS=0 causes busy loop with asyncio.sleep(0) returning immediately
Result CPU pegged at 100%, database polled continuously with no delay
Expected Should validate minimum value of 1 and reject or default invalid values
Impact CPU exhaustion and database connection pool exhaustion if misconfigured
How to reproduce
Set SWEEP_STATUS_INTERVAL_SECONDS=0 in environment, start application, observe CPU spike from rapid polling
AI Fix Prompt
Fix this issue: Zero value creates CPU busy loop. asyncio.sleep(0) returns immediately causing rapid polling. Add validation for minimum value of 1.

Location: api/transformerlab/services/sweep_status_service.py (lines 14)
Problem: Setting SWEEP_STATUS_INTERVAL_SECONDS=0 causes busy loop with asyncio.sleep(0) returning immediately
Current behavior: CPU pegged at 100%, database polled continuously with no delay
Expected: Should validate minimum value of 1 and reject or default invalid values
Steps to reproduce: Set SWEEP_STATUS_INTERVAL_SECONDS=0 in environment, start application, observe CPU spike from rapid polling

Provide a code fix.


Tip: Reply with @paragon-run to automatically fix this issue

ACTIVE_SWEEP_PARENT_STATUSES = {"RUNNING", "LAUNCHING"}
RUNNING_CHILD_STATUSES = {"RUNNING", "LAUNCHING"}
SWEEP_STATUS_INTERVAL_SECONDS = 3
SWEEP_STATUS_INTERVAL_SECONDS = int(os.getenv("SWEEP_STATUS_INTERVAL_SECONDS", "30"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Non-numeric env var crashes app on startup

Non-numeric env var crashes app on startup. int() raises ValueError at module import time. Add try-except with graceful fallback.

View Details

Location: api/transformerlab/services/sweep_status_service.py (lines 14)

Analysis

Non-numeric env var crashes app on startup. int() raises ValueError at module import time

What fails Invalid SWEEP_STATUS_INTERVAL_SECONDS=abc causes ValueError crash at module import time
Result Application fails to start with cryptic import error
Expected Should gracefully handle invalid input with clear error message or fallback to default
Impact Application crashes on startup if env var is misconfigured, poor developer experience
How to reproduce
Set SWEEP_STATUS_INTERVAL_SECONDS=abc in environment, start application
AI Fix Prompt
Fix this issue: Non-numeric env var crashes app on startup. int() raises ValueError at module import time. Add try-except with graceful fallback.

Location: api/transformerlab/services/sweep_status_service.py (lines 14)
Problem: Invalid SWEEP_STATUS_INTERVAL_SECONDS=abc causes ValueError crash at module import time
Current behavior: Application fails to start with cryptic import error
Expected: Should gracefully handle invalid input with clear error message or fallback to default
Steps to reproduce: Set SWEEP_STATUS_INTERVAL_SECONDS=abc in environment, start application

Provide a code fix.


Tip: Reply with @paragon-run to automatically fix this issue

@dadmobile dadmobile merged commit d61f566 into main Mar 4, 2026
8 checks passed
@sentry
Copy link
Copy Markdown

sentry bot commented Mar 4, 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants