Repository navigation
think: drop @cloudflare/shell - #2555
mattzcarey wants to merge 1 commit into
Conversation
|
✅ agents import sizes: no significant changes ( |
| if (options.state) { | ||
| connectors.push(new StateConnector(options.ctx, options.state)); | ||
| } |
There was a problem hiding this comment.
🔴 Stale workspace reads after approval
After a file changes during an approval pause, tools.read replays its old result instead of reading the file again. ToolSetConnector logs reads, while the removed StateConnector re-executed them. Resumed code can overwrite newer file edits.
Learn more
Codemode stores connector results to replay execution after a human approves a paused call. The removed StateConnector marks filesystem reads as replay: "reexecute", so they observe the current workspace on resume. The replacement workspace tools travel through ToolSetConnector, which does not mark reads this way. On resume, runtime.decide returns the recorded result for a non-ephemeral call. This can feed stale file contents to a resumed write.
Example: A script reads /workspace/notes.txt containing alpha, pauses for approval, then writes an edited copy. Another turn changes the file to alpha\nbeta before approval. The resumed script receives its logged alpha read and writes over beta.
Recommended fix: Preserve replay: "reexecute" for read-only workspace calls in the connector used by createExecuteRuntime. Add a test that changes a file between a pause and approval and checks that the resumed read observes the change.
Was this helpful? React with 👍 or 👎 to provide feedback.
| if (options.state) { | ||
| connectors.push(new StateConnector(options.ctx, options.state)); | ||
| } |
There was a problem hiding this comment.
🟡 Existing approvals strand paused executions
After upgrading an explicit state runtime, approveExecution cannot resume its pending runs, even when the gated call uses tools.*. resumeCodemode requires every connector recorded at execution start, including the removed state connector.
Learn more
Codemode records the complete connector list when an execution begins, not only the connectors the script called. Before this change, callers supplying the explicit state option recorded state alongside their other connectors. The runtime keeps the same durable name, but the new connector assembly omits state. resumeCodemode rejects a paused execution before approving its action if any recorded connector is missing.
Example: A previous deployment starts async () => await tools.deploy({ target: "prod" }) with both state and tools configured. The run pauses for approval. After deployment removes the state option, approving that run returns a missing-state error instead of deploying, though its script never calls state.
Recommended fix: Define an upgrade path for paused executions recorded with state: retain a compatible connector until they resolve, or explicitly settle/reject those executions and reconcile their transcript outputs during migration. Test an approval across the old/new connector configuration.
Was this helpful? React with 👍 or 👎 to provide feedback.
| if (connectors.length === 0) { | ||
| throw new Error( | ||
| "createExecuteTool has nothing to expose — provide at least one of " + | ||
| "`tools`, `state`, `browser`, or `connectors`." | ||
| "`tools`, `browser`, or `connectors`." | ||
| ); | ||
| } |
There was a problem hiding this comment.
🔍 Execution guide retains the removed API
The execution guide still teaches state.* and an explicit state option. Readers following its one-liner example now get a tool with no connectors unless a browser binding exists.
Was this helpful? React with 👍 or 👎 to provide feedback.
| "@cloudflare/think": minor | ||
| --- | ||
|
|
||
| Think no longer depends on `@cloudflare/shell`. The execute tool's `state` option is removed, along with the `state.*` sandbox namespace it added. To give sandboxed code the workspace, pass the workspace tools: `createExecuteTool(this, { tools: createAITools({ workspace: this.workspace }) })`. |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Think no longer depends on
@cloudflare/shell. The execute tool'sstateoption and itsstate.*sandbox namespace are removed. To give sandboxed code the workspace, passcreateAITools({ workspace: this.workspace })astools.This is the last Shell import in Think. Codemode is on its way out too, so we're dropping the connector rather than porting it to Computer.
Tests ran: think workers suite.