chore: Better err handling for extracting repos, always post reply (#1007)

* chore: Better err handling for extracting repos, always post reply

* cr
This commit is contained in:
Brace Sproul 2026-03-04 16:55:50 -08:00 • committed by GitHub
parent 51b4b27c2e
commit 163649197b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -244,21 +244,19 @@ def generate_thread_id_from_slack_thread(channel_id: str, thread_id: str) -> str
async def get_slack_repo_config(message: str, channel_id: str, thread_ts: str) -> dict[str, str]:
"""Resolve repository configuration for Slack-triggered runs."""
owner = SLACK_REPO_OWNER.strip() or "langchain-ai"
name = SLACK_REPO_NAME.strip() or "langchainplus"
if "repo:" in message:
# extract out the repo from the message assuming its in the format of repo:owner/repo
import re
match = re.search(r"repo:([^ ]+)", message)
if match:
repo = match.group(1)
owner, name = repo.split("/")
await post_slack_thread_reply(
channel_id, thread_ts, f"Using repository: `{owner}/{name}`"
)
return {"owner": owner, "name": name}
if "/" in repo:
owner, name = repo.split("/", 1)
owner = SLACK_REPO_OWNER.strip() or "langchain-ai"
name = SLACK_REPO_NAME.strip() or "langchainplus"
await post_slack_thread_reply(channel_id, thread_ts, f"Using repository: `{owner}/{name}`")
return {"owner": owner, "name": name}