Fix "Risk Meeting" dashboard data fetches from extension#1917
Fix "Risk Meeting" dashboard data fetches from extension#1917NKoech123 wants to merge 9 commits into
Conversation
Ship hubspot-deals riskStatuses search, build-secondary-cohort join, pylon-accounts, and iframe action timeouts. Extension UI and deploy scripts stay out of repo; cohort-bindings.json documents property names for callers. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace riskStatuses and searchHubSpotDealsByRiskStatuses with generic deal property IN search; align build-secondary-cohort schema and AGENTS.md. Co-authored-by: Cursor <cursoragent@cursor.com>
Map deprecated hubspot-deals and build-secondary-cohort field names so existing Risk Review extension HTML keeps working after the generic rename. Co-authored-by: Cursor <cursoragent@cursor.com>
Filter Pylon accounts by sentiment field via structured search before falling back to the full catalog; use the fast path in build-secondary-cohort and raise extension/action timeouts as a safety margin. Co-authored-by: Cursor <cursoragent@cursor.com>
…ads. Use the full Pylon sentiment map for HubSpot join lookups, scan all deals for primary-property exclusions, and apply future close-date rollups. Raise hubspot-deals, pylon-accounts, and iframe bridge timeouts for long cohort fetches. Co-authored-by: Cursor <cursoragent@cursor.com>
Extensions now use propertyValues/dealProperty directly; drop example seed JSON that encoded Builder-specific bindings. Co-authored-by: Cursor <cursoragent@cursor.com>
Extensions are stored in SQL; the script was only a local paste reference and should not ship in template source. Co-authored-by: Cursor <cursoragent@cursor.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Builder reviewed your changes and found 5 potential issues 🟡
Review Details
This PR migrates the Risk Meeting dashboard’s data-loading path to generic Analytics actions: a faster HubSpot property-based deal search, a new generic Pylon account action, and a secondary-cohort join that combines Pylon sentiment with HubSpot deals. It also raises iframe bridge timeouts so slower read-only extension actions can complete instead of failing at the default 30s limit.
The overall direction is sound: keeping the extension-specific binding JSON outside the actions is a good abstraction, and the timeout changes are appropriately scoped to known slow actions. Risk level is standard because this touches shared provider fetch/caching logic plus user-facing dashboard data paths.
Key findings:
- 🟡 Secondary cohort result caching does not key on all caller-supplied bindings, so different dashboard configs can reuse the wrong cached cohort.
- 🟡 The deal→company join currently depends on association array order, which can mis-join multi-company deals.
- 🟡 New provider search/cache helpers have a few correctness gaps around response-shape caching and multi-page/filter aggregation.
Good additions here include targeted HubSpot CRM search coverage and clearer guidance/docs for the new generic actions.
🧪 Browser testing: Will run after this review (PR touches UI code)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| readOnly: true, | ||
| timeoutMs: 180_000, | ||
| description: | ||
| "Load a bounded cohort of Pylon accounts. Pass sentimentValues + sentimentField to filter by custom-field sentiment, or query for a text search. Property names are caller-defined.", |
There was a problem hiding this comment.
can the agent not access pylon APIs directly using fetch()? my hope is to remove hard coded actions as much as possible and make sure the agent can just have broad access to pylon/hubspot/etc's APIs and docs like claude code etc would o. would generally prefer to remove vendor-specific actions rather than make more
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Here's a visual recap of what changed: Open the full interactive recap |
Remove hardcoded action timeout map from the extension bridge, drop the pylon-accounts action in favor of provider-api-request, and strip Builder-specific defaults from secondary cohort helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Builder reviewed your changes and found 3 potential issues 🟡
Review Details
This incremental update trims the earlier Pylon helper surface, keeps the new generic secondary-cohort action, and retains the HubSpot property-value search plus iframe timeout changes for extension actions. The direction is still reasonable overall, and I verified that two previously reported Pylon issues are no longer applicable on this revision and have been resolved rather than reposted.
Risk level remains standard because this still changes shared provider-fetch logic plus user-facing analytics/dashboard data loading. The previously-open concerns around secondary cohort caching, deal→company association selection, and HubSpot property-search cache shape are still present, so I did not duplicate them here.
New findings from this revision:
- 🟡 Risk-sentiment matching is still case-sensitive against caller-supplied config values, which can silently empty or shrink the secondary cohort.
- 🟡 The new
propertyValuesfast path inhubspot-dealsbypasses the action’s normal pipeline/status/date/owner filtering, so combined cohort requests can return broader results than requested. - 🟡
buildSecondaryCohort()assumes an exhaustive deal scan, but it currently relies on a helper explicitly capped at 10k HubSpot deals.
The timeout plumbing itself still looks sound.
🧪 Browser testing: Will run after this review (PR touches UI code)
Drop build-secondary-cohort and its HubSpot/Pylon join helpers so cross-source Risk Meeting workflows use provider-api-request and agent composition instead of a hard-coded template recipe. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@NKoech123 i'm going to get a PR in shortly that I think may help get the foundation a little closer to what I think the ideal state is re: making sure our requests to various services works well in general. will lyk once it's in and maybe I can get your help testing some stuff out |
Thanks @steve8708 . What do you think about the current changes? Introduced searching hubsport with generic propertyValues |
|
just got the big changes in - i'd prefer we try to make data programs work for this stuff - basically reduce as much as possible provider-specific actions and have the agent instead do more directh requests to the various providers APIs (without us adding arbitrary wrappers that will always have constraints and need tweaking) @NKoech123 can you try this out and see if hubspot provider tweaks is still needed? I can see value in the extension timeout stuff, but want to see if we can solve the root problem more when it comes to agent accessing hubspot, pylon, etc info better |

Summary
The Risk Meeting dashboard was migrated from Fusion Analytics to Agent-Native as an Alpine SQL extension, but it could not reliably load enriched HubSpot and Pylon cohorts. HubSpot flagged deals often returned 0 or timed out; Pylon early-warning accounts failed to fetch or returned the wrong count.
This PR adds generic, caller-configured actions for the same join pattern Fusion used, fixes extension/action timeouts that were cutting requests off early, and corrects secondary-cohort join logic so HubSpot + Pylon counts match production (~43 flagged HubSpot deals + ~21 Pylon-only accounts).
The Risk Meeting UI itself stays in SQL (
extensionstable). This branch only ships the server/action surface the extension calls.Problem
After migration, the dashboard hit several independent failures:
hubspot-dealscould not do CRM property IN search; extensions fell back to slow full-catalog scans or keyword search with incomplete results.appAction()in client-sidewithTimeout(28s / 8s), so longer server actions (hubspot-deals90s,build-secondary-cohort360s) never finished.Solution
Generic actions (extension owns bindings)
Server libs
searchHubSpotDealsByPropertyValues, batch association reads,customer_success_owneron default deal properties/accounts/search, 429 retry, custom-field parsing, full sentiment map for join lookupsFramework
html-shell.ts) —hostRequest/appActionhonorcallOptions.timeoutMs; raised defaults for slow read-only actionsDocs / cleanup
AGENTS.md— documents multi-source HubSpot + Pylon patternriskStatuses/statusPropertyaliasesTest plan
propertyValues/dealPropertyCRM search (no 28s client timeout)build-secondary-cohortcompletes (allow 1–2 min on cold load)pnpm test hubspot-deals.spec.tsintemplates/analyticswithTimeout/ 28s wrappers (not in this PR)Notes
html-shell.tsstill has analytics action names inEXTENSION_ACTION_TIMEOUT_MS— follow-up to make this fully generic or rely only oncallOptions.timeoutMs.