Skip to content

docs(shell): migrating to @cloudflare/computer - #2552

Closed
mattzcarey wants to merge 1 commit into
mainfrom
docs/shell-to-computer-migration
Closed

mattzcarey wants to merge 1 commit into
mainfrom
docs/shell-to-computer-migration

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Adds docs/shell/migrating-to-computer.md and marks @cloudflare/shell deprecated in its docs and README. The guide covers what changes when you switch, both storage schemas, and a script that copies a Shell workspace into Computer through workspace.fs.

We're deprecating Shell so there's one way to give an agent a workspace: a Workspace from @cloudflare/computer.

  • The two packages use different tables (cf_workspace_<namespace> and vfs_*), so switching packages doesn't move any data.
  • We aren't shipping an automatic migration, so the guide documents where each schema lives for people writing their own.

First PR in the Shell deprecation stack. Docs only.


Devin Review

@changeset-bot

changeset-bot Bot commented Oct 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2afb115

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 8 potential issues.

Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Confirm upstream documentation sync

Docs changes require manual updates in cloudflare/cloudflare-docs. Confirm the migration guide and deprecation notice reach their matching MDX pages.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

- `created_at` and `modified_at`. Computer stamps the time of the copy.
- `mime_type`. Computer doesn't store a MIME type per file.

After you've checked the copied files, drop the old table with `DROP TABLE cf_workspace_default` and delete any R2 objects under the old prefix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Other workspaces lose their R2 files

When namespaces share an R2 prefix, deleting all objects beneath it removes files outside the migrated workspace. r2_key includes the namespace after that shared prefix, so other Shell workspaces retain rows pointing to deleted objects.

Learn more

Shell lets one Durable Object use multiple namespaces, each with its own SQL table. Its R2 keys use the prefix followed by the namespace and file path, as shown by r2Key. A user migrating only the default namespace can keep another namespace on Shell with the same prefix. Removing the entire prefix erases that other namespace's content, while its metadata still exists.

Example: code and default both use r2Prefix: "agent-1". Migrating default and deleting agent-1/* also removes agent-1/code/src/main.ts, although cf_workspace_code still references it.

Recommended fix: Limit R2 cleanup to the r2_key values read from the migrated namespace's table before dropping it; do not delete the whole shared prefix. Verify migrated data before deleting those keys.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

if (entry.type === "directory") {
await to.fs.mkdir(entry.path, { recursive: true });
} else if (entry.type === "symlink") {
await to.fs.symlink(entry.target!, entry.path);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Interrupted symlink copies block migration retries

If a later copy fails, the next onStart retries earlier symlinks and hits existing links. The marker stays unset, so every startup repeats the failed migration.

Learn more

The example uses a single completion marker after copying all entries. A failure after a symlink is written, such as a later R2 read or filesystem write error, leaves the marker absent. The next onStart reruns the loop, and creating the same symlink again fails because its path already exists. The agent then cannot complete its startup until the partially copied link is removed or the script is changed.

Example: Copy /shortcut first, then fail while reading /z-large.bin. On restart the copy reaches /shortcut again, receives EEXIST, and never gets to /z-large.bin.

Recommended fix: Make link copying resumable by checking the destination with lstat and comparing readlink to the source target before skipping it. Handle mismatched entries explicitly so a failed or interrupted run can safely resume.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.


- Computer only runs inside a Durable Object. It takes `ctx.storage`. D1, custom `SqlBackend`s, and `InMemoryFs` have no replacement.
- One Durable Object storage holds one Computer workspace. Shell's `namespace` option has no equivalent yet ([cloudflare/computer#219](https://github.com/cloudflare/computer/issues/219)).
- Computer keeps all file content in SQLite and does not write large files to R2 yet ([cloudflare/computer#217](https://github.com/cloudflare/computer/issues/217)). R2 mounts are read-only.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Expand contraction in R2 limitation

The documentation style rule prohibits contractions; use "does not" here.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.


The schema is documented in [`docs/03_filesystem_schema.md`](https://github.com/cloudflare/computer/blob/main/docs/03_filesystem_schema.md). The DDL that ships is in [`packages/dofs/src/schema/`](https://github.com/cloudflare/computer/tree/main/packages/dofs/src/schema): `core.ts` for the filesystem tables, `sync.ts` for sync state, and `migrations.ts` for version upgrades.

Don't insert rows into the `vfs_*` tables by hand. Chunk hashes, the revision counter, and the change log have to agree with each other. Write through `workspace.fs` and Computer keeps them consistent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Expand contraction in schema guidance

The documentation style rule prohibits contractions; use "Do not" here.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

}
```

Run the copy once, for example from `onStart`, and record that it ran so it doesn't repeat:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Expand contraction in copy instructions

The documentation style rule prohibits contractions; use "does not" here.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Things the copy does not keep:

- `created_at` and `modified_at`. Computer stamps the time of the copy.
- `mime_type`. Computer doesn't store a MIME type per file.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Expand contraction in MIME note

The documentation style rule prohibits contractions; use "does not" here.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

- `created_at` and `modified_at`. Computer stamps the time of the copy.
- `mime_type`. Computer doesn't store a MIME type per file.

After you've checked the copied files, drop the old table with `DROP TABLE cf_workspace_default` and delete any R2 objects under the old prefix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Expand contraction in cleanup advice

The documentation style rule prohibits contractions; use "you have" here.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@agent-think

agent-think Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

✅ agents import sizes: no significant changes (48d9c36f → 2afb115b, workflow run)

@pkg-pr-new

pkg-pr-new Bot commented Oct 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@2552

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@2552

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@2552

hono-agents

npm i https://pkg.pr.new/hono-agents@2552

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@2552

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@2552

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@2552

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@2552

commit: 2afb115

@mattzcarey

Copy link
Copy Markdown
Member Author

Replaced by a cleaner stack, #2559 to #2565.

@mattzcarey mattzcarey closed this Oct 12, 2026
@mattzcarey
mattzcarey deleted the docs/shell-to-computer-migration branch October 12, 2026 11:48
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