Skip to content

Fix handoff extraction for nested JSON payloads - #407

Open
adityajai119 wants to merge 1 commit into
anthropics:mainfrom
adityajai119:fix/w22-bug
Open

adityajai119 wants to merge 1 commit into
anthropics:mainfrom
adityajai119:fix/w22-bug

Conversation

@adityajai119

Copy link
Copy Markdown

Bug
extract_handoff() in scripts/orchestrate.py used a non-greedy regex ending at the first }. Every well-formed handoff has a nested payload object, so the regex cut the JSON off before its closing brace and json.loads() failed. Valid handoffs were silently dropped.

Fix
Locate the handoff with the start-of-object pattern and let json.JSONDecoder().raw_decode() consume the complete JSON value. Target allowlisting and payload schema validation are unchanged.

Test
tests/test_orchestrate.py::test_handoff_with_object_payload_is_extracted fails before the fix (returns None) and passes after. python -m ruff check scripts/orchestrate.py tests/test_orchestrate.py passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant