fix(deploy): pass persona source.kind into connect-session + status poll#133
Conversation
Closes the third leg of the integration-scope contract. The persona
declares source (deployer_user / workspace / workspace_service_account)
and persona-kit + the cloud's runtime dispatcher both honor it — but
the cloud's connect-session endpoint ignores it and always writes to
workspace_integrations. So a persona declaring (or defaulting to)
deployer_user runs OAuth, the row lands in workspace_integrations,
/me/integrations stays empty, the preflight re-prompts on the next
deploy, and the runtime dispatcher silently has nothing to resolve at
tick time.
This change threads the persona's declared `source` from each
integration declaration through to `relayfileIntegrationResolver.connect`,
which now posts `scope: { kind, name? }` in the connect-session body and
appends `scope=...` (+ optional `serviceAccountName`) to the status
poll URL. The cloud half — accepting and honoring those fields — is
tracked separately as AgentWorkforce/cloud#1001 and must merge first.
DO NOT MERGE until cloud#1001 ships. Until it does, sending the new
fields is a no-op on the server side (today's behavior preserved), so
this PR is safe to land in either order, but the user-visible bug
only resolves once both halves are live.
Tests: 121/121 pass, 3 new covering each scope.kind variant going out
on the wire (deployer_user default, workspace explicit, and
workspace_service_account with name attribution).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR extends the integration connection flow to scope creation and status polling by integration source (deployer_user, workspace, or workspace_service_account). The ChangesIntegration Source Scoping
Sequence DiagramsequenceDiagram
participant Caller
participant relayfileResolver
participant connectSessionAPI as /connect-session
participant statusAPI as /status polling
Caller->>relayfileResolver: connect(provider, source)
relayfileResolver->>relayfileResolver: derive effectiveSource
relayfileResolver->>relayfileResolver: build sessionBody with scope
relayfileResolver->>connectSessionAPI: POST (allowedIntegrations, scope)
connectSessionAPI-->>relayfileResolver: sessionId
loop poll until connected
relayfileResolver->>statusAPI: GET (scope, serviceAccountName)
statusAPI-->>relayfileResolver: status
end
relayfileResolver-->>Caller: connectionId
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Background
Personas declare each integration with a `source` discriminator (`deployer_user` / `workspace` / `workspace_service_account`). Three components are supposed to agree on what that means:
Result: every persona defaulting to `deployer_user` (the persona-kit default) runs OAuth visibly, the cloud reports success, the row lands in the wrong table, `/me/integrations` stays empty, the preflight re-prompts on the next deploy, and the runtime dispatcher silently has nothing to resolve at tick time. `workspace_service_account` has the same problem.
What this PR does (workforce half)
Cloud half (cloud#1001)
The cloud connect-session endpoint must:
Test plan
Dependencies
🤖 Generated with Claude Code