Atezolizumab With or Without Cobimetinib in Treating Patients With Metastatic Bile Duct Cancer That Cannot Be Removed by Surgery or Gallbladder Cancer

This randomized phase II trial studies how well atezolizumab with or without cobimetinib works in treating patients with bile duct cancer that has spread to other places in the body (metastatic) and cannot be removed by surgery (unresectable) or gallbladder cancer. Immunotherapy with monoclonal antibodies, such as atezolizumab, may help the body's immune system attack the cancer, and may interfere with the ability of tumor cells to grow and spread. Cobimetinib is used in patients whose cancer has a mutated (changed) form of a gene called BRAF. It is in a class of medications called kinase inhibitors. It works by blocking the action of an abnormal protein that signals cancer cells to multiply. This helps slow or stop the spread of cancer cells. Giving atezolizumab with cobimetinib may work better at treating patients with bile duct and gallbladder cancer.

PRIMARY OBJECTIVE:

I. To assess the progression free survival (PFS) of patients receiving atezolizumab monotherapy and cobimetinib in combination with atezolizumab for unresectable cholangiocarcinoma.

SECONDARY OBJECTIVES:

I. To assess the overall survival (OS) of patients receiving cobimetinib in combination with atezolizumab and atezolizumab monotherapy for unresectable cholangiocarcinoma.

II. To determine the objective response rate (ORR), defined as complete plus partial response, of cobimetinib in combination with atezolizumab and atezolizumab monotherapy in patients with unresectable cholangiocarcinoma.

III. To assess the safety and tolerability of cobimetinib in combination with atezolizumab and atezolizumab monotherapy in patients with unresectable cholangiocarcinoma.

IV. To determine the relationship between PD-L1 expression in tumor at baseline and on treatment, and response to treatment.

CORRELATIVE OBJECTIVES:

I. To determine the effect of cobimetinib on CD8+ T cell infiltration in tumor. II. To determine the effect of cobimetinib on T cell subpopulations systemically and in tumor, PD-1/PD-L1 expression on tumor, and MHC 1/2 expression.

III. To determine the effect of cobimetinib on markers of immune exhaustion and pro-apoptotic factors in CD8+ effector T cells.

IV. To explore the effect of cobimetinib on local and systemic immune activation pathways and immune suppressive pathways through expression profiling.

OUTLINE: Patients are randomized to 1 of 2 arms.

ARM A: Patients receive atezolizumab intravenously (IV) over 30-60 minutes on days 1 and 15. Cycles repeat every 28 days in the absence of disease progression or unacceptable toxicity. Patients also undergo computed tomography (CT) or magnetic resonance imaging (MRI) and collection of blood samples throughout the trial and undergo tumor biopsy on study.

ARM B: Patients receive atezolizumab IV over 30-60 minutes on days 1 and 15 and cobimetinib orally (PO) once daily (QD) on days 1-21. Cycles repeat every 28 days in the absence of disease progression or unacceptable toxicity. Patients also undergo CT or MRI and collection of blood samples throughout the trial and undergo tumor biopsy on study.

After completion of study treatment, patients are followed up every 3 months until death, withdrawal of consent, or study closure, whichever occurs first.

Eligibility Criteria:
Inclusion Criteria:

* Pathologically confirmed metastatic or unresectable cholangiocarcinoma or gallbladder carcinoma (GBC), having received at least 1 prior line of systemic therapy, and received no more than 2 prior lines of therapy in the metastatic setting (disease recurrence =\< 6 months from the last dose of adjuvant therapy in resected patients will be considered the first line of therapy)

  * Includes intrahepatic cholangiocarcinoma (IHC), extrahepatic cholangiocarcinoma (EHC), and gallbladder carcinoma (GBC), but not ampulla of vater cancers
