Skip to content

fix: preserve handoff target resolution compatibility in run-state agent maps#2423

Merged
seratch merged 2 commits into
mainfrom
fix/handoff-agent-map-resolution
Feb 6, 2026
Merged

fix: preserve handoff target resolution compatibility in run-state agent maps#2423
seratch merged 2 commits into
mainfrom
fix/handoff-agent-map-resolution

Conversation

@seratch
Copy link
Copy Markdown
Member

@seratch seratch commented Feb 6, 2026

This pull request fixes #2421 handoff target discovery during run-state restoration by supporting both new handoff() weak-reference objects and legacy/custom handoff objects that expose .agent.

  • Add a private _agent_ref weak reference to Handoff and assign it in handoff() so handoff-created targets can be traversed safely (src/agents/handoffs/init.py).
  • Update _build_agent_map to resolve targets via agent_name, _agent_ref, and a backward-compatible .agent fallback, while skipping unresolved detached handoffs with debug logging (src/agents/run_state.py).
  • Expand run-state tests to cover weakref-backed handoffs, legacy .agent handoffs, and unresolved handoff objects (tests/test_run_state.py).

@seratch seratch added this to the 0.8.x milestone Feb 6, 2026
@github-actions github-actions Bot added bug Something isn't working feature:core labels Feb 6, 2026
@seratch seratch marked this pull request as draft February 6, 2026 03:47
@seratch seratch marked this pull request as ready for review February 6, 2026 03:47
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71e3423413

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/run_state.py
@seratch seratch merged commit 01b18d0 into main Feb 6, 2026
10 checks passed
@seratch seratch deleted the fix/handoff-agent-map-resolution branch February 6, 2026 04:07
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.

_build_agent_map assumes Handoff has .agent or .name, but Handoff only exposes agent_name

1 participant