Skip to content

feat: durable REPL sessions — core eval loop - #156

Closed
ben-reitz wants to merge 1 commit into
mainfrom
feat/durable-repl
Closed

ben-reitz wants to merge 1 commit into
mainfrom
feat/durable-repl

Conversation

@ben-reitz

Copy link
Copy Markdown

Thanks for your interest in Cloudflare Computer.

This repository does not accept unsolicited pull requests. Please open one of the accepted contribution types instead:

Maintainers may close pull requests that do not come from an approved collaborator. If a maintainer asked you to open this pull request, they can add the allow-pr label and reopen it.

workspace.repl(name).eval(code) gives agents a durable JavaScript REPL:
a session is a replayable log in the workspace DO SQLite, not a
process. Every eval builds a fresh dynamic isolate (runtime eval is
banned there), replays committed cells against recorded effects, and
records the new cell. Failed cells never enter the log; sessions
survive DO eviction with state rebuilt exactly and effects never
re-fired.

- acorn cell transform: top-level declarations persist via globalThis,
  value = explicit return or trailing expression
- recorded nondeterminism (audited against a live dynamic isolate):
  Math.random, Date.now, no-arg new Date() / Date(), crypto.randomUUID,
  crypto.getRandomValues, performance.now; WeakRef/FinalizationRegistry/
  caches removed so use fails loudly instead of silently diverging
- result follows the common interpreter convention plus a structured
  "value" field; logs are one ordered stream with console levels kept
  (logs.entries + logs.dropped); unclonable successes render into
  results[] instead of failing
- replay divergence is a hard, structured error (kind mismatch and
  unconsumed-effects both covered by tests); evals serialize per
  session; deny-by-default egress (globalOutbound: null); wall-clock
  timeout maps to a structured timeout error
@changeset-bot

changeset-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5e53aad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your interest in Cloudflare Computer.

This repository does not accept unsolicited pull requests. Please use one of the accepted contribution paths instead:

If a maintainer asked you to open this pull request, they can add the allow-pr label and reopen it.

@github-actions github-actions Bot closed this Sep 23, 2026
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