Inclusion Criteria:  Age ≥18 years, < 75 years Histologically or cytologically confirmed Esophageal squamous cell cancer, adenocarcinoma of esophagogastric junction and Gastric adenocarcinoma, unresectable, recurrent or metastatic disease. Can provide at least 5 pieces of pathological section or fresh tumor tissue Eastern Collaborative Oncology Group (ECOG) ≤ 1 Patients who have previously used PD-1 antibodies, PD-L1 antibodies, PD-L2 antibodies, or CTLA-4 antibodies (or any other antibodies acting on T cell co-stimulation or checkpoint pathways) require a duration of ≥3 months; Adequate organ function Life expectancy is more than 3 months For females of child bearing potential, a negative urine or serum pregnancy test result within 3 days before study treatment. Willing and able to provide written informed consent  Exclusion Criteria:  Allergies to any monoclonal antibody or Tucidinostat preparation have been known, and hypersensitivity reactions of more than 3 levels have occurred Previously received immunotherapy and had grade 3 or above immune-related adverse events。 Previously received histone deacetylase inhibitors Subjects with any active, known or suspected autoimmune disease or history of autoimmune disease. Known active CNS metastases and/or carcinomatous meningitis Received a live vaccine within 4 weeks of the first dose of study medication. Major surgery received or severe traumatic injury, fracture, or ulcer occurred within 4 weeks of the first dose of study medication. Pregnant or lactating female. Uncontrolled clinically significant systemic diseases, including active infection, unstable angina, angina occurred within 3 months,≥ NYHA II congestive heart failure, myocardial infarction occurred within 6 months, severe arrhythmia, liver, kidney, or metabolic disease. Participate in other clinical trials currently or within 4 weeks prior to enrollment.