Skip to content

fix: #2487 persist nested agent-tool HITL state across RunState JSON round-trips#2500

Merged
seratch merged 1 commit intomainfrom
fix/issue-2487-agent-tool-hitl-resume-state
Feb 17, 2026
Merged

fix: #2487 persist nested agent-tool HITL state across RunState JSON round-trips#2500
seratch merged 1 commit intomainfrom
fix/issue-2487-agent-tool-hitl-resume-state

Conversation

@seratch
Copy link
Member

@seratch seratch commented Feb 17, 2026

This pull request fixes #2487 a resume bug where agent.as_tool() nested HITL runs could re-interrupt indefinitely after RunState.to_json()/from_json() if weakref-backed cache state was lost. The change serializes pending nested agent-tool run state inside last_processed_response.functions[*], restores it into the ephemeral agent-tool cache during deserialization, and replaces stale signature-matching cache entries to avoid reusing outdated pending interruptions. It also adds a regression test that reproduces the GC + JSON round-trip scenario and verifies that approve-and-resume completes instead of looping.

@seratch seratch added this to the 0.9.x milestone Feb 17, 2026
@github-actions github-actions bot added bug Something isn't working feature:core labels Feb 17, 2026
@seratch seratch merged commit e8c749e into main Feb 17, 2026
9 checks passed
@seratch seratch deleted the fix/issue-2487-agent-tool-hitl-resume-state branch February 17, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent-as-tool + HITL resume: weakref cache loss causes infinite pause loop

1 participant