(deps commandDeps)
| 1734 | } |
| 1735 | |
| 1736 | func newTaskFailCommand(deps commandDeps) *cobra.Command { |
| 1737 | flags := taskFailCommandFlags{} |
| 1738 | |
| 1739 | cmd := &cobra.Command{ |
| 1740 | Use: "fail <run-id> [run-id...]", |
| 1741 | Short: "Fail task runs through a session-bound lease or operator override", |
| 1742 | Args: cobra.MinimumNArgs(1), |
| 1743 | Example: ` # Fail the current session's claimed run |
| 1744 | agh task fail run-123 --error "provider returned invalid JSON" |
| 1745 | |
| 1746 | # Force fail one run |
| 1747 | agh task fail run-123 --reason "operator recovery" |
| 1748 | |
| 1749 | # Force fail multiple runs with shared audit evidence |
| 1750 | agh task fail run-123 run-456 \ |
| 1751 | --reason "provider credentials revoked" \ |
| 1752 | --metadata '{"incident":"INC-42"}'`, |
| 1753 | RunE: func(cmd *cobra.Command, args []string) error { |
| 1754 | return runTaskFailCommand(cmd, args, deps, flags) |
| 1755 | }, |
| 1756 | } |
| 1757 | cmd.Flags().StringVar(&flags.reason, "reason", "", "Forced-failure reason") |
| 1758 | cmd.Flags().StringVar(&flags.errorMessage, taskErrorKey, "", "Session-bound failure message") |
| 1759 | cmd.Flags().StringVar(&flags.metadataRaw, "metadata", "", "Optional failure metadata JSON") |
| 1760 | return cmd |
| 1761 | } |
| 1762 | |
| 1763 | type taskFailCommandFlags struct { |
| 1764 | reason string |
no test coverage detected