Skip to content

fix(FunctionResult): emit execute_swml transfer beside the SWML document - #87

Closed
grandcamel wants to merge 1 commit into
signalwire:mainfrom
grandcamel:fix/execute-swml-transfer
Closed

fix(FunctionResult): emit execute_swml transfer beside the SWML document#87
grandcamel wants to merge 1 commit into
signalwire:mainfrom
grandcamel:fix/execute-swml-transfer

Conversation

@grandcamel

Copy link
Copy Markdown
Contributor

Summary

execute_swml(swml_content, transfer=True) wrote the transfer flag inside the SWML document:

{"SWML": {"version": "1.0.0", "sections": {...}, "transfer": "true"}}

The platform documents transfer as a sibling of the SWML key in the action object (SWAIG function reference: transfer "boolean | object", used "alongside a sibling action[].SWML payload"):

{"SWML": {"version": "1.0.0", "sections": {...}}, "transfer": "true"}

The sibling form is exactly what connect() and swml_transfer() in the same class already emit — the live-proven paths. A transfer key inside a SWML document is not part of the document schema, so execute_swml(..., transfer=True) executed the SWML but the call never exited the agent.

Fix

execute_swml now appends {"SWML": <doc>, "transfer": "true"} (sibling), matching connect()/swml_transfer() and the platform docs. transfer=False still omits the key. The string "true" form is kept for consistency with the two live-proven helpers.

The three tests that pinned the inside-the-document placement now pin the sibling placement (one also asserts shape-parity with connect()'s action); the copy-safety test still verifies the caller's dict is never mutated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MgA3KeCEPMKMJVvroZY1wV

execute_swml(transfer=True) wrote the flag INSIDE the SWML document —
{"SWML": {..., "transfer": "true"}} — where it is not a SWML key, so
the document executed but the call never exited the agent. The platform
documents transfer as a sibling of the SWML key in the action object,
which is exactly the shape the live-proven connect() and
swml_transfer() helpers already emit. The action is now
{"SWML": <doc>, "transfer": "true"}; transfer=False still omits the
key, and the caller's dict is still never mutated.

The three tests that pinned the inside placement now pin the sibling
placement, one of them asserting shape-parity with connect()'s action
so the two paths cannot drift apart again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgA3KeCEPMKMJVvroZY1wV
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