diff --git a/apps/web/src/components/settings/CloudEnvironmentsSettings.tsx b/apps/web/src/components/settings/CloudEnvironmentsSettings.tsx index 64fa54626a..34fc591053 100644 --- a/apps/web/src/components/settings/CloudEnvironmentsSettings.tsx +++ b/apps/web/src/components/settings/CloudEnvironmentsSettings.tsx @@ -23,8 +23,9 @@ import { SettingsPageContainer, SettingsRow, SettingsSection } from "./settingsL import { searchableSetting } from "./settingsSearch"; const RENDER_DEPLOY_URL = - "https://dashboard.render.com/blueprint/new?repo=https%3A%2F%2Fgithub.com%2Fpingdotgg%2Ft3code&branch=feat%2Frender-cloud-environment"; + "https://render.com/deploy?repo=https%3A%2F%2Fgithub.com%2Fpingdotgg%2Ft3code%2Ftree%2Ffeat%2Frender-cloud-environment"; const CODEX_LOGIN_COMMAND = "codex login --device-auth"; +type RenderAuthenticationMode = "api-key" | "subscription"; function pairingInput(value: string): { readonly host: string; readonly pairingCode: string } { const url = new URL(value.trim()); @@ -113,6 +114,7 @@ export function CloudEnvironmentsSettings() { const [pairing, setPairing] = useState(false); const [pairError, setPairError] = useState(null); const [busyEnvironmentId, setBusyEnvironmentId] = useState(null); + const [authenticationMode, setAuthenticationMode] = useState("api-key"); const renderEnvironments = useMemo( () => environments.filter((environment) => cloudEnvironmentProvider(environment) === "render"), [environments], @@ -189,18 +191,76 @@ export function CloudEnvironmentsSettings() { } - > - Deploy on Render - - - } /> + +
+
+ + +
+
+ {authenticationMode === "api-key" ? ( +
+ } + > + Deploy with API key + + + } + /> +
+ ) : ( +
+ } + > + Deploy for subscription + + + } + > + + +
+ )} +
+ } /> - - - ); diff --git a/docs/user/render.md b/docs/user/render.md index 476bdafae1..efb50b177a 100644 --- a/docs/user/render.md +++ b/docs/user/render.md @@ -14,21 +14,26 @@ The root [`render.yaml`](../../render.yaml) creates: - a Docker web service containing T3 Code, Codex, Claude Code, Git, and the GitHub CLI; - an ephemeral `/data` workspace for T3 Code state, provider credentials, and repositories; +- an optional `OPENAI_API_KEY` secret prompt for automatic Codex authentication; - a health check against T3 Code's public environment descriptor. ## Deploy 1. In the Render Dashboard, choose **New → Blueprint**. 2. Connect this repository and select the branch you want to deploy. -3. Deploy the Blueprint and wait for the service health check to pass. -4. Open the service logs and copy the `Pair URL` printed during startup. Treat this URL like a +3. Choose an authentication method: + - **OpenAI API key:** enter `OPENAI_API_KEY` in Render's secret prompt. Startup authenticates + Codex automatically. + - **ChatGPT subscription:** skip the optional API key, then use device login after cloning. +4. Deploy the Blueprint and wait for the service health check to pass. +5. Open the service logs and copy the `Pair URL` printed during startup. Treat this URL like a password: it contains a one-time pairing credential. -5. Open the URL in a browser, or paste it under **Settings → Cloud environments → Pair URL**. -6. Open the Command Palette and choose **Add Project → Cloud environments → Render cloud +6. Open the URL in a browser, or paste it under **Settings → Cloud environments → Pair URL**. +7. Open the Command Palette and choose **Add Project → Cloud environments → Render cloud environment**. Paste a public GitHub URL. T3 Code clones it directly into the Render workspace; there is no local destination picker. -7. Open the project terminal, run `codex login --device-auth`, complete the device login, and start - an agent. +8. API-key deployments are ready immediately. For subscription authentication, open the project + terminal, run `codex login --device-auth`, complete the device login, and start an agent. Repositories are selected after pairing rather than baked into the Blueprint. Each clone is stored under `/data/workspace` for the current Free-instance session. @@ -42,8 +47,12 @@ pull request is merged. Update the `branch` field in `render.yaml` if you rename ## Provider Authentication -The Blueprint does not ask for an OpenAI API key. Free instances do not include Render Shell access, -so clone a public project, open its T3 Code terminal, and run: +For API-key authentication, the Blueprint declares `OPENAI_API_KEY` with `sync: false`. Render asks +for it during the initial deployment and stores it as a secret; the value is never committed to the +repository. The startup script pipes it to `codex login --with-api-key` and removes it from the +server process environment afterward. + +For ChatGPT subscription authentication, clone a public project, open its T3 Code terminal, and run: ```sh codex login --device-auth diff --git a/infra/render/start.sh b/infra/render/start.sh index 4f7d62a90c..31a41ef52e 100755 --- a/infra/render/start.sh +++ b/infra/render/start.sh @@ -26,6 +26,11 @@ export T3CODE_WORKSPACE_DIR="$workspace_dir" mkdir -p "$t3_home" "$workspace_dir" "$codex_home" "$claude_config_dir" +if [ -n "${OPENAI_API_KEY:-}" ]; then + printf '%s\n' "$OPENAI_API_KEY" | codex login --with-api-key + unset OPENAI_API_KEY +fi + if [ -n "${GH_TOKEN:-}" ]; then gh auth setup-git fi diff --git a/render.yaml b/render.yaml index 2ddd9e26eb..34ea3de478 100644 --- a/render.yaml +++ b/render.yaml @@ -18,3 +18,5 @@ services: value: /data/workspace - key: T3CODE_PAIRING_TTL value: 24h + - key: OPENAI_API_KEY + sync: false