Skip to content

feat(deploy): surface daytona connect + gate in agentworkforce deploy - #232

Merged
khaliqgant merged 1 commit into
mainfrom
daytona-deploy-connect
Jun 12, 2026
Merged

khaliqgant merged 1 commit into
mainfrom
daytona-deploy-connect

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Jun 12, 2026 •

Copy link
Copy Markdown
Member

What

Surfaces the Daytona connect step in agentworkforce deploy, mirroring how slack/github are gated — so a persona that declares integrations.daytona (e.g. daytona-monitor) can't deploy until the daytona credential exists in the cloud credential-store.

Daytona's credential is captured out-of-band by the relay CLI (agent-relay cloud connect daytona → local daytona login → normalized token uploaded to the cloud credential-store), not the browser connect-session OAuth flow other providers use. So the generic walker can't drive it inline (the cloud returns 409 unknown_provider for daytona's connect-session).

Change

packages/deploy/src/connect.ts:

  • Add CLI_CAPTURED_PROVIDERS = {daytona} + isCliCapturedProvider().
  • New walker branch: when daytona is not connected (interactive or --reconnect), instead of the misleading "(opens browser)" prompt + connect-session call, it errors integrations.daytona: not connected. Run \agent-relay cloud connect daytona` to capture the credential, then re-deploy.` and gates the deploy.
  • already-connected / --no-prompt / --no-connect paths stay generic and identical to slack/github.

Gating keys on credential existence via the existing GET /api/v1/workspaces/<ws>/integrations/daytona/status?scope=deployer_user route — connected requires connectionMatched !== false AND (oauth.connected:true | status/state:'ready' | ready:true), matching the cloud credential-store contract.

Tests

packages/deploy/src/connect.test.ts — 6 daytona tests:

  • 2 resolver-contract tests locking the connected/pending status shape against the real relayfileIntegrationResolver.
  • 4 walker tests: already-connected (no prompt), --no-prompt gate, interactive instruct-and-gate, --reconnect instruct-and-gate.

Local verification: full deploy package suite 193/193 green, tsc -p clean. This branch is a clean cherry-pick of the source commit onto main, touching only connect.ts/connect.test.ts (disjoint from main's other deploy changes).

Context

Part of the daytona connect end-to-end effort (capture via relay CLI → cloud credential-store + status route + runtime env-injection → deploy gating here). Reviewable independently of the workforce catalog-refresh work.

🤖 Generated with Claude Code

Review in cubic

daytona's credential is captured out-of-band by the relay CLI
(`agent-relay cloud connect daytona` → local `daytona login` → normalized
token uploaded to the cloud credential-store), not the browser
connect-session OAuth flow. Add a CLI_CAPTURED_PROVIDERS branch so the
deploy walker, when daytona is not connected (interactive or --reconnect),
instructs the capture command and gates the deploy instead of attempting a
connect-session that 409s. already-connected / --no-prompt / --no-connect
paths stay generic and identical to slack/github.

Gating reads the existing /api/v1/workspaces/<ws>/integrations/daytona/status
route (scope=deployer_user); connected requires oauth.connected:true /
state:'ready' / ready:true, matching the cloud credential-store contract.

Tests: 6 daytona tests (2 resolver-contract locking the connected/pending
status shape, 4 walker behavior). Full deploy suite 193/193 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bc9d2b40-4454-4576-bbf5-d65a0e412ee9

📥 Commits

Reviewing files that changed from the base of the PR and between 969e657 and 81ba1e8.

📒 Files selected for processing (2)
  • packages/deploy/src/connect.test.ts
  • packages/deploy/src/connect.ts

📝 Walkthrough

Walkthrough

The PR adds support for CLI-captured integration providers like Daytona that are authenticated through the relay CLI instead of OAuth. It defines CLI_CAPTURED_PROVIDERS, detects these providers during integration connection, routes them to emit a relay CLI command instruction to the user rather than starting browser OAuth flows, and includes comprehensive tests validating resolver status handling and orchestration behavior across all connection scenarios.

Changes

CLI-captured provider support for Daytona

Layer / File(s) Summary
CLI-captured provider contract and routing
packages/deploy/src/connect.ts
Introduces CLI_CAPTURED_PROVIDERS set with daytona and isCliCapturedProvider() helper. In connectIntegrations, detects CLI-captured providers (including under --reconnect) and routes them away from browser OAuth by logging a relay CLI instruction error, recording a failed outcome, and continuing without invoking integrations.connect.
Daytona resolver and orchestration tests
packages/deploy/src/connect.test.ts
Adds resolver contract tests validating Daytona status response handling (connected vs pending, with workspace path and deployer-user scope verification) and connectIntegrations behavior tests for already-connected (no prompt, no connect call), not-connected with --no-prompt (failed outcome, no connect call), interactive flow (relay CLI instruction, failed outcome), and --reconnect (relay CLI instruction, no OAuth flow).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

A relay comes to Daytona's shore,
No OAuth dance, just CLI lore—
Connected fast through agent's say,
With tests that show the CLI way! 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Daytona connect support and gating in agentworkforce deploy.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the what, why, and how of adding Daytona support to the deploy connect flow.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch daytona-deploy-connect

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for CLI-captured integration providers (specifically Daytona) where credentials are captured out-of-band rather than via a browser OAuth flow. It adds helper functions and logic to detect these providers, instruct the user to run the appropriate CLI command, and gate the deployment. It also includes comprehensive tests for these scenarios. The reviewer suggested moving the isCliCapturedProvider check earlier in the connectIntegrations loop (before the noPrompt and noConnect checks) to ensure that users in non-interactive or CI/CD environments receive the specific CLI instruction rather than a generic non-interactive failure message.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +735 to +752
if (isCliCapturedProvider(provider)) {
// No browser OAuth flow exists for relay-CLI-captured providers — the
// credential is captured out-of-band. Don't show a misleading "(opens
// browser)" prompt or call connect-session (which 409s); instruct the
// user to run the capture command and gate the deploy. This covers both
// the interactive not-connected path and `--reconnect <provider>` (which
// reaches here when forceReconnect is set).
const command = `agent-relay cloud connect ${provider}`;
input.io.error(
`integrations.${provider}: not connected. Run \`${command}\` to capture the credential, then re-deploy.`
);
outcomes.push({
provider,
status: 'failed',
message: `not connected (run \`${command}\`)`
});
continue;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The isCliCapturedProvider(provider) check is currently executed after the noPrompt and noConnect checks.\n\nWhen --no-prompt or --no-connect is passed (which is common in CI/CD or non-interactive environments), the deployment will fail with a generic and misleading error message (e.g., telling the user to run without --no-prompt to connect inline), rather than instructing them to run the specific CLI command (agent-relay cloud connect <provider>).\n\nSince CLI-captured providers cannot be connected via the browser anyway, we should check isCliCapturedProvider(provider) before the noPrompt and noConnect checks so that the user always gets the correct, actionable instruction.\n\n### Suggested Placement\nMove this block to be the very first check after the statusCheckFailure checks (around line 710, before if (input.noPrompt && !forceReconnect)).

@khaliqgant
khaliqgant merged commit 74c045d into main Jun 12, 2026
3 checks passed
@khaliqgant
khaliqgant deleted the daytona-deploy-connect branch June 12, 2026 13:13
@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer did not push — the PR branch advanced during the review, so fixes were withheld to avoid overwriting newer commits. Re-trigger the review once the branch settles. The notes below are advisory and were not pushed.

Findings

  • packages/web/lib/billing/provider-credential-runtime.ts:410: resolveDaytonaCredentialRuntimeEnv calls core getDaytonaCredential, which builds a CredentialStore from process.env.CREDENTIAL_S3_BUCKET / S3_BUCKET only (packages/core/src/auth/credential-store.ts:285). The new Daytona upload route stores with Resource.WorkflowStorage plus createCredentialStoreS3Client (packages/web/app/api/v1/cli/auth/daytona/credential/route.ts:163). In Worker/runtime contexts this can fail to read the credential even though upload/status succeed. I prepared the minimal fix, but reverted it because local verification could not run.

Addressed comments

  • No bot/reviewer comment artifacts were available locally. .workforce/ only contained pr.diff, changed-files.txt, and context.json, so there were no review threads to validate or address.

Advisory Notes

  • The task metadata is inconsistent: the user text says AgentWorkforce/workforce PR #232, but .workforce/context.json identifies AgentWorkforce/cloud PR #2101. I reviewed the checked-out PR artifacts as requested.
  • I did not leave code edits in the working tree. I initially patched the Daytona runtime resolver to use getDaytonaCredentialFromStore with CredentialStore({ bucket: resolveWorkflowStorageBucket(), client: await createCredentialStoreS3Client(...) }), but npm ci was repeatedly killed before tsc or vitest were installed. Per the task’s rule, I reverted the unverified edit with git restore.
  • Verification could not complete. npm ci and npm ci --ignore-scripts --omit=optional --no-audit --no-fund both terminated with code -1 during dependency extraction; node_modules/.bin/vitest and node_modules/.bin/tsc remained missing. Initial pre-install test/build attempts failed from missing dependencies, not from validated code failures.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Implemented the validated review fix.

Changed connect.ts so CLI-captured providers like Daytona are handled before the generic --no-prompt / --no-connect gates. That means non-interactive Daytona deploys now get the actionable agent-relay cloud connect daytona instruction instead of a misleading generic retry hint.

Updated connect.test.ts to assert the Daytona command under --no-prompt, and added coverage for the --no-connect path at connect.test.ts.

Addressed comments

  • CodeRabbit: reported no actionable review comments; no code change needed. The docstring coverage warning was not tied to a concrete repo CI failure or specific missing function in the changed files.
  • gemini-code-assist[bot] review summary: raised that isCliCapturedProvider should run before noPrompt / noConnect; fixed in packages/deploy/src/connect.ts:711.
  • gemini-code-assist[bot] inline comment on packages/deploy/src/connect.ts: same issue for non-interactive Daytona messaging; fixed in packages/deploy/src/connect.ts:711 and covered in packages/deploy/src/connect.test.ts:1895 / packages/deploy/src/connect.test.ts:1933.
  • agent-relay-code[bot]: raised a packages/web / cloud credential-runtime issue; invalid for this checkout because those files are not present in AgentWorkforce/workforce and the finding is outside this PR’s deploy-only changed files.

Advisory Notes

  • The prior agent-relay-code[bot] finding appears to belong to a different cloud/web repo surface. I left it unchanged because folding that into this PR would be unrelated to the checked-out diff.

Verification run locally with the CI workflow commands:

  • corepack pnpm install --frozen-lockfile
  • corepack pnpm -r run build
  • pnpm run lint
  • pnpm run typecheck
  • pnpm run test

All passed locally. I am not printing READY because I could not verify GitHub mergeability or required CI check completion from the available status data; the connector only exposed the CodeRabbit status.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Implemented the validated PR fix.

Moved the CLI-captured provider branch ahead of generic --no-prompt / --no-connect handling in connect.ts, so Daytona always gets the actionable agent-relay cloud connect daytona guidance and never falls through to misleading browser/OAuth messaging.

Updated tests in connect.test.ts and connect.test.ts to cover --no-prompt and --no-connect explicitly.

Addressed comments

  • CodeRabbit: reported no actionable review comments. Its docstring coverage warning was not tied to a concrete changed-file function or repo CI command, so no code change was made.
  • gemini-code-assist[bot] review summary: raised that isCliCapturedProvider should run before noPrompt / noConnect; fixed in packages/deploy/src/connect.ts:711.
  • gemini-code-assist[bot] inline comment on packages/deploy/src/connect.ts: same noninteractive Daytona messaging issue; fixed in packages/deploy/src/connect.ts:711, covered in packages/deploy/src/connect.test.ts:1895 and packages/deploy/src/connect.test.ts:1934.
  • agent-relay-code[bot] earlier finding about packages/web/lib/billing/provider-credential-runtime.ts: invalid for this checkout and out of this PR’s deploy-only scope; packages/web is not present here.
  • agent-relay-code[bot] later comment claiming this fix was implemented: stale against the current checkout because the issue was still reproducible before my edit; fixed now in packages/deploy/src/connect.ts:711.

Advisory Notes

  • The prior packages/web Daytona credential-runtime note appears to belong to another repo surface and was left unchanged.

Local CI-equivalent commands run:

  • corepack pnpm install --frozen-lockfile
  • corepack pnpm -r run build
  • pnpm run lint
  • pnpm run typecheck
  • pnpm run test

All passed locally. I’m not printing READY because GitHub mergeability and required check completion were not fully available through the provided connector status data.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Implemented the validated fix in connect.ts: CLI-captured providers like Daytona are now handled before generic --no-prompt / --no-connect gates, so users always get agent-relay cloud connect daytona.

Updated tests in connect.test.ts and connect.test.ts to assert the relay CLI command for both non-interactive paths.

Addressed comments

  • CodeRabbit: reported no actionable comments; docstring coverage warning was not tied to a concrete changed-file function or repo CI command, so no code change.
  • gemini-code-assist[bot] review summary: isCliCapturedProvider should run before noPrompt / noConnect; fixed in packages/deploy/src/connect.ts:711.
  • gemini-code-assist[bot] inline comment on packages/deploy/src/connect.ts: same non-interactive Daytona messaging issue; fixed in packages/deploy/src/connect.ts:711, covered in packages/deploy/src/connect.test.ts:1895 and packages/deploy/src/connect.test.ts:1934.
  • agent-relay-code[bot] earlier packages/web/lib/billing/provider-credential-runtime.ts finding: invalid for this checkout and out of PR scope; packages/web is not present here.
  • agent-relay-code[bot] comment claiming this fix was implemented: stale against the current checkout before my edit; fixed now in packages/deploy/src/connect.ts:711.
  • agent-relay-code[bot] later duplicate comment claiming this fix was implemented: same issue, fixed now in packages/deploy/src/connect.ts:711.

Advisory Notes

Verification passed locally:

  • corepack pnpm install --frozen-lockfile
  • corepack pnpm -r run build
  • pnpm run lint
  • pnpm run typecheck
  • pnpm run test

I used a temporary /tmp pnpm shim for the root pnpm run ... scripts because this sandbox could not install the global Corepack shim into /usr/bin; the root scripts themselves ran successfully.

@agent-relay-code

Copy link
Copy Markdown
Contributor

⚠️ pr-reviewer push failed (exit 1) — fixes were not applied to the PR. The notes below are advisory and were not pushed.

Implemented the validated fix in connect.ts: CLI-captured providers like Daytona are now handled before generic --no-prompt / --no-connect gates, so users always get agent-relay cloud connect daytona.

Updated tests in connect.test.ts and connect.test.ts to assert the relay CLI command for both non-interactive paths.

Addressed comments

  • CodeRabbit: reported no actionable comments; docstring coverage warning was not tied to a concrete changed-file function or repo CI command, so no code change.
  • gemini-code-assist[bot] review summary: isCliCapturedProvider should run before noPrompt / noConnect; fixed in packages/deploy/src/connect.ts:711.
  • gemini-code-assist[bot] inline comment on packages/deploy/src/connect.ts: same non-interactive Daytona messaging issue; fixed in packages/deploy/src/connect.ts:711, covered in packages/deploy/src/connect.test.ts:1895 and packages/deploy/src/connect.test.ts:1934.
  • agent-relay-code[bot] earlier packages/web/lib/billing/provider-credential-runtime.ts finding: invalid for this checkout and out of PR scope; packages/web is not present here.
  • agent-relay-code[bot] comment claiming this fix was implemented: stale against the current checkout before my edit; fixed now in packages/deploy/src/connect.ts:711.
  • agent-relay-code[bot] later duplicate comment claiming this fix was implemented: same issue, fixed now in packages/deploy/src/connect.ts:711.

Advisory Notes

Verification passed locally:

  • corepack pnpm install --frozen-lockfile
  • corepack pnpm -r run build
  • pnpm run lint
  • pnpm run typecheck
  • pnpm run test

I used a temporary /tmp pnpm shim for the root pnpm run ... scripts because this sandbox could not install the global Corepack shim into /usr/bin; the root scripts themselves ran successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant