fix: release lease on unused timeout when hooks are configured#598
fix: release lease on unused timeout when hooks are configured#598raballew wants to merge 1 commit intojumpstarter-dev:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdded an awaited call to Changes
Sequence Diagram(s)(omitted — change is a localized cleanup plus tests; no multi-component new flow requiring diagram) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@python/packages/jumpstarter/jumpstarter/exporter/exporter.py`:
- Line 625: The guard that skips sending the release RPC when
lease_ended.is_set() causes controller-initiated lease ends to never send the
RPC; update _request_lease_release to accept an optional force: bool parameter
(default False) and only skip when lease_ended.is_set() && !force, then call it
with force=True from the controller-managed path where cleanup runs (e.g., from
_cleanup_after_lease and from run_after_lease_hook / request_lease_release in
hooks.py) so the RPC is sent even if lease_ended was already set; alternatively,
if you prefer ordering, move the call to _request_lease_release() to occur
before lease_ended.set() in serve()’s controller branch, but do one of these
changes so the release RPC is guaranteed to be sent.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 976d3d4e-82a4-4fb4-93df-6c3cd6553189
📒 Files selected for processing (2)
python/packages/jumpstarter/jumpstarter/exporter/exporter.pypython/packages/jumpstarter/jumpstarter/exporter/exporter_test.py
When a lease times out without any client connection and hooks are configured, _cleanup_after_lease skipped the afterLease hook (correct) but also skipped calling _request_lease_release (bug). This left the exporter permanently stuck in LeaseReady status because the controller was never notified that the lease should be freed. Add _request_lease_release() call in the else branch of _cleanup_after_lease so the controller always frees the lease, regardless of whether the afterLease hook ran. Fixes: jumpstarter-dev#237 Generated-By: Forge/20260416_202053_681470_86fec9bd_i237 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1fcdcef to
d3815de
Compare
When a lease times out without any client connection and hooks are configured, _cleanup_after_lease skipped the afterLease hook (correct) but also skipped calling _request_lease_release (bug). This left the exporter permanently stuck in LeaseReady status because the controller was never notified that the lease should be freed.
Add _request_lease_release() call in the else branch of _cleanup_after_lease so the controller always frees the lease, regardless of whether the afterLease hook ran.
Fixes: #237