Skip to content

Conversation

@bokelley
Copy link
Contributor

@bokelley bokelley commented Nov 7, 2025

Summary

Fixed the signals agent test endpoint (/tenant/{id}/signals-agents/{id}/test) to use asyncio.run() instead of the manual event loop pattern for better compatibility with the adcp library (v1.0.5).

Changes

  • Replaced asyncio.new_event_loop() + run_until_complete() with asyncio.run()
  • This is the standard modern approach for running async code from Flask endpoints
  • Improves compatibility with adcp library's internal anyio task group management

Testing

All unit, integration, and integration_v2 tests pass. No breaking changes.

🤖 Generated with Claude Code

bokelley and others added 5 commits November 7, 2025 09:49
Replace asyncio.new_event_loop() + run_until_complete() pattern with
asyncio.run() for better compatibility with adcp library (v1.0.5).

The new_event_loop() pattern was causing issues with the adcp library's
internal anyio task group cleanup when connection failures occurred.
Using asyncio.run() is the standard modern approach for running async
code from synchronous contexts like Flask endpoints.

Note: There may still be cleanup issues in the adcp library's MCP
adapter that should be addressed upstream when handling connection
failures, but this change improves compatibility.

Fixes signals agent test endpoint functionality in admin UI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Auto-generated schema updates from latest AdCP spec validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update adcp dependency from 1.0.5 to 1.1.0 for improved MCP adapter
cleanup handling.

Note: The async cleanup issue when connection failures occur appears
to be in the underlying mcp library's streamable_http client, not
adcp itself. The adcp library passes through these errors properly,
and the test_connection method in signals_agent_registry.py catches
them correctly, so functionality is not impacted. The cleanup warnings
are cosmetic and don't affect operation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove temporary test scripts created during debugging.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Resolved conflicts in schema metadata files:
- schemas/v1/_schemas_v1_core_format_json.json.meta
- schemas/v1/_schemas_v1_core_product_json.json.meta
- schemas/v1/index.json.meta

Conflicts were only in download timestamps and etags. Content hashes
are identical, confirming schema content is the same. Accepted newer
timestamps from main branch.

Merged changes from PR #719 (remove inventory sync requirement for
mock adapter).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bokelley bokelley merged commit e1c5d72 into main Nov 7, 2025
9 checks passed
bokelley added a commit that referenced this pull request Nov 8, 2025
Resolved conflicts in schema metadata files:
- schemas/v1/_schemas_v1_core_format_json.json.meta
- schemas/v1/_schemas_v1_core_product_json.json.meta
- schemas/v1/index.json.meta

All conflicts were timestamp/etag updates from schema downloads.
Used main's versions (more recent timestamps).

Merged changes from main:
- fix: require authentication for sync_creatives and update_media_buy (#721)
- fix: signals agent test endpoint async handling (#718)
- fix: remove inventory sync requirement for mock adapter (#719)
- fix: remove /a2a suffix from A2A endpoint URLs and add name field to configs
- Migrate agent registries to adcp v1.0.1 library (#712)
danf-newton pushed a commit to Newton-Research-Inc/salesagent that referenced this pull request Nov 24, 2025
* fix: use asyncio.run() for signals agent test endpoint

Replace asyncio.new_event_loop() + run_until_complete() pattern with
asyncio.run() for better compatibility with adcp library (v1.0.5).

The new_event_loop() pattern was causing issues with the adcp library's
internal anyio task group cleanup when connection failures occurred.
Using asyncio.run() is the standard modern approach for running async
code from synchronous contexts like Flask endpoints.

Note: There may still be cleanup issues in the adcp library's MCP
adapter that should be addressed upstream when handling connection
failures, but this change improves compatibility.

Fixes signals agent test endpoint functionality in admin UI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: update AdCP schemas

Auto-generated schema updates from latest AdCP spec validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: update adcp library to 1.1.0

Update adcp dependency from 1.0.5 to 1.1.0 for improved MCP adapter
cleanup handling.

Note: The async cleanup issue when connection failures occur appears
to be in the underlying mcp library's streamable_http client, not
adcp itself. The adcp library passes through these errors properly,
and the test_connection method in signals_agent_registry.py catches
them correctly, so functionality is not impacted. The cleanup warnings
are cosmetic and don't affect operation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: remove debug test files

Remove temporary test scripts created during debugging.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants