Summary
Implement the routing configuration that maps GitHub repositories to swarm agents. This determines which agent(s) receive notifications when webhook events arrive from a given repository.
RFC: #177 (GitHub Webhook to Swarm Notification Bridge)
Design
New File
src/server/webhook_config.py -- parsing, validation, and lookup for routing config
Environment Variable
GITHUB_WEBHOOK_ROUTING -- semicolon-delimited repo:agent1,agent2 pairs
Format
repo_full_name:agent_id1,agent_id2;repo_full_name:agent_id3
Examples
# Single repo, multiple agents
GITHUB_WEBHOOK_ROUTING="finml-sage/agent-swarm-protocol:finml-sage,nexus-marbell"
# Multiple repos
GITHUB_WEBHOOK_ROUTING="finml-sage/agent-swarm-protocol:finml-sage,nexus-marbell;finml-sage/real-agent-methodology:finml-sage"
# Wildcard: all repos under an org/user
GITHUB_WEBHOOK_ROUTING="nexus-marbell/*:nexus-marbell;mlops-kelvin/*:kelvin"
Features
- Multi-repo per agent (an agent can subscribe to many repos)
- Multi-agent per repo (a repo can notify many agents)
- Wildcard support:
owner/* matches all repos under that owner
- Specific repo rules take precedence over wildcards
- Each agent configures their own env to subscribe to repos they care about
- Parse once at startup, cache the routing table
- Provide a lookup function:
get_agents_for_repo(repo_full_name) -> list[str]
Validation
- Reject malformed routing strings at startup with clear error messages
- Warn (log) if a routing entry references an unknown agent ID (agent not in swarm)
- Empty routing string means no notifications are sent (webhook enabled but unconfigured)
Acceptance Criteria
Dependencies
Depends on #178 (webhook receiver endpoint -- provides the framework this config plugs into).
Summary
Implement the routing configuration that maps GitHub repositories to swarm agents. This determines which agent(s) receive notifications when webhook events arrive from a given repository.
RFC: #177 (GitHub Webhook to Swarm Notification Bridge)
Design
New File
src/server/webhook_config.py-- parsing, validation, and lookup for routing configEnvironment Variable
GITHUB_WEBHOOK_ROUTING-- semicolon-delimitedrepo:agent1,agent2pairsFormat
Examples
Features
owner/*matches all repos under that ownerget_agents_for_repo(repo_full_name) -> list[str]Validation
Acceptance Criteria
GITHUB_WEBHOOK_ROUTINGenv var is parsed into a routing table at startuprepo:agent1,agent2pairs works correctlyowner/*matches any repo under that ownerget_agents_for_repo()returns correct agent list for a given repoDependencies
Depends on #178 (webhook receiver endpoint -- provides the framework this config plugs into).