Add lifecycle hooks for tasks and the overall workflow graph#116
Draft
Copilot wants to merge 6 commits into
Draft
Add lifecycle hooks for tasks and the overall workflow graph#116Copilot wants to merge 6 commits into
Copilot wants to merge 6 commits into
Conversation
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> Agent-Logs-Url: https://github.com/kitproj/kit/sessions/553f2363-3908-4c91-ba67-90c952a74bf0
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> Agent-Logs-Url: https://github.com/kitproj/kit/sessions/553f2363-3908-4c91-ba67-90c952a74bf0
Copilot
AI
changed the title
[WIP] Discuss potential hooks for project
Add lifecycle hooks for tasks and the overall workflow graph
Mar 20, 2026
alexec
requested changes
Jun 21, 2026
Collaborator
|
@copilot fix conflicts. Make sure hooks cancel |
Contributor
Author
Conflicts resolved and hook cancellation fixed.
|
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.
Implements
onSuccessandonFailurelifecycle hooks at two scopes: individual tasks and the overall workflow graph.New types (
internal/types/lifecycle.go)Lifecycle— groupsonSuccessandonFailurehooks as task name references; nil-safe accessors on bothLifecycleandTaskPer-task hooks (
Task.Lifecycle)Run after a task transitions to
succeededorfailed, before any restart logic. The hook values are names of tasks already defined in the workflow file:Graph-level hooks (
Spec.Lifecycle)Run when the entire workflow exits.
onSuccessfires only on clean internal completion (not on Ctrl+C);onFailurefires when any task fails without restart. Graph hooks run with asignal.NotifyContextcontext so that a second SIGTERM/SIGINT/SIGHUP while the hook is executing will cancel it cleanly (the hook process receives SIGTERM and is killed after the grace period).All hooks are best-effort — failures are logged but do not affect task or graph outcome. The named hook task is looked up and executed via the same
proc.New()mechanism used for all other tasks. JSON schema updated to reflect the new types.💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.