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

Offen
#66,910 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
22/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
backend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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)

Vorherrschende Sprache
TypeScript
Sterne
230k
Forks
31.3k
Ø Merge
5 Std. 32 Min.
Gemergte PRs (30 T.)
453

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus anomalyco/opencode

Alle Issues in anomalyco/opencode

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.