feat(sdk): add task retry/cancel methods and expose available actions#1187
Merged
Merged
Conversation
Deploying infrahub-sdk-python with
|
| Latest commit: |
4172f36
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7c3199c0.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://pmi-20260716-sdk-retry-cance.infrahub-sdk-python.pages.dev |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## infrahub-develop #1187 +/- ##
====================================================
+ Coverage 83.03% 83.10% +0.07%
====================================================
Files 139 139
Lines 12365 12403 +38
Branches 1846 1849 +3
====================================================
+ Hits 10267 10308 +41
+ Misses 1531 1528 -3
Partials 567 567
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Add retry() and cancel() convenience methods to InfrahubTaskManager and InfrahubTaskManagerSync, wrapping the InfrahubTaskRetry/InfrahubTaskCancel mutations so consumers no longer fall back to raw execute_graphql calls. Surface the backend's available_actions on the Task model along with can_retry/can_cancel helpers and an include_actions query flag, so callers can introspect eligibility rather than acting blind. The server remains authoritative and still rejects ineligible actions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
polmichel
force-pushed
the
pmi-20260716-sdk-retry-cancel-tasks
branch
from
July 16, 2026 13:08
3b9ca2c to
4436703
Compare
polmichel
force-pushed
the
pmi-20260716-sdk-retry-cancel-tasks
branch
from
July 16, 2026 13:11
3f9adf7 to
4436703
Compare
Contributor
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
The limit fast path in filter() built its query without forwarding include_logs / include_related_nodes / include_actions, so those fields (including available_actions) were silently dropped for all(limit=...) and filter(limit=...). Forward all three in both async and sync paths. Also harden the retry/cancel tests to assert the outgoing GraphQL mutation name and input id, so wiring regressions surface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
polmichel
marked this pull request as ready for review
July 16, 2026 15:01
ajtmccarty
approved these changes
Jul 16, 2026
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.
Why
The Infrahub backend added
InfrahubTaskRetryandInfrahubTaskCancelmutations (opsmill/infrahub#9754) for recovering webhook deliveries, but the SDK's task manager was read-only.Tracked in IFC-2836
Goal: give
client.taskfirst-class retry/cancel methods, and let callers see which actions a task actually supports.What changed
Behavioral changes:
client.task.retry(id)— replays a settled task as a new independent task, returning the new task id. WrapsInfrahubTaskRetry.client.task.cancel(id)— cancels an in-flight task, returning theokflag. WrapsInfrahubTaskCancel.Tasknow carriesavailable_actions(mirroring the backendTaskActiontype) withcan_retry/can_cancelconvenience properties.include_actions=True(threaded throughall/filter/get), alongside the existinginclude_logs/include_related_nodes.InfrahubClientandInfrahubClientSync.How to test
🤖 Generated with Claude Code