claude-agent: plugins that edit earlier messages make every turn fork the Claude Code session

オープン
#66,910 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
22/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
backend

調査の方向性

The fork is decided in sync/decide.ts, which reports a change whenever any earlier message's content hash differs, and sessions.ts then forks the Claude Code session; instructions.ts drops system[0]. Start by reading those three files and reproducing with a multi-turn session that edits an earlier message. Done means later turns resume the same session when only earlier content changed, or plugin system text reaches Claude, with a test covering both cases.

索引モデルが issue の本文から書いたものです。

説明

area/providers platform/wsl type/feature version/v2
Description

I use Magic Context with the claude-agent provider. With the plugin on, every turn creates a new Claude Code session forked from the previous one, instead of continuing the same one.

Quick test on 2.4.2, 5 short turns with claude-sonnet-5:

  • without the plugin: 1 transcript in ~/.claude/projects
  • with Magic Context 0.49.89: 5 transcripts, 4 of them with forkedFrom, and 10 synthetic "No response requested." messages

From what I can see in the code:

  • sync/decide.ts returns "changed" as soon as the content of any earlier message differs from the saved hash, and sessions.ts then forks.
  • instructions.ts drops system[0]. Magic Context puts its instructions there, so Claude never sees them, the plugin rewrites the reply afterwards, and the next turn forks.

Magic Context closed their side as not planned, since editing earlier history is what the plugin does: https://github.com/cortexkit/magic-context/issues/970

#65227 hides the "No response requested" messages, but the forks stay.

Two things would fix it for me:

  1. Pass plugin text in system[0] through to Claude, or tell plugin authors to use their own system part.
  2. Optionally keep the Claude session going when only the content of earlier messages changed, matching messages by OpenCode message ID instead of by content. The old opencode-claude plugin had a draft for this: openchamber/opencode-claude#76
Plugins

@cortexkit/[email protected]

OpenCode version

2.4.2

Steps to reproduce
  1. Enable a plugin that edits earlier messages (Magic Context for example).
  2. Send 5 short turns to a claude-agent model in the same session.
  3. Look at ~/.claude/projects//: 5 transcripts instead of 1.
Operating System

Ubuntu 26.04 (WSL2)

主要言語
TypeScript
スター
230k
フォーク
31.3k
平均マージ
5時間 32分
マージ済み PR(30日)
453

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。