Skip to content

feat(locks): add renewal worker - #82

Merged
swkeever merged 2 commits into
mainfrom
skeever/lock-renewal-worker
Sep 3, 2026
Merged

swkeever merged 2 commits into
mainfrom
skeever/lock-renewal-worker

Conversation

@swkeever

@swkeever swkeever commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • renew a guarded lease on one bounded daemon thread
  • stop scheduled work promptly and bound shutdown when a request stalls
  • retain renewal failures and reject lease replacement after ownership is lost
  • make the guard's package-collaboration methods explicit without exporting new SDK API

This slice does not add with_lock, context-manager cleanup, documentation, or any public facade method.

Verification

  • uv run python scripts/check_openapi.py
  • uv run ruff check .
  • uv run ruff format --check .
  • uv run mypy
  • uv run pyright
  • uv run pytest tests/unit -q
  • uv run behave features/contract --dry-run --no-snippets
  • uv run python -m build
  • Hosting SDK contract unit and shell guards

@swkeever

swkeever commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-03T14:27:32.343797Z 91a325a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5cc8f44296

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/volcano_sdk/_lock_worker.py Outdated

def _run(self) -> None:
while not self._guard.lost:
if self._stop.wait(self._guard.renewal_delay()):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop renewing once the absolute deadline cannot advance

When a guard enters the final two seconds of its 90-day absolute lifetime, renewal_delay() returns zero, but a successful renewal is still accepted with its deadline capped at the unchanged absolute deadline. This loop therefore immediately issues another renewal and can hammer the API continuously until the deadline expires; treat a renewal that cannot extend the capped deadline as terminal or otherwise avoid rescheduling it with zero delay.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in the current head. A replacement lease is now rejected when the absolute lifetime leaves no safe renewal window, so the worker terminates instead of entering a zero-delay loop.

Comment thread src/volcano_sdk/_lock_worker.py Outdated

def _run(self) -> None:
while not self._guard.lost:
if self._stop.wait(self._guard.renewal_delay()):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Recompute the renewal deadline after system suspend

On Linux, Event.wait() uses a monotonic timeout that does not advance during system suspend, while the guard deliberately calculates expiry using suspend-aware CLOCK_BOOTTIME. If the host resumes after the scheduled renewal point but while the lease still has enough time to renew, this wait retains its pre-suspend timeout and can let the lease expire instead of renewing immediately; wait in bounded slices and recompute the suspend-aware delay after each slice.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in the current head. Scheduled waits are now capped at one second and compare a fixed renewal target against the suspend-aware lease clock after every slice.

@swkeever

swkeever commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 91a325ae60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@swkeever
swkeever marked this pull request as ready for review September 3, 2026 14:27
@swkeever
swkeever merged commit f4d80ba into main Sep 3, 2026
2 checks passed
@swkeever
swkeever deleted the skeever/lock-renewal-worker branch September 3, 2026 14:27
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.

1 participant