Every piece of equipment has both condition and durability. Condition works like health and is based on item type, while durability works like immunity and is based on material type (although it can also be improved as a magic item bonus, up to a maximum of 99%).
Magic items automatically repair damaged condition at the rate of 1-5 points per second based on their type: 1 for magical, 2 for legendary, 3 for mythical, 4 for relics and 5 for artifacts. Corrosion can reduce this by up to 4, and if the item is reduced to 0 condition it will no longer repair itself at all. To fix a broken item you will need to type ‘repair’ while on your home plane.
Note that corrosion can reduce the durability of an item by up to 10, while heat can reduce the durability by up to 6. This penalty is applied after the durability bonuses is capped at 99%, so that a very rusty white-hot sword can never have more than 99-10-6=83% durability.
See also: repair