Skip to content

feat(core): showcase worktree tools and permission dependencies - #4

Open
ivanmilevtues wants to merge 1 commit into
devfrom
worktree-tools-demo
Open

ivanmilevtues wants to merge 1 commit into
devfrom
worktree-tools-demo

Conversation

@ivanmilevtues

Copy link
Copy Markdown
Member

Architecture diff showcase

Copies the four changed-file snapshots from anomalyco#53981 (original author: James Long). This branch starts directly from this fork's dev, independently of the provider demo.

What to highlight

  • Worktree create, list and remove tools in the OpenCode tool plugin.
  • Connections to filesystem access, permissions, Git and worktree services.
  • Permission checks before destructive worktree removal.

Demo-only compatibility limits

This is a source snapshot demo, not a clean cherry-pick or runnable backport. The fork lacks the upstream tool-plugin module and newer service APIs. Consequently the diff includes the full upstream module and test fixture/documentation changes relative to this fork, not just the original upstream PR hunks. Missing dependencies and registration are not ported. Do not merge as a production feature.

Verification

All three copied TypeScript files pass Bun syntax transpilation. The four files are unchanged upstream snapshots. Runtime tests/typechecking are not claimed to pass: prerequisite APIs are missing. CodeBoarding's generated review is the showcase output to inspect.

Copy the four changed-file snapshots from anomalyco/opencode PR anomalyco#53981 for an architecture-diff demo against this fork's dev. This is not a runnable backport: the newer upstream tool plugin and worktree APIs are absent here.

Upstream source: anomalyco#53981
Original author: James Long

Amp-Thread-ID: https://ampcode.com/threads/T-01a13d0d-fbe1-76fa-8fad-21c3940a2399
Co-authored-by: Amp <amp@ampcode.com>
@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

CodeBoarding review

Status: 2 changed components

See the full change in CodeBoarding.

graph LR
    n_Core_Platform_Runtime["Core Platform #38; Runtime"]
    n_Application_Client["Application Client"]
    n_Management_Console["Management Console"]
    n_Terminal_User_Interface["Terminal User Interface"]
    n_Desktop_Shell["Desktop Shell"]
    n_Infrastructure_Tooling["Infrastructure #38; Tooling"]
    n_API_Protocol_Specifications["API Protocol Specifications"]
    n_Effect_SQLite_Drivers["Effect SQLite Drivers"]
    n_Web_Share_Viewer["Web Share Viewer"]
    n_Enterprise_Portal["Enterprise Portal"]
    n_Integrations_Automation["Integrations #38; Automation"]
    n_Serverless_Functions["Serverless Functions"]
    n_Core_Platform_Runtime -- "resolves locale utilities from" --> n_Management_Console
    n_Desktop_Shell -- "detects native locale using" --> n_Application_Client
    n_Infrastructure_Tooling -- "validates translation plurals against" --> n_Application_Client
    classDef added fill:#1f883d,stroke:#0b5d23,color:#ffffff;
    classDef modified fill:#bf8700,stroke:#7d4e00,color:#ffffff;
    classDef deleted fill:#cf222e,stroke:#82071e,color:#ffffff,stroke-dasharray:5 3;
    class n_Core_Platform_Runtime modified;
Loading

download artifacts · run 38670802655

@ivanmilevtues
ivanmilevtues marked this pull request as ready for review October 15, 2026 02:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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-10-15T02:33:32.976754Z bbc7228 Draft marked ready
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbc7228936

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +87 to +89
export const Plugin = {
id: "opencode.tools",
effect: Effect.fn("OpenCodeTools.Plugin")(function* (ctx: Context) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Register the OpenCode tool bundle in production

The new Plugin is never imported or installed by any production bootstrap, so session_rename, session_move, the worktree operations, and models will not appear for users despite the new documentation. A repo-wide search at this commit finds only this declaration and tests, and those tests mask the omission by invoking OpenCodeTools.Plugin.effect(...) directly; register these built-ins through the production tool registration path.

AGENTS.md reference: packages/core/src/tool/AGENTS.md:L32-L32

Useful? React with 👍 / 👎.


### Shell

`shell` executes a command in the host user's shell. Set `workdir` instead of

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use the registered bash tool and permission name

The command tool is registered as bash (packages/core/src/tool/bash.ts) and asserts the bash permission action, with no shell alias in the registry. Calling it shell here and in the permission guidance means users who copy the documented permission rule will not affect command execution and may receive unexpected prompts or denials.

Useful? React with 👍 / 👎.

Comment on lines +121 to +123
Set `background` to true for a dev server or another long-running process.
Background calls return immediately and notify the session when they finish;
they have no timeout unless one is supplied. Large output is shortened and the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove the unsupported background-command option

The documented command schema only accepts command, workdir, and timeout, and packages/core/src/tool/bash.ts explicitly leaves model-facing background launch as a future TODO. A user following this guidance will not get an immediately returning managed job; the command instead runs in the foreground and can block until the normal timeout.

Useful? React with 👍 / 👎.

sections.

```text
Use patch to rename src/old.ts to src/new.ts and update its exported name.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop recommending unsupported patch renames

This example asks the patch tool to rename a file, but packages/core/src/tool/apply-patch.ts explicitly rejects every update with a movePath as "moves are not supported yet." Following the documented workflow therefore deterministically fails instead of renaming the file; the example should use supported delete/add operations or avoid claiming move support.

Useful? React with 👍 / 👎.

Comment on lines +33 to +34
passes PNG, JPEG, GIF, WebP, and PDF files to the model, up to 20 MiB of source
data. Other binary files fail. See [Attachments](/attachments) for supported

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop advertising PDF support in read

The read implementation recognizes a PDF header or .pdf extension and immediately returns BinaryFileError in packages/core/src/tool/read-filesystem.ts; only PNG, JPEG, GIF, and WebP enter the media path. Users following this text will therefore be unable to pass any PDF to the model despite the explicit support claim.

Useful? React with 👍 / 👎.

Comment on lines +42 to +43
current directory unless `path` selects another relative directory; `hidden`
includes hidden entries and `limit` caps the results.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove the nonexistent hidden glob option

The glob input schema contains only pattern, path, and limit, and its ripgrep invocation never reads a hidden value. Supplying the documented option is therefore rejected or ignored rather than enabling hidden entries, so callers cannot obtain the behavior promised here.

Useful? React with 👍 / 👎.

Comment on lines +55 to +56
Its `pattern` uses regular-expression syntax unless `literal` is true. Narrow a
search with `path`, `include`, `caseSensitive`, or `limit`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove the nonexistent grep matching options

The grep schema and execution path accept only pattern, path, include, and limit; neither literal nor caseSensitive is implemented. In particular, a caller searching text containing regex metacharacters cannot make the pattern literal as documented, and supplying these fields is rejected or silently ineffective.

Useful? React with 👍 / 👎.

Comment on lines +211 to +212
```text
Read package.json and README.md in parallel, then return their relevant setup details.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Limit the execute example to tools actually in its catalog

The execute implementation builds its sandbox catalog exclusively from MCP.Service.tools() in packages/opencode/src/tool/code-mode.ts; it does not expose built-ins such as read. Consequently, the documented example that reads two repository files in parallel cannot run in Code Mode unless an unrelated MCP server happens to provide such a tool.

Useful? React with 👍 / 👎.

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