• Together, the tumor microenvironment and TCR affected the transformation of tumor-infiltrating CD8 effector memory T cells to exhausted T cells and effector T cells.• Among CRC patients, MSI/dMMR patients showed a significantly better therapeutic response to immune checkpoint inhibitors than did MSS patients.• Intraepithelial lymphocytes and Th 17 cells were more enriched in CRC patients than in liver and lung cancer. The gene discussed is CD8A; the disease is lung carcinoma.