Repository navigation
Python: Replace invalid characters in handoff tool names - #9035
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits intoOct 6, 2026
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
Conversation
Lanre Shittu (Shizoqua)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 4, 2026 13:53
Lanre Shittu (Shizoqua)
temporarily deployed
to
github-app-auth
October 4, 2026 13:53 — with
GitHub Actions
Inactive
Lanre Shittu (Shizoqua)
temporarily deployed
to
github-app-auth
October 4, 2026 13:53 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Generated names can still exceed providers’ 64-character limit.
Review effort: Balanced
Findings: 1
What changed in this PR
Sanitizes generated handoff tool names for provider compatibility and detects normalization collisions.
Changes:
- Replaces unsupported characters with underscores.
- Rejects colliding generated names.
- Adds unit and workflow coverage.
| File | Description |
|---|---|
_handoff.py |
Implements sanitization and collision detection. |
test_handoff.py |
Tests sanitized names, routing, and collisions. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Lanre Shittu (Shizoqua)
temporarily deployed
to
github-app-auth
October 5, 2026 23:04 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 6, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation & Context
HandoffBuildernamed each handoff toolhandoff_to_<agent name>without checking the name. An agent called "Billing Agent" producedhandoff_to_Billing Agent, which OpenAI, Anthropic and Bedrock reject because tool names may only contain letters, digits, underscores and dashes.Description & Review Guide
get_handoff_tool_namenow replaces any other character with an underscore. The builder also raises when two targets end up with the same tool name, instead of one silently overwriting the other.handoff_to_<name>are unaffected.Related Issue
Fixes #9034
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix), and a workflow keeps the label and title prefix in sync automatically.