Skip to content

fix(platform): use a replacement runtime token on install resume - #682

Merged
Brooooooklyn merged 1 commit into
mainfrom
fix/install-resume-runtime-token
Nov 3, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
fix/install-resume-runtime-token

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Fixes #666

Problem

install --resume (past the draft stage)
   ├─ env runtime token ── ignored, saved token wins          ✗
   ├─ saved token rejected ── no prompt, fails every time    ✗
   └─ deployed API / proxy ── keep old CF_API_TOKEN          ✗

Fix (only platform-lifecycle.ts)

resolve runtime token:  env ─► saved ─► prompt
        │                (saved rejected + TTY → prompt; cancel keeps saved)
        ▼
token ≠ saved token?  ──or──  saved update left by a crash?
        │ yes                          │ yes
        └──────► updateExistingWorkers ◄┘
                        │
     workerSecretUpdates = { CF_API_TOKEN }   (nothing else)
                        │
     installer: saves token + update first, then uploads;
                next resume finishes it if the run stops

The installer, the secrets builder and the update mechanism are unchanged. The fix only feeds the token into them.

Answers to the issue's questions

# Question Answer
1 Should an explicit env token win on a non-draft resume? Yes, for the runtime token only. Other saved values (JWT, project key, email key, GitHub, R2) keep their current order.
2 Push to existing Workers, or refuse? Push, through the existing workerSecretUpdates intent. Only CF_API_TOKEN is sent. With no saved token to compare (another machine), nothing is sent, as before.

Tests

File Covers
platform-setup-flow.test.ts env token wins and is the only update; same or unset token → no update; no saved token → no update; saved update after a crash is passed on; saved email key not sent; rejected saved token → prompt; cancel keeps saved token; rejected env token fails without a prompt
platform-install-cutover.test.ts stateful fake Cloudflare: first install stops → resume #1 sends the new token to API, stops before proxy → resume #2 without env still sends it to proxy and finishes

One existing test ("reuses the saved management token on resume") set the env runtime token and expected the saved one to win. It now leaves the runtime env var unset and keeps its check.

Docs: one paragraph in docs/guide/platform/installation/setup.md.

Verification

  • vp run test: 529 files, 11,927 tests passed.
  • vp run --filter ./packages/void typecheck, vp lint, vp fmt clean.

🤖 Generated with Claude Code

After an install passed the setup-draft stage, `install --resume` kept the
saved runtime token and ignored VOID_PLATFORM_RUNTIME_CLOUDFLARE_API_TOKEN.
Workers the interrupted run had deployed also kept the old CF_API_TOKEN.

- An explicit runtime token now wins over the saved one on every resume.
  A rejected saved token can be replaced at the prompt; cancelling keeps
  the saved token.
- When the token differs from the saved one, it is sent to the deployed
  API and proxy Workers through the existing Worker secret update. A saved
  update left by a crash is finished on the next resume.
- Only CF_API_TOKEN is sent. GitHub, R2 and email values keep their saved
  values and are not sent as updates.

Fixes #666

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T03:15:25.527495Z 609664f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-install-resume-runtime-token-void-cloud.voidzero-docs.workers.dev (commit 609664f)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://1bd9a0a2-void-cloud.voidzero-docs.workers.dev 609664f 2026-11-03T03:15:05.342Z Visit the dashboard ↗

@Brooooooklyn
Brooooooklyn merged commit 2ecbb7f into main Nov 3, 2026
20 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/install-resume-runtime-token branch November 3, 2026 04:55
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.

platform: interrupted install ignores a replacement runtime token and never updates deployed Workers

1 participant