feat(cubeapi): add sandbox lifecycle webhooks#690
Open
ihanzh wants to merge 1 commit into
Open
Conversation
Signed-off-by: Han Zhang <ihanzhzh@gmail.com>
Member
|
Refs #642 (this is a multi-participation issue, please use Refs instead of Closes) |
Member
|
Hello, thank you for your contribution! Since we have a large number of participants in this event, to speed up the PR review process, could you please attach some screenshots and logs (both are needed) showing the verification process and results for this PR? Thank you for your participation! |
Contributor
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
sandbox.created,sandbox.deleted,sandbox.paused, andsandbox.resumed.CUBE_API_WEBHOOKS, including event subscriptions, optional HMAC-SHA256 signatures, per-attempt timeout, and retries.examples/webhook-receiver/.docs/guide/webhooks.mdanddocs/zh/guide/webhooks.md.Validation
Format check - CubeAPI
Unit tests - CubeAPI webhook delivery
Note: the same test command first failed inside the Codex sandbox because the sandbox disallows binding temporary localhost test servers. Re-running it in the normal local environment passed as shown above.
Receiver syntax check
CubeAPI build used for dev-env verification
Docs build
Local End-to-End Verification
dev-envVM and verified CubeAPI health throughhttp://127.0.0.1:13000/health.WEBHOOK_SECRET=dev-secret.http://10.0.2.2:9000/webhook.Receiver startup and CubeAPI configuration
CubeAPI in the dev VM was started with:
CubeAPI startup log:
Lifecycle API calls
Receiver logs
Notes For Maintainers / Follow-ups
This first version intentionally keeps the implementation focused on CubeAPI lifecycle webhook delivery through
CUBE_API_WEBHOOKS.Maintainer confirmation:
timeout_secs=3,max_retries=3, with an initial exponential backoff of200ms. Please confirm whether these defaults are appropriate for production workloads.sandbox.resumedis emitted for the explicit/sandboxes/{sandboxID}/resumeAPI. Please confirm whether/sandboxes/{sandboxID}/connect, when it auto-resumes a paused sandbox, should emit the same event.flush()drains the internal dispatch queue without waiting for all spawned HTTP delivery tasks. This keeps shutdown best-effort and avoids blocking on unreachable receivers; please confirm whether bounded shutdown waiting is desired.Possible follow-up hardening:
event_idfor receiver-side retry deduplication.Related Issue
Assisted-by: OpenCode:gpt-5.5-pro