Skip to content

e2e CLI: keep the self-host data dir across restarts#1234

Open
RhysSullivan wants to merge 1 commit into
mainfrom
e2e-cli-persistent-selfhost
Open

e2e CLI: keep the self-host data dir across restarts#1234
RhysSullivan wants to merge 1 commit into
mainfrom
e2e-cli-persistent-selfhost

Conversation

@RhysSullivan

Copy link
Copy Markdown
Owner

Problem

cli up selfhost wiped the data dir on every boot. The dev CLI instance is meant to be persistent (it lives until down), so this erased a connected MCP client's dynamic OAuth registration on every restart, and the client then failed with invalid_client until it re-registered.

Fix

Default cli up to keep the data dir; add --fresh to opt into a wipe. This matches the boot recipe's stated intent (the dev CLI is persistent). The vitest globalsetup is unaffected: it calls bootSelfhost directly with fresh defaulted on, so suite runs stay hermetic.

The dev CLI's self-host instance is meant to be persistent (it lives until
down), but up wiped the data dir on every boot, so a connected MCP client's
dynamic OAuth registration died on each restart and the client then failed
with invalid_client until it re-registered. Make up persist the data dir by
default and add --fresh to opt into a clean slate. The vitest globalsetup is
unaffected: it calls bootSelfhost directly with fresh defaulted on, so suite
runs stay hermetic.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 30, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 1cce4aa Jun 30 2026, 11:47 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 30, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing 1cce4aa Commit Preview URL

Branch Preview URL
Jun 30 2026, 11:46 PM

@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown

Greptile Summary

This PR flips the default fresh behavior for cli up selfhost so that the data directory persists across restarts by default, adding --fresh as an explicit opt-in for a clean wipe. The old --keep-data flag (opt-out from wipe) is replaced by --fresh (opt-in to wipe).

  • The core fix is a one-line change in cli.ts: fresh: !flags.has("--keep-data") becomes fresh: flags.has("--fresh"), so an MCP OAuth client's dynamic registration survives a dev-CLI bounce.
  • The vitest globalsetup (selfhost.globalsetup.ts) calls bootSelfhost without the fresh param, which defaults to true in selfhost.boot.ts (options.fresh ?? true), so automated test runs remain hermetic.
  • Help text and the inline comment are updated consistently with the behavior change.

Confidence Score: 5/5

Safe to merge — the change is isolated to the dev CLI, the vitest globalsetup path is unaffected, and the flag forwarding is correct.

The one-line logic flip is correct: flags.has('--fresh') defaults to false, preserving the data dir on restarts. The vitest globalsetup omits fresh entirely, so bootSelfhost falls through to options.fresh ?? true and still wipes on every automated test run. Flag forwarding via ...flags in runnerArgs carries --fresh to the detached runner correctly. Help text and the inline comment are fully consistent with the new behavior. No unrelated files are touched.

No files require special attention.

Important Files Changed

Filename Overview
e2e/scripts/cli.ts Flips the default for fresh from 'always wipe unless --keep-data' to 'never wipe unless --fresh'; flag forwarding to the detached runner is correct, help text and inline comment are consistent.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Dev as Developer
    participant CLI as cli.ts (up)
    participant Runner as cli.ts (__run)
    participant Boot as selfhost.boot.ts
    participant DataDir as Data Dir (OAuth tokens etc.)

    Dev->>CLI: bun scripts/cli.ts up selfhost
    CLI->>Runner: spawn __run selfhost (flags forwarded)
    Runner->>Boot: "bootSelfhost({ fresh: false })"
    Boot->>DataDir: skip rmSync — data persists
    Boot-->>Runner: BootedProcesses
    Runner-->>CLI: state file written (status: ready)
    CLI-->>Dev: instance URL printed

    Dev->>CLI: bun scripts/cli.ts up selfhost --fresh
    CLI->>Runner: spawn __run selfhost --fresh
    Runner->>Boot: "bootSelfhost({ fresh: true })"
    Boot->>DataDir: rmSync (clean slate)
    Boot-->>Runner: BootedProcesses
    Runner-->>CLI: state file written (status: ready)
    CLI-->>Dev: instance URL printed

    Note over Boot,DataDir: vitest globalsetup calls bootSelfhost with no fresh param
    Note over Boot,DataDir: defaults to true via options.fresh ?? true (always hermetic)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Dev as Developer
    participant CLI as cli.ts (up)
    participant Runner as cli.ts (__run)
    participant Boot as selfhost.boot.ts
    participant DataDir as Data Dir (OAuth tokens etc.)

    Dev->>CLI: bun scripts/cli.ts up selfhost
    CLI->>Runner: spawn __run selfhost (flags forwarded)
    Runner->>Boot: "bootSelfhost({ fresh: false })"
    Boot->>DataDir: skip rmSync — data persists
    Boot-->>Runner: BootedProcesses
    Runner-->>CLI: state file written (status: ready)
    CLI-->>Dev: instance URL printed

    Dev->>CLI: bun scripts/cli.ts up selfhost --fresh
    CLI->>Runner: spawn __run selfhost --fresh
    Runner->>Boot: "bootSelfhost({ fresh: true })"
    Boot->>DataDir: rmSync (clean slate)
    Boot-->>Runner: BootedProcesses
    Runner-->>CLI: state file written (status: ready)
    CLI-->>Dev: instance URL printed

    Note over Boot,DataDir: vitest globalsetup calls bootSelfhost with no fresh param
    Note over Boot,DataDir: defaults to true via options.fresh ?? true (always hermetic)
Loading

Reviews (1): Last reviewed commit: "e2e CLI: keep the self-host data dir acr..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare preview

Console https://executor-preview-pr-1234.executor-e2e.workers.dev
MCP https://executor-preview-pr-1234.executor-e2e.workers.dev/mcp
Deployed commit 1cce4aa

Sign-in is Cloudflare Access (one-time PIN to an allowed email). The preview has its own database and encryption key; it is destroyed when this PR closes.

@pkg-pr-new

pkg-pr-new Bot commented Jun 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1234

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1234

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1234

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1234

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1234

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1234

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1234

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1234

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1234

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1234

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1234

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1234

executor

npm i https://pkg.pr.new/executor@1234

commit: 1cce4aa

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