[FIX] Skip un-clonable connectors gracefully; cascade to dependent workflows#22
Conversation
…rkflows OAuth-backed and redacted-metadata connectors can't be recreated via the Platform API (credentials can't be minted server-side). Previously they were skipped but their workflows/pipelines were still cloned connector-less, so every scheduled run failed. - connector: adopt a same-name target connector before recreating, so an operator who provisions one on the target (where OAuth completes) gets it adopted on re-run, wiring dependent endpoints. - connector: record genuinely-skipped connector ids + surface a report warning. - workflow: cascade-skip workflows whose endpoints use a skipped connector; pipeline / api_deployment / tool_instance cascade off the missing remap. - report: surface frictionless tool/workflow skips as warnings, not just logs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CsGrHbs5SWmQkKqiimg6CF
|
| Filename | Overview |
|---|---|
| src/unstract/clone/context.py | Adds skipped_connector_ids: set[str] to CloneContext; straightforward field addition consistent with existing skipped_custom_tool_registry_ids pattern. |
| src/unstract/clone/phases/connector.py | Adopts adopt-before-recreate ordering; moves OAuth/redacted-metadata skip logic into _recreate_or_skip(), records skipped IDs in ctx.skipped_connector_ids and surfaces report warnings. Thread-safe (mutations under the shared parallel_map lock). |
| src/unstract/clone/phases/workflow.py | Adds connector cascade-skip via _collect_wf_connector_map (built only when connectors were skipped) and collects all skip reasons before returning to report both in a single pass. Previous review comment about dual-skip silent swallowing is now resolved. |
| src/unstract/clone/phases/custom_tool.py | Adds result.warnings.append(...) when a frictionless-adapter tool is skipped, surfacing it in the report's Warnings block as stated in the PR goals. |
| tests/clone/test_connector_phase.py | Adds assertions for skipped_connector_ids and result.warnings to existing skip tests; adds new test_oauth_connector_adopted_when_target_exists covering the recovery path. |
| tests/clone/test_workflow_phase.py | Adds list_workflow_endpoints to FakeClient; new tests cover cascade-skip on connector, dual-reason skip, and the missing warning assertion from the previous review cycle. |
Reviews (2): Last reviewed commit: "[FIX] Address Greptile: report all workf..." | Re-trigger Greptile
- workflow: a workflow blocked by both a skipped tool and a skipped connector now surfaces both reasons instead of only the first (no extra re-run to learn the second blocker). - tests: assert the tool-skip cascade emits its report warning; cover the dual-skip (tool + connector) case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CsGrHbs5SWmQkKqiimg6CF
Problem
OAuth-backed connectors (e.g. Google Drive) and redacted-metadata connectors (auto-provisioned, e.g. Unstract Cloud Storage) cannot be cloned — the Platform API never exposes OAuth refresh tokens, and a valid token can only be minted by completing the OAuth flow as the target user (UI-only). The clone already skipped them, but still cloned their workflows and pipelines connector-less → every scheduled ETL/TASK run failed (the "failing every half hour" symptom).
Changes
connector.py): a same-name target connector is adopted before any recreate attempt. This is the recovery path — the operator provisions the connector on the target (where OAuth completes), re-runs, and the clone adopts it and wires dependent endpoints. (Backend match is exactconnector_name, org-scoped.)workflow.py): a workflow whose SOURCE/DEST endpoint references a skipped connector is skipped;pipeline/api_deployment/tool_instancecascade off the missing workflow remap (same mechanism as the frictionless-adapter cascade). No more guaranteed-failing pipelines.The
wf → connectorsmap is built from a single bulk endpoint listing, and only when connectors were actually skipped (zero cost otherwise).Tests
tests/clone/— 184 passed. New/strengthened: OAuth/redacted skip records id + warning; OAuth connector adopted when a same-name target exists; workflow cascade-skip on skipped endpoint connector. Live dry-run against a dev org: no regression (identical counts,Completed successfully).🤖 Generated with Claude Code