Repository navigation
Retry failed DePIN deprovisions - #422
Merged
Priyanshu-u07 merged 3 commits intoOct 24, 2026
Merged
Conversation
Priyanshu-u07
requested changes
Oct 24, 2026
Collaborator
There was a problem hiding this comment.
@Dhirenderchoudhary Good fix and checking status before stopping is the right design. Two things before merge:
- Akash is retried forever. AkashAdapter has no get_node_status, so it always gets the base class’s “unknown”. An already-closed deployment is closed again every tick, the close returns non-200, and the marker never clears (with an ERROR log each time). The “job already gone” test uses a Nosana fake, so this path isn’t covered. An Akash get_node_status needs a sidecar route first: the depin sidecar only has create, close and logs for Akash, with no /deployments/status/{id}. wait_for_ready already polls that missing route, so Akash readiness can’t work either. I’ll open an issue for both.
- A failed Nosana stop clears the marker. NosanaAdapter.deprovision_node doesn’t check the stop response, so a 500 counts as success, and the retry clears the marker while the job may still be running. Raising on ≥ 400 in the adapter would break the normal stop flow (stopping an already-ended job returns 500), so handle it in the retry instead: keep the marker until a later tick sees a terminal status, and trust the stop only when the provider can’t report status (k8s has no get_node_status).
Please add tests for both using the real adapters (fake only the HTTP layer).
Nosana's stop ignores the sidecar's HTTP status, so a successful stop call does not prove the job stopped. When the provider still reports the job alive, keep the marker and clear it on a later tick that sees a terminal status. Providers that report no status (k8s, Akash) still clear after a successful stop. Signed-off-by: Priyanshu-u07 <connect.priyanshu8271@gmail.com>
Priyanshu-u07
approved these changes
Oct 24, 2026
Priyanshu-u07
left a comment
Collaborator
There was a problem hiding this comment.
Pushed the retry fix to this branch: when the provider still reports the job running, the marker is kept after the stop and cleared once a later tick sees it stopped; with unknown status (k8s, Akash) a successful stop clears it as before. Tests added for both cases. The Akash status route is tracked in #435
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.
When stopping a Nosana or Akash job fails (sidecar down, network error), the node gets marked
terminatedwithmetadata.deprovision_failed = trueso the delete doesn't get stuck. But nothing ever reads that marker. The job keeps running and billing, and the only trace is an ERROR log saying "ops must verify/stop it manually".This makes the DePIN liveness worker (already runs every 45s) clean these up:
deprovision_failed, skipping non-DePIN providers._deprovision_direct_nodewith the pool's credential, and clears the marker once that works. If it still fails, it leaves the marker and tries again next tick.Also, the worker's own
_fail_and_teardownignored the(ok, err)that_deprovision_direct_nodereturns, so a failed stop there didn't even get the marker. It now stamps it.New repo methods:
list_deprovision_failed_nodes()andclear_deprovision_failed(node_id=...).Testing:
test_depin_liveness.py: retry succeeds -> marker cleared, retry fails -> marker kept, job already gone -> cleared without calling stop, AWS node -> skipped, teardown failure -> marker stamped. They fail on main and pass here. The rest of the file still passes.Not covered: if a pool delete hard-deletes the node row before a retry works, the marker goes with it.