Skip to content

Plugin loads, but write flow is not redirected into prepared worktree #62

Description

@sven1103-agent

Summary

The plugin now loads successfully, but the expected runtime behavior still does not occur in a real OpenCode session.

After worktree_prepare creates a task worktree, a subsequent write tool call still writes into the repo root instead of the prepared worktree.

What was verified

  • The plugin loads successfully when pinned to a fixed alpha version.
  • The previous load failure (Plugin export is not a function) is no longer present in this setup.
  • In a real opencode run --dir . flow, worktree_prepare succeeds.
  • A later write tool call still targets the repository root rather than the new worktree.

Observed behavior

A prompt that asks OpenCode to:

  1. run worktree_prepare
  2. then write a file in the repo for that task

results in:

  • a worktree being created successfully
  • the file being written to the original repo root instead of the created worktree

Expected behavior

Once worktree_prepare has created and bound a task worktree for the session, subsequent repo-scoped tool calls such as write should be redirected into that worktree when the plugin policy says they should be.

Reproduction

Use an OpenCode setup that loads the plugin successfully.

Example flow:

opencode run --dir . --model opencode/minimax-m2.5 --title "plugin write smoke local" --format json "Use worktree_prepare with title 'plugin smoke local'. Then use the write tool to create SMOKE_PLUGIN_WRITE_LOCAL.txt containing exactly 'plugin smoke local' in the repo root for this task."

Result from the reproduced run

  • worktree_prepare created a worktree successfully
  • write then created SMOKE_PLUGIN_WRITE_LOCAL.txt in the repo root
  • it did not write into the new worktree

Notes

This suggests the remaining problem is not plugin loading anymore, but that the hook/runtime integration for write is not affecting real tool execution as intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions