fix(agentex-ui): include account_id in investigate traces link#310
Merged
cdvillegas merged 2 commits intoJun 16, 2026
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
rpatel-scale
approved these changes
Jun 16, 2026
| if (sgpAccountID) { | ||
| params.set('account_id', sgpAccountID); | ||
| } | ||
| const sgpTracesURL = `${sgpAppURL}/beta/monitor?${params.toString()}`; |
There was a problem hiding this comment.
I dont think we need beta (it just redirects to /monitor)
Contributor
Author
There was a problem hiding this comment.
Good call, removed
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Summary
The AgentEx "Investigate traces" link opened SGP monitor with only trace ID query params. When a user had multiple tenants, SGP could load traces under the wrong active account. This change reads
account_idfrom the current AgentEx URL and appends it to the monitor link so SGP switches to the correct tenant.Test Plan
account_idwhen the AgentEx page URL includesaccount_id.Linear Issue
No Linear ticket.
Made with Cursor
Greptile Summary
This PR fixes a multi-tenant issue in the "Investigate traces" button by reading
account_idfrom the current AgentEx URL and appending it to the SGP monitor link, ensuring SGP loads the correct tenant context.useSafeSearchParamsto extractaccount_idfrom the current page's search params and conditionally appends it to the outbound SGP URL.URLSearchParamsfor cleaner parameter handling./beta/monitorto/monitor; this is not mentioned in the PR description and warrants confirmation that SGP no longer requires the/beta/prefix.Confidence Score: 4/5
The account_id forwarding logic is correct and well-guarded, but the undocumented removal of the
/beta/path segment in the monitor URL could silently break the link for all users if SGP has not retired that route.The path change from
/beta/monitorto/monitoris unmentioned in the PR description and untested in the stated test plan — if SGP still routes the monitor behind/beta/, every "Investigate traces" click will land on the wrong or missing page.agentex-ui/components/task-header/investigate-traces-button.tsx — confirm the
/beta/monitor→/monitorpath change is intentional and that the new route is live in SGP.Important Files Changed
account_idfrom search params and appends it to the SGP monitor URL; also silently changes the monitor path from/beta/monitorto/monitorSequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant User participant AgentEx UI participant useSafeSearchParams participant SGP Monitor User->>AgentEx UI: Visits page with ?account_id=XYZ&task_id=ABC AgentEx UI->>useSafeSearchParams: read search params useSafeSearchParams-->>AgentEx UI: sgpAccountID = "XYZ" AgentEx UI->>AgentEx UI: Build URL: /monitor?trace_id=...&tt-trace-id=...&account_id=XYZ User->>SGP Monitor: Clicks "Investigate traces" link SGP Monitor-->>User: Opens monitor under account XYZ%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant User participant AgentEx UI participant useSafeSearchParams participant SGP Monitor User->>AgentEx UI: Visits page with ?account_id=XYZ&task_id=ABC AgentEx UI->>useSafeSearchParams: read search params useSafeSearchParams-->>AgentEx UI: sgpAccountID = "XYZ" AgentEx UI->>AgentEx UI: Build URL: /monitor?trace_id=...&tt-trace-id=...&account_id=XYZ User->>SGP Monitor: Clicks "Investigate traces" link SGP Monitor-->>User: Opens monitor under account XYZPrompt To Fix All With AI
Reviews (2): Last reviewed commit: "fix(agentex-ui): use /monitor instead of..." | Re-trigger Greptile