* Patients must have measurable disease, defined as at least one lesion that can be accurately measured in at least one dimension (longest diameter to be recorded for non-nodal lesions and short axis for nodal lesions) as \>= 20 mm (\>= 2 cm) with conventional techniques or as \>= 10 mm (\>= 1 cm) with spiral CT scan, MRI, or calipers by clinical exam; assessment must be completed within 4 weeks of randomization
* Age \>= 18 years. Because no dosing or adverse event data are currently available on the use of cobimetinib in combination with atezolizumab in patients \< 18 years of age, children are excluded from this study
* Eastern Cooperative Oncology Group (ECOG) performance status =\< 1 (Karnofsky \>= 80%)
* Life expectancy of greater than 2 months
* Leukocytes \>= 2,500/mcL (within 2 weeks of randomization)
* Absolute neutrophil count \>= 1,500/mcL (within 2 weeks of randomization)
* Platelets \>= 75,000/mcL (within 2 weeks of randomization)
* Hemoglobin \>= 8 g/dL (within 2 weeks of randomization)
* Total bilirubin =\< 1.5 x institutional upper limit of normal (ULN) (however, patients with known Gilbert disease who have serum bilirubin level =\< 3 x ULN may be enrolled) (within 2 weeks of randomization)
* Aspartate aminotransferase (AST) (serum glutamic-oxaloacetic transaminase \[SGOT\])/alanine aminotransferase (ALT) (serum glutamate pyruvate transaminase \[SGPT\]) =\< 3 x ULN (within 2 weeks of randomization)
* Creatinine clearance \>= 30 mL/min/1.73 m\^2 by Cockcroft-Gault OR creatinine \< 1.5 x ULN (within 2 weeks of randomization)
* International normalized ratio (INR) and activated partial thromboplastin time (aPTT) =\< 1.5 x ULN (this applies only to patients who do not receive therapeutic anticoagulation; patients receiving therapeutic anticoagulation, such as low-molecular-weight heparin or warfarin, should be on a stable dose) (within 2 weeks of randomization)
* Administration of atezolizumab and cobimetinib may have an adverse effect on pregnancy and poses a risk to the human fetus, including embryo-lethality; women of childbearing potential must agree to use either two adequate barrier methods or a barrier method plus a hormonal method of contraception to prevent pregnancy, or to abstain from heterosexual activity (complete abstinence) prior to study entry, for the duration of study participation, and for 5 months (150 days) after the last dose of study agent; should a woman become pregnant or suspect she is pregnant while she or her partner is participating in this study, she should inform her treating physician immediately; male patients must agree to use an adequate method of contraception, or to abstain from heterosexual activity (complete abstinence), prior to study entry, for the duration of study participation, and for 5 months (150 days) after the last dose of study agent
* Ability to understand and the willingness to sign a written informed consent document
* Patients positive for human immunodeficiency virus (HIV) are allowed on study, but HIV-positive patients must have:

  * A stable regimen of highly active anti-retroviral therapy (HAART)
  * No requirement for concurrent antibiotics or antifungal agents for the prevention of opportunistic infections
  * A CD4 count above 250 cells/mcL and an undetectable HIV viral load on standard polymerase chain reaction (PCR)-based tests
* Oxygen saturation \>= 92% on room air

Exclusion Criteria:

* Received chemotherapy or radiotherapy within 3 weeks prior to randomization or those who have not recovered to =\< grade 1 adverse events (other than alopecia) due to agents administered more than 3 weeks earlier; herbal therapy intended as anticancer therapy must be discontinued at least 1 week prior to randomization; for patients who received prior immunotherapy (eg anti-CTLA-4), at least five drug half-lives must have passed before the patient may enroll on this study; however, the following therapies are allowed:

  * Hormone-replacement therapy or oral contraceptives
  * Palliative radiotherapy for bone metastases \>= 2 weeks prior to randomization
* Prior treatment with a MEK inhibitor or ERK inhibitor
* Prior treatment with any anti-PD-1 or anti-PD-L1 antibody, prior allogeneic bone marrow transplantation, or prior solid organ transplantation
* Treatment with any investigational agent within 4 weeks prior to cycle 1, day 1, or five drug half-lives (whichever is longer)
* Treatment with systemic immunosuppressive medications (including, but not limited to, prednisone, cyclophosphamide, azathioprine, methotrexate, thalidomide, and anti-tumor necrosis factor \[anti-TNF\] agents) within 6 weeks prior to cycle 1 day 1;

  * Patients who have received acute, low dose, systemic immunosuppressant medications (e.g., a one-time dose of dexamethasone for nausea) may be enrolled
  * The use of inhaled corticosteroids and mineralocorticoids (e.g., fludrocortisone) for patients with orthostatic hypotension or adrenocortical insufficiency is allowed
* Patients with known primary central nervous system (CNS) malignancy or symptomatic CNS metastases, with the following exceptions:

  * Patients with asymptomatic treated CNS metastases may be enrolled, provided all the criteria listed above are met as well as the following:

    * Radiographic demonstration of clinical stability upon the completion of CNS directed therapy and no evidence of interim progression between the completion of CNS directed therapy and the screening radiographic study
    * No stereotactic radiation or whole-brain radiation within 28 days prior to randomization
    * Screening CNS radiographic study \>= 4 weeks from completion of radiotherapy and \>= 2 weeks from discontinuation of corticosteroids
* Has a known concurrent malignancy that is expected to require active treatment within two years, or may interfere with the interpretation of the efficacy and safety outcomes of this study in the opinion of the treating investigator; superficial bladder cancer, non-melanoma skin cancers, or low grade prostate cancer not requiring therapy should not exclude participation in this trial
* Known hypersensitivity to Chinese hamster ovary cell products or other recombinant human antibodies
* Allergy or hypersensitivity to components of the cobimetinib formulations
* History of congenital long QT syndrome or corrected QT interval (QTc) \> 450 msec within 2 weeks of randomization
* Left ventricular ejection fraction (LVEF) below institutional lower limit of normal (LLN) or below 50%, whichever is lower, as determined by echocardiogram or multi-gated acquisition (MUGA) scan within 4 weeks of randomization
* Patients who meet any of the following exclusion criteria related to ocular disease will be excluded from study entry:

  * Known risk factors for ocular toxicity, consisting of any of the following:

    * History of serous retinopathy
    * History of retinal vein occlusion (RVO)
    * Evidence of ongoing serous retinopathy or RVO at screening
