Tracing the chemical and thermal history of interstellar ices with JWST