I subscript the terms object in the survival library's Cox model code to manipulate strata and cluster terms.
A user (D James) sent a bug report that survfit.coxph was ignoring offset terms in a particular case, and it turns out to be an issue with terms. Here is an example:
> test2 <- terms(~age + offset(weight) + strata(sex), specials="strata")
> attr(test2, 'specials')
> test2b <- test2[-attr(test2, 'specials')$strata]
> attr(test2b, 'variables')
The issue is in line 2 of [.terms, in library/stats/R/models.R
newformula <- attr(termobj, "term.labels")[i]
The term.labels attribute omits the offset. One possible fix is
newformula <- (rownames(attr(termobj, "factors"))[i]
but I have not thought it through with any depth.