Skip to content

fix: skip afterLease hook on client disconnect without EndSession#601

Draft
raballew wants to merge 2 commits intojumpstarter-dev:mainfrom
raballew:051-fix-premature-lease-release
Draft

fix: skip afterLease hook on client disconnect without EndSession#601
raballew wants to merge 2 commits intojumpstarter-dev:mainfrom
raballew:051-fix-premature-lease-release

Conversation

@raballew
Copy link
Copy Markdown
Member

Summary

  • When a client exits a shell on a pre-created lease (release=False), the client does not call EndSession, but _cleanup_after_lease would unconditionally run the afterLease hook and release the lease
  • Add _should_run_after_lease_cleanup guard that skips afterLease hook and lease release when EndSession was not requested, lease has not expired, and exporter is not shutting down

Closes #238

Test plan

  • Verify afterLease hook is skipped on disconnect without EndSession
  • Verify afterLease hook still runs on normal lease end and expiry
  • Run make pkg-test-jumpstarter

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a5d60e49-65ef-41f1-af8d-b5da0934d668

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

raballew and others added 2 commits April 17, 2026 12:39
…mpstarter-dev#238)

When a client exits a shell on a pre-created lease (release=False), the
client does not call EndSession. Previously, _cleanup_after_lease would
unconditionally run the afterLease hook and release the lease, making the
pre-created lease unusable for reconnection.

Add _should_run_after_lease_cleanup guard that skips afterLease hook and
lease release when all of these conditions hold: EndSession was not
requested, lease has not expired, and exporter is not shutting down. This
keeps the lease active for reconnection.

Existing tests updated to set lease_ended where they simulate lease
expiry scenarios, matching the actual runtime behavior.

Generated-By: Forge/20260416_202053_681470_ddfd9aba_i238
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The _should_run_after_lease_cleanup guard requires at least one
condition to be set. Set lease_ended since the test simulates a
scenario where cleanup is forced after timeout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@raballew raballew force-pushed the 051-fix-premature-lease-release branch from 52fd11a to 7dfa52f Compare April 17, 2026 10:45
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.

hooks enabled: exiting a shell from a lease created with jmp create lease is causing a premature release.

1 participant