* Patients receiving any medications or substances that are strong inhibitors or inducers of CYP3A4 enzymes are ineligible; these include St. John's wort or hyperforin (potent CYP3A4 enzyme inducer) and grapefruit juice (potent cytochrome P450 CYP3A4 enzyme inhibitor); such substances can significantly increase or decrease the serum level of cobimetinib; as part of the enrollment/informed consent procedures, the patient will be counseled on the risk of interactions with other agents, and what to do if new medications need to be prescribed or if the patient is considering a new over-the-counter medicine or herbal product
* Known clinically significant liver disease, including active viral, alcoholic, or other hepatitis; cirrhosis; fatty liver; and inherited liver disease

  * Patients with past or resolved hepatitis B infection (defined as having a negative hepatitis B surface antigen \[HBsAg\] test and a positive anti-HBc \[antibody to hepatitis B core antigen\] antibody test) are eligible
  * Patients positive for hepatitis C virus (HCV) antibody are eligible only if polymerase chain reaction (PCR) is negative for HCV ribonucleic acid (RNA)
* History or risk of autoimmune disease, including, but not limited to, systemic lupus erythematosus, rheumatoid arthritis, inflammatory bowel disease, vascular thrombosis associated with antiphospholipid syndrome, Wegener's granulomatosis, Sjogren's syndrome, Bell's palsy, Guillain-Barre syndrome, multiple sclerosis, autoimmune thyroid disease, vasculitis, or glomerulonephritis

  * Patients with a history of autoimmune hypothyroidism on a stable dose of thyroid replacement hormone may be eligible
  * Patients with controlled type 1 diabetes mellitus on a stable insulin regimen may be eligible
  * Patients with eczema, psoriasis, lichen simplex chronicus of vitiligo with dermatologic manifestations only (e.g., patients with psoriatic arthritis would be excluded) are permitted provided that they meet the following conditions:

    * Rash must cover less than 10% of body surface area (BSA)
    * Disease is well controlled at baseline and only requiring low potency topical steroids (e.g., hydrocortisone 2.5%, hydrocortisone butyrate 0.1%, flucinolone 0.01%, desonide 0.05%, aclometasone dipropionate 0.05%)
    * No acute exacerbations of underlying condition within the last 12 months (not requiring psoralen plus ultraviolet A radiation \[PUVA\], methotrexate, retinoids, biologic agents, oral calcineurin inhibitors; high potency or oral steroids)
* History of idiopathic pulmonary fibrosis, pneumonitis (including drug induced), organizing pneumonia (i.e., bronchiolitis obliterans, cryptogenic organizing pneumonia, etc.), or evidence of active pneumonitis on screening chest computed tomography (CT) scan; history of radiation pneumonitis in the radiation field (fibrosis) is permitted
* Severe infections within 4 weeks prior to randomization, including, but not limited to, hospitalization for complications of infection, bacteremia, or severe pneumonia
* Signs or symptoms of infection within 2 weeks prior to randomization
* Received oral or intravenous (IV) antibiotics within 2 weeks prior to randomization; patients receiving prophylactic antibiotics (e.g., for prevention of a urinary tract infection or chronic obstructive pulmonary disease) are eligible
* Major surgical procedure within 4 weeks prior to randomization or anticipation of need for a major surgical procedure during the course of the study
* Administration of a live, attenuated vaccine within 4 weeks before randomization or anticipation that such a live, attenuated vaccine will be required during the study and up to 5 months after the last dose of atezolizumab

  * Influenza vaccination should be given during influenza season only (approximately October to March); patients must not receive live, attenuated influenza vaccine within 4 weeks prior to cycle 1, day 1 or at any time during the study
* Uncontrolled intercurrent illness including, but not limited to, ongoing or active infection, active tuberculosis (TB), symptomatic congestive heart failure (CHF), unstable angina pectoris, cardiac arrhythmia, or psychiatric illness/social situations that would limit compliance with study requirements

  * Symptomatic CHF is defined as New York Heart Association (NYHA) CHF class II or higher disease
* Pregnant women are excluded from this study because both atezolizumab and cobimetinib are expected to cause fetal harm if used during pregnancy; because there is an unknown but potential risk for adverse events in nursing infants secondary to treatment of the mother with cobimetinib or atezolizumab, breastfeeding should be discontinued if the mother is treated with either therapy; these potential risks may also apply to other agents used in this study
* Inability or unwillingness to swallow pills
* History of malabsorption syndrome or other condition that would interfere with enteral absorption
* Clinically significant ascites, defined as ascites that is symptomatic or has resulted in a paracentesis in the past 3 months