Skip to content

feat(pipeline): Detect API-driven pipelines in existing callback URL#111455

Merged
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/feat-pipeline-detect-api-driven-pipelines-in-existing-callback-url
Mar 31, 2026
Merged

feat(pipeline): Detect API-driven pipelines in existing callback URL#111455
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/feat-pipeline-detect-api-driven-pipelines-in-existing-callback-url

Conversation

@evanpurkhiser

@evanpurkhiser evanpurkhiser commented Mar 24, 2026

Copy link
Copy Markdown
Member

Integration providers register callback URLs with external services
(e.g. GitHub OAuth redirect). These URLs point to PipelineAdvancerView,
which traditionally drives the pipeline server-side by calling
pipeline.current_step() on each callback.

For the new API-driven pipeline mode, we cannot change the callback URLs
already registered with production integrations. Instead, this view now
detects when a pipeline was initiated in API mode (api_mode flag in
session state) and renders a lightweight trampoline page. The trampoline
relays the callback URL query parameters (code, state, installation_id,
etc.) back to the opener window via postMessage and closes itself. The
frontend pipeline system then continues driving the pipeline via API
endpoints.

Fixes VDY-36

@evanpurkhiser evanpurkhiser requested a review from a team as a code owner March 24, 2026 20:32
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 24, 2026
Comment thread src/sentry/web/frontend/pipeline_advancer.py Outdated
Comment thread src/sentry/web/frontend/pipeline_advancer.py Outdated
Comment thread src/sentry/web/frontend/pipeline_advancer.py Outdated
Comment thread src/sentry/web/frontend/pipeline_advancer.py Outdated
@linear-code

linear-code Bot commented Mar 24, 2026

Copy link
Copy Markdown

@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-pipeline-detect-api-driven-pipelines-in-existing-callback-url branch from 0079648 to 080ca64 Compare March 25, 2026 22:30
Comment thread src/sentry/web/frontend/pipeline_advancer.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread src/sentry/web/frontend/pipeline_advancer.py
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-pipeline-detect-api-driven-pipelines-in-existing-callback-url branch from 080ca64 to 68cfd5f Compare March 27, 2026 17:22
Comment thread src/sentry/web/frontend/pipeline_advancer.py
Comment thread src/sentry/web/frontend/pipeline_advancer.py
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-pipeline-detect-api-driven-pipelines-in-existing-callback-url branch from 68cfd5f to 0b90acb Compare March 27, 2026 17:35
Comment thread src/sentry/web/frontend/pipeline_advancer.py Outdated
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-pipeline-detect-api-driven-pipelines-in-existing-callback-url branch from 0b90acb to 2f4d73f Compare March 27, 2026 20:14
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-pipeline-detect-api-driven-pipelines-in-existing-callback-url branch from 2f4d73f to 893d9dd Compare March 30, 2026 18:46
Comment on lines +23 to +44
TRAMPOLINE_HTML = """\
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"></head>
<body
style="margin:0;display:flex;align-items:center;justify-content:center;min-height:100vh;
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
flex-direction:column;padding:2rem">
<script type="module">
const data = {data_json};
if (window.opener) {{
window.opener.postMessage(data, {origin});
window.close();
}} else {{
document.getElementById("fallback").style.display = "flex";
}}
</script>
<div id="fallback" style="display:none;flex-direction:column;align-items:center;gap:1.5rem;max-width:600px">
<p style="font-size:1.1rem;margin:0">Unable to continue. Please restart the flow.</p>
</div>
</body>
</html>"""

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably move this to a template if we really want. but the idea here is it should be extremely minimal since it's just piping the query parameters through to the frontend popup opener.

@evanpurkhiser evanpurkhiser enabled auto-merge (squash) March 30, 2026 19:11

@wedamija wedamija left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to render a page here rather than returnings a json response and having the FE know how to deal with it?

@evanpurkhiser

Copy link
Copy Markdown
Member Author

Why do we have to render a page here rather than returnings a json response and having the FE know how to deal with it?

Because this is happening in a popup window.

This flow is from when the user is redirected to GitHub to authorize (or any other OAuth-ish identity provider). Once they authorize they are redirected back to a configured redirect URL (configured on githubs side). When redirected back if it was just a JSON response there's no way to get those details back to the frontend in the main window that's actually driving the pipeline APIs.

Integration providers register callback URLs with external services
(e.g. GitHub OAuth redirect). These URLs point to PipelineAdvancerView,
which traditionally drives the pipeline server-side by calling
pipeline.current_step() on each callback.

For the new API-driven pipeline mode, we cannot change the callback URLs
already registered with production integrations. Instead, this view now
detects when a pipeline was initiated in API mode (api_mode flag in
session state) and renders a lightweight trampoline page. The trampoline
relays the callback URL query parameters (code, state, installation_id,
etc.) back to the opener window via postMessage and closes itself. The
frontend pipeline system then continues driving the pipeline via API
endpoints.

Refs VDY-36
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-pipeline-detect-api-driven-pipelines-in-existing-callback-url branch from 893d9dd to 9a1871b Compare March 31, 2026 16:58
@evanpurkhiser evanpurkhiser merged commit 615e4b5 into master Mar 31, 2026
65 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/feat-pipeline-detect-api-driven-pipelines-in-existing-callback-url branch March 31, 2026 17:20
dashed pushed a commit that referenced this pull request Apr 1, 2026
…111455)

Integration providers register callback URLs with external services
(e.g. GitHub OAuth redirect). These URLs point to PipelineAdvancerView,
which traditionally drives the pipeline server-side by calling
pipeline.current_step() on each callback.

For the new API-driven pipeline mode, we cannot change the callback URLs
already registered with production integrations. Instead, this view now
detects when a pipeline was initiated in API mode (api_mode flag in
session state) and renders a lightweight trampoline page. The trampoline
relays the callback URL query parameters (code, state, installation_id,
etc.) back to the opener window via postMessage and closes itself. The
frontend pipeline system then continues driving the pipeline via API
endpoints.

Fixes [VDY-36](https://linear.app/getsentry/issue/VDY-36)
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants