[SKY-7980] Patch Credential TOTP Over Webhook Logic (#4811)

This commit is contained in:
Aaron Perez
2026-02-19 18:14:44 -05:00
committed by GitHub
parent f80451f37a
commit f8f9d2a17f
4 changed files with 154 additions and 4 deletions

View File

@@ -4529,7 +4529,7 @@ class ForgeAgent:
# Try credential TOTP first (highest priority, doesn't need totp_url/totp_identifier)
otp_value = try_generate_totp_from_credential(task.workflow_run_id)
# Fall back to webhook/totp_identifier
if not otp_value and (task.totp_verification_url or task.totp_identifier):
if not otp_value:
workflow_id = workflow_permanent_id = None
if task.workflow_run_id:
workflow_run = await app.DATABASE.get_workflow_run(task.workflow_run_id)

View File

@@ -9,7 +9,7 @@ from websockets.exceptions import ConnectionClosedError, ConnectionClosedOK
from skyvern.config import settings
from skyvern.forge import app
from skyvern.forge.sdk.notification.factory import NotificationRegistryFactory
from skyvern.forge.sdk.routes.routers import base_router
from skyvern.forge.sdk.routes.routers import base_router, legacy_base_router
from skyvern.forge.sdk.routes.streaming.auth import _auth as local_auth
from skyvern.forge.sdk.routes.streaming.auth import auth as real_auth
@@ -22,6 +22,23 @@ async def notification_stream(
websocket: WebSocket,
apikey: str | None = None,
token: str | None = None,
) -> None:
return await _notification_stream_handler(websocket=websocket, apikey=apikey, token=token)
@legacy_base_router.websocket("/stream/notifications")
async def notification_stream_legacy(
websocket: WebSocket,
apikey: str | None = None,
token: str | None = None,
) -> None:
return await _notification_stream_handler(websocket=websocket, apikey=apikey, token=token)
async def _notification_stream_handler(
websocket: WebSocket,
apikey: str | None = None,
token: str | None = None,
) -> None:
auth = local_auth if settings.ENV == "local" else real_auth
organization_id = await auth(apikey=apikey, token=token, websocket=websocket)