Epacadostat and Pembrolizumab Before Surgery in Treating Participants With Stage II-III Esophageal or Gastroesophageal Cancer

This phase II trial studies the side effects of epacadostat and pembrolizumab and to see how well they work before surgery in treating participants with stage II-III esophageal or gastroesophageal cancer. Epacadostat may stop the growth of tumor cells by blocking some of the enzymes needed for cell growth. Monoclonal antibodies, such as pembrolizumab, may interfere with the ability of the tumor cells to grow and spread. Giving epacadostat and pembrolizumab before surgery may work better in treating participants with stage II-III esophageal or gastroesophageal cancer.

PRIMARY OBJECTIVES:

I. To establish that the combination of epacadostat and pembrolizumab will lead to an increase in tumor infiltrating cytotoxic T-cells and circulating cytotoxic T cells and a reduction in immunosuppressive Tregs and myeloid-derived suppressor cells (MDSCs) in esophageal/gastroesophageal junction (GEJ) tumors that can arise after treatment with neoadjuvant chemoradiation.

II. To assess safety and tolerability of pembrolizumab and epacadostat (immunotherapy) in this patient population.

SECONDARY OBJECTIVES:

I. To evaluate pathologic complete response rate (path CR) and correlate with tumor T-cell response.

II. To evaluate complete clinical response rate (clinical CR) and subsequent avoidance of esophagectomy and correlate with tumor T-cell response.

III. To evaluate toxicities with the combination of pembrolizumab and epacadostat in this treatment setting.

IV. To evaluate disease-free survival (DFS) and overall survival (OS) in this treatment population.

EXPLORATORY OBJECTIVES:

I. To measure changes in whole genome serum micro ribonucleic acid (miRNA) signatures before and after protocol therapy and correlate with tumor/immune/stromal cell miRNA expression profiling determined by deep sequencing.

II. To assess the role of circulating miR-23a as serum biomarker given its role as an oncomir in esophagastric cancer and reporting in the literature of suppressing tumor cytotoxic T cells in preclinical models.

III. To correlate diversity in the gut microbiome with path CR and clinical CR after treatment with pembrolizumab and epacadostat.

IV. To measure serial plasma kynurenine/tryptophan ratio levels as a pharmacodynamic marker of increased IDO1 activity and response.

V. Association of PD-L1 expression, microsatellite stability and/or IDO1 expression and pathological complete response (pCR) rate.

OUTLINE:

Starting 14 days after completion of standard of care chemoradiotherapy, participants receive epacadostat orally (PO) twice daily (BID) during weeks 3-8 and pembrolizumab intravenously (IV) over 30 minutes on day 1 of weeks 3 and 6 in the absence of disease progression or unacceptable toxicity.

After completion of study treatment, participants are followed up at one month and then every 3 months in year 1, every 4 months in year 2, and every 6 months in year 3.

Eligibility Criteria:
Inclusion Criteria:

* Documented informed consent of the participant and/or legally authorized representative
* Agreement to allow the use of archival tissue from diagnostic tumor biopsies

  * If unavailable, exceptions may be granted only with study principal investigator (PI) approval
* Eastern Cooperative Oncology Group (ECOG) =\< 2
* Non-metastatic cancer of the esophagus OR esophagus and gastroesophageal junction (GEJ; tumor extending =\< 2 cm into the stomach)
* Confirmed stage II-III diagnosis of one of the following:

  * Squamous cell; OR
  * Adenocarcinoma; OR
  * Mixed adenosquamous carcinoma
* Deemed appropriate for neoadjuvant chemoradiation by the multidisciplinary team (surgeon, medical oncologist, and radiation oncologist)

  * Chemotherapy defined as weekly carboplatin/paclitaxel; AND
  * Radiation defined as external beam radiotherapy defined as: 50.4 gray (Gy) as per institutional and national treatment guidelines
