fix: runtime fixes for WSL deployment and integration testing

- Fix RunnableConfig type annotations (dict -> RunnableConfig) for LangGraph compat
- Fix AzDo PR URL parsing (_links.web.href fallback + remoteUrl construction)
- Fix AzDo diff endpoint (use iterations/changes instead of non-existent diffs API)
- Fix _format_diff to read changeEntries field (not changes)
- Fix URL encoding for project names with spaces (Billo App Platform)
- Fix subprocess.run for Windows (replace asyncio.create_subprocess_exec with thread pool)
- Fix SlackClient to handle empty webhook URL gracefully
- Fix notify_request_changes to catch all exceptions (not just ReleaseAgentError)
- Fix JSON parsing to strip whitespace before json.loads
- Add CLAUDE_CMD config field for cross-platform CLI path
- Add run.py for Windows SelectorEventLoop workaround
- Add db port mapping in docker-compose for local dev
- Add comprehensive README sections: WSL setup, known issues, TODO list
This commit is contained in:
Yaojia Wang
2026-03-24 23:05:04 +01:00
parent f5c2733cfb
commit b67cbcfd93
13 changed files with 272 additions and 88 deletions

View File

@@ -92,11 +92,43 @@ async def manual_pr_trigger(
db_pool=Depends(get_db_pool),
_auth: None = Depends(require_operator_token),
) -> ManualTriggerResponse:
"""Manually trigger PR processing for the given PR ID."""
"""Manually trigger PR processing for the given PR ID.
Fetches PR details from AzDo first to build a proper initial state
including the synthesized webhook payload.
"""
from release_agent.api.webhooks import _run_graph
settings = request.app.state.settings
thread_id = str(uuid.uuid4())
initial_state = {"pr_id": pr_id}
# Fetch PR info to build webhook-compatible initial state
try:
pr_info = await tool_clients.azdo.get_pr(int(pr_id))
initial_state = {
"webhook_payload": {
"event_type": "git.pullrequest.updated",
"subscription_id": f"manual-{pr_id}",
"resource": {
"pull_request_id": int(pr_id),
"title": pr_info.pr_title,
"status": pr_info.pr_status,
"source_ref_name": pr_info.branch,
"target_ref_name": "refs/heads/develop",
"closed_date": None,
"repository": {
"id": f"{pr_info.repo_name}-id",
"name": pr_info.repo_name,
"web_url": f"https://dev.azure.com/billodev/Billo%20App%20Platform/_git/{pr_info.repo_name}",
},
},
},
"pr_id": pr_id,
"repo_name": pr_info.repo_name,
}
except Exception:
# Fallback: minimal state, let parse_webhook handle errors
initial_state = {"pr_id": pr_id}
task = asyncio.create_task(
_run_graph(
@@ -105,6 +137,9 @@ async def manual_pr_trigger(
thread_id=thread_id,
tool_clients=tool_clients,
db_pool=db_pool,
repos_base_dir=settings.repos_base_dir,
graph_name="pr_completed",
default_jira_project=settings.default_jira_project,
)
)
request.app.state.background_tasks.add(task)