In bankruptcy you are required to disclose all of your assets and liabilities. A loan that you co-signed for is a liability. Even though you may never be asked to pay the loan, if the primary borrower makes all necessary payments, you are still liable for the loan and must report it.
When you file for bankruptcy you are required to disclose if any of your debts have co-debtors, as well. A co-debtor is someone who also agreed to pay that debt, in this case the primary borrower. Even if the debtor is discharged of their obligation for a debt, the primary borrower will still owe the debt.
In many cases, the filing of bankruptcy of one of the borrowers, even a co-signor, will constitute a default on the loan and the creditor can then accelerate the loan against the primary borrower if the debtor does not reaffirm. Accelerating the loan means that the lender requests full payment or in the case of a mortgage, forecloses. Despite this ability, in most cases lenders will not accelerate a loan, but will allow it to remain under the current terms if the primary borrower continues to make timely payments.
If you are a primary borrower on a loan and the co-signer is filing for bankruptcy, you should consult with an attorney about what your rights and obligations may be. It is important that you at least find out whether or not the co-signer intends to reaffirm their obligation to the creditor or whether you will be left owing the full amount yourself.