* Deemed appropriate for esophagectomy or repeat endoscopic biopsies if non-operative management is pursued
* Absolute neutrophil count (ANC) \>= 1500/mm\^3 within 14 days prior to day 1 of study participation/1st endoscopic biopsy
* Platelets \>= 100,000/mm\^3 within 14 days prior to day 1 of study participation/1st endoscopic biopsy
* Serum total bilirubin =\< 1.5 x upper limit of normal (ULN) OR direct bilirubin =\< ULN if total bilirubin levels \> 1.5 x ULN within 14 days prior to day 1 of study participation/1st endoscopic biopsy
* Aspartate aminotransferase (AST) =\< 2 x ULN within 14 days prior to day 1 of study participation/1st endoscopic biopsy
* Alanine aminotransferase (ALT) =\< 2 x ULN within 14 days prior to day 1 of study participation/1st endoscopic biopsy
* Creatinine =\<1.5 x ULN OR for patients with Creatinine \>1.5 x ULN Creatinine clearance of \>=60 ml/min per 24 hour urine test or the Cockcroft-Gault formula
* International normalized ratio (INR) or prothrombin time (PT) =\< 1.5 x ULN within 14 days prior to day 1 of study participation/1st endoscopic biopsy
* Activated partial thromboplastin time (aPTT) =\< 1.5 x ULN
* Female of childbearing potential only: negative urine or serum pregnancy test; if the urine test is positive or cannot be confirmed as negative, a serum pregnancy test will be required
* Agreement by women of childbearing potential (WOCBP) and males of childbearing potential to use an effective method of birth control or abstain from heterosexual activity for the course of the study through at least 120 days after the last dose of protocol therapy

  * Childbearing potential defined as not being surgically sterilized (men and women) or have not been free from menses for \> 1 year (women only)

Exclusion Criteria:

* Immune checkpoint inhibitor(s) (e.g. anti-PD-1, anti-CTLA4)
* Indoleamine-2,3-dioxygenase (IDO) inhibitors
* Radiotherapy within 21 days prior to day 1 of study participation
* Investigational agent within 21 days prior to Day 1 of study participation
* Live-virus vaccination within 30 days prior to Day 1 of study participation
* Systemic cytotoxic chemotherapy, antineoplastic biologic therapy, or major surgery within 21 days of study participation
* Chronic systemic steroid therapy or on any other form of immunosuppressive medication
* Monoamine oxidase inhibitors (MAOI) or any drug associated with MAOI activity
* Any UGT1A9 inhibitors (including acitretin, amitriptyline, androsterone, cyclosporine, dasatinib, diclofenac, diflunisal, efavirenz, erlotinib, estradiol (17-beta), flutamide, gefitinib, gemfibrozil, glycyrrhetinic acid glycyrrhizin, imatinib, imipramine, ketoconazole, linoleic acid supplements, mefenamic acid, and mycophenolic acid, niflumic acid, nilotinib, phenobarbital, phenylbutazone, phenytoin, probenecid)
* Coumarin-based anticoagulants
* Unstable or untreated brain/leptomeningeal metastasis
* Clinically active diverticulitis, intra-abdominal abscess, gastrointestinal (GI) obstruction, or abdominal carcinomatosis (known risks factors for bowel perforation)
* Severe hypersensitivity reaction to treatment with another antibody and/or hypersensitivity to epacadostat excipients
* Active autoimmune disease that has required systemic treatment in the past 2 years
* Known history of human immunodeficiency virus (HIV), hepatitis B or hepatitis C (with confirmation of negative hepatitis B surface antigen \[HBsAg\], hepatitis B virus \[HBV\] polymerase chain reaction \[PCR\], and hepatitis C virus \[HCV\] PCR)
* History of pneumonitis (non-infectious) that required steroids or current pneumonitis
* Known history of active tuberculosis
* Diagnosed with or treated for cancer within the previous two years, other than histologies listed in inclusion criteria or non-melanoma carcinoma of the skin
* Female only: pregnant or breastfeeding
* Any othr condition that would, in the Investigator's judgement, contraindicate the patient's participation in the clinical study due to safety concerns with clinical study procedures
* Prospective participants who, in the opinion of the investigator, may not be able to comply with all study procedures (including compliance issues related to feasibility/logistics)