Abstract

LLM agents combine reasoning, tool use, and persistent memory to support work across tasks by reusing stored operational records as premises for later actions. However, environmental or requirement changes can invalidate these records, while existing action review, provenance tracking, and clarification mechanisms may leave the underlying persistent state uncorrected. Our audit of coding-agent trajectories identifies candidate failure chains in which invalid records are reused, leading to task failures and unsafe modifications. We propose StateWise, a framework for diagnosing and repairing persistent operational state before action execution. StateWise uses record-level counterfactual replanning to identify decision-critical records, then establishes their current validity through reliability checks, read-only verification of machine-observable facts, and targeted clarification of developer-owned intent. Typed evidence grounding binds evidence to specific records and scopes, enabling persistent corrections with repair lineage. The agent then replans from the repaired state, followed by an independent state-action check before execution. We evaluate StateWise on 150 executable coding-agent cases across diverse runtime environments, workspace configurations, and repository settings, complemented by cross-model evaluations. Under corrupted persistent state, StateWise achieves 93.3% overall correctness, compared with 38.7% for the baseline agent, with no unsafe actions. Component ablations, multi-task experiments, and transfer evaluations further demonstrate effective recovery, persistent corrections, and transferability across repositories and tool interfaces.

Keywords

Subject

Publication details

Journal
Not available
Open access
Green open access

Cite this article

APA 7

Peng, Y., Feng, Z., Wu, T., Chen, J., Su, Y., Zhou, C., Du, T., & Ji, S. (2026). StateWise: Diagnosing and Repairing Persistent Operational State Before Agent Actions. https://omanscience.com/en/articles/statewise-diagnosing-and-repairing-persistent-operational-state-before-agent-actions

MLA 9

Peng, Yongyuan, et al. "StateWise: Diagnosing and Repairing Persistent Operational State Before Agent Actions." https://omanscience.com/en/articles/statewise-diagnosing-and-repairing-persistent-operational-state-before-agent-actions.

Chicago (author–date)

Peng, Yongyuan, Zhou Feng, Tongying Wu, Jiahao Chen, Yuan Su, Chunyi Zhou, Tianyu Du, and Shouling Ji. 2026. "StateWise: Diagnosing and Repairing Persistent Operational State Before Agent Actions." https://omanscience.com/en/articles/statewise-diagnosing-and-repairing-persistent-operational-state-before-agent-actions.

Harvard

Peng, Y., Feng, Z., Wu, T., Chen, J., Su, Y., Zhou, C., Du, T. and Ji, S. (2026) 'StateWise: Diagnosing and Repairing Persistent Operational State Before Agent Actions', Available at: https://omanscience.com/en/articles/statewise-diagnosing-and-repairing-persistent-operational-state-before-agent-actions.

Vancouver

Peng Y, Feng Z, Wu T, Chen J, Su Y, Zhou C, et al. StateWise: Diagnosing and Repairing Persistent Operational State Before Agent Actions. https://omanscience.com/en/articles/statewise-diagnosing-and-repairing-persistent-operational-state-before-agent-actions

IEEE

Y. Peng, Z. Feng, T. Wu, J. Chen, Y. Su, C. Zhou, T. Du, and S. Ji, "StateWise: Diagnosing and Repairing Persistent Operational State Before Agent Actions," https://omanscience.com/en/articles/statewise-diagnosing-and-repairing-persistent-operational-state-before-agent-actions.