In LLM‑based agent systems, failures often originate from early steps whose effects propagate through later interactions, making it hard to pinpoint the root cause. Failure attribution is thus defined as identifying the earliest step responsible for a failure. Existing approaches exploit internal LLM signals, typically using hidden states as step representations, but empirical studies show that these representations provide limited separation between root‑cause steps and others.\ \ To address this, we propose ReCast, a step representation learning framework that transforms hidden states from a frozen LLM into attribution‑oriented step embeddings. ReCast first selects layers relevant to attribution, then builds complementary pattern and deviation features, and finally trains an encoder with contrastive and ranking objectives to obtain contextualized step representations. We also introduce ReCast‑2K, a training dataset for failure attribution. Across four benchmarks, ReCast achieves the highest Hit@1, surpassing the strongest baseline by 5.65 pp on the Who&When Algorithm benchmark and by 9.19 pp on the Handcrafted benchmark. The code is released at https://anonymous.4open.science/r/ReCast-5FB6 .\ \ Review