Skip to content

chore: revert "feat: pass invocation_state to edge condition calls (#2305)"#2389

Merged
zastrowm merged 1 commit into
strands-agents:mainfrom
zastrowm:revert-invocation-state-edge-conditions
May 29, 2026
Merged

chore: revert "feat: pass invocation_state to edge condition calls (#2305)"#2389
zastrowm merged 1 commit into
strands-agents:mainfrom
zastrowm:revert-invocation-state-edge-conditions

Conversation

@zastrowm
Copy link
Copy Markdown
Member

@zastrowm zastrowm commented May 29, 2026

Summary

Reverts #2305.

This PR introduced a regression that breaks all Graph integration tests that use FileSessionManager with a TypeError: Object of type Agent is not JSON serializable.

Root Cause

The PR stored self._current_invocation_state in serialize_state() and passed the same dict reference to agent node executors. Python's Agent._execute_event_loop_cycle mutates the passed invocation_state dict by adding invocation_state["agent"] = self (a backwards-compat shim in agent.py:1012). After a node completes, the session manager hook fires sync_multi_agentserialize_state()json.dump(), which hits the non-serializable Agent object now sitting in self._current_invocation_state.

Why revert rather than fix-forward

  1. We're attempting to get a release out today
  2. Want to revisite whether or not persistence makes sense here

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
strands-py/src/strands/multiagent/graph.py 75.00% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown
Contributor

Assessment: Approve

Clean, well-motivated revert that fixes a serialization regression in Graph integration tests. The PR description provides excellent root cause analysis and clear rationale for reverting rather than fixing forward.

Review Notes
  • Correctness: The three architectural concerns (dead-on-arrival persisted value, TypeScript parity, unintended serialization constraint) justify reverting over a quick fix.
  • Scope: Changes are limited to removing the feature introduced in feat: pass invocation_state to edge condition calls #2305 — no unrelated modifications.
  • Testing: Removed tests correspond exactly to the removed feature; existing test suite remains intact.
  • API surface: EdgeCondition and EdgeConditionWithContext were introduced in the same release being reverted, so removal carries no backwards-compatibility risk.

The acknowledgement that the feature itself is valuable (edge conditions receiving invocation_state) but needs a design that avoids persisting or sharing mutable references is a good callout for future work.

@zastrowm zastrowm enabled auto-merge (squash) May 29, 2026 19:27
@zastrowm zastrowm changed the title Revert "feat: pass invocation_state to edge condition calls (#2305)" chore: revert "feat: pass invocation_state to edge condition calls (#2305)" May 29, 2026
@zastrowm zastrowm merged commit 192abdc into strands-agents:main May 29, 2026
22 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants