-
Notifications
You must be signed in to change notification settings - Fork 187
[superlog] Resolve websiteId in annotation tools to fix domain-name mismatch #474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,15 +27,29 @@ export function resolveToolWebsite( | |||||||||||||||||||||||||
| (id === ctx.websiteId ? ctx.websiteDomain : undefined); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if (inputWebsiteId) { | ||||||||||||||||||||||||||
| const isAccessible = | ||||||||||||||||||||||||||
| // Try exact ID match | ||||||||||||||||||||||||||
| const isAccessibleById = | ||||||||||||||||||||||||||
| accessible.some((w) => w.id === inputWebsiteId) || | ||||||||||||||||||||||||||
| inputWebsiteId === ctx.websiteId; | ||||||||||||||||||||||||||
| if (!isAccessible) { | ||||||||||||||||||||||||||
| throw new Error( | ||||||||||||||||||||||||||
| `Website "${inputWebsiteId}" is not in this workspace. Call list_websites to see available websites.` | ||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||
| if (isAccessibleById) { | ||||||||||||||||||||||||||
| return { websiteId: inputWebsiteId, domain: domainFor(inputWebsiteId) }; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| return { websiteId: inputWebsiteId, domain: domainFor(inputWebsiteId) }; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // Try domain name match (model may pass a domain instead of an ID) | ||||||||||||||||||||||||||
| const byDomain = accessible.find((w) => w.domain === inputWebsiteId); | ||||||||||||||||||||||||||
| if (byDomain) { | ||||||||||||||||||||||||||
| return { websiteId: byDomain.id, domain: byDomain.domain ?? undefined }; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| if (ctx.websiteDomain === inputWebsiteId) { | ||||||||||||||||||||||||||
| const fallbackId = ctx.defaultWebsiteId ?? ctx.websiteId; | ||||||||||||||||||||||||||
| if (fallbackId) { | ||||||||||||||||||||||||||
| return { websiteId: fallbackId, domain: ctx.websiteDomain }; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+43
to
+48
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| throw new Error( | ||||||||||||||||||||||||||
| `Website "${inputWebsiteId}" is not in this workspace. Call list_websites to see available websites.` | ||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const fallbackId = ctx.defaultWebsiteId ?? ctx.websiteId; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createAnnotationTool.resolveToolWebsiteis called before thetryblock (unlikelistAnnotationsToolwhere it is inside), so if resolution throws (e.g. domain not in workspace), the error propagates without being logged vialogger.error. Moving the call into thetryblock would make error-handling consistent withlistAnnotationsTool.