Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TheSDEs/opencode-morph-plugin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: morphllm/opencode-morph-plugin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 20 commits
  • 7 files changed
  • 7 contributors

Commits on May 1, 2026

  1. Configuration menu
    Copy the full SHA
    fe60b30 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2026

  1. patch(compact): count reasoning in trigger threshold, drop it from co…

    …mpact input
    
    estimateTotalChars now includes reasoning byte length so the threshold reflects
    what Anthropic actually charges as input_tokens. Without this, sessions with
    heavy reasoning (debug, planning) cross the model's degradation cliff (~200K
    tokens) silently before compaction fires.
    
    serializePart drops reasoning instead of forwarding to Morph compact API. Stale
    reasoning is the LLM's prior internal monologue \u2014 not worth tokens to summarize
    into the frozen block. The latest assistant turn's reasoning still lives in
    the uncompacted tail until next compaction.
    
    PLUGIN_VERSION bumped to 2.0.0-rate-reasoning-patch for visibility in logs.
    package.json version bumped to 2.0.9-reasoning-patch.
    rate authored and tracycam committed May 29, 2026
    Configuration menu
    Copy the full SHA
    090ec21 View commit details
    Browse the repository at this point in the history
  2. feat(compact): /morph compact slash command to force compaction

    Detects `/morph compact` (also /morph-compact, /morph_compact) at the start
    of a user message via the chat.message hook, strips it from the part text,
    and arms a module-level flag. The next experimental.chat.messages.transform
    invocation bypasses both threshold checks (first-compact and re-compact paths)
    and forces compaction. Flag is cleared regardless of success/failure.
    
    Useful when the trigger threshold is set conservatively (e.g. 200K tokens for
    Anthropic quality cliff) but the user wants to compact earlier — or to test
    the compact path without waiting for the threshold to be crossed.
    
    PLUGIN_VERSION → 2.0.1-rate-slash-compact
    package.json   → 2.0.10-slash-compact
    tracycam committed May 29, 2026
    Configuration menu
    Copy the full SHA
    3b8a60f View commit details
    Browse the repository at this point in the history
  3. fix(compact): silence LLM reply after /morph compact

    Previous placeholder "[/morph compact — manual compaction requested]" was
    indistinguishable from a real user request to the LLM, which dutifully
    produced a Markdown summary response (Goal / Constraints / Progress / ...).
    The user perceived this as a second compaction running on top of Morphs.
    
    Now:
    - If the user typed extra text after the command, keep that text and drop
      the command part entirely.
    - If the command was the entire message (the common case), replace it with
      an explicit no-reply directive phrased as an internal marker:
      "[internal: Morph compaction triggered in background. This is not a
      request; do not respond.]"
    
    Side benefit: messages.transform still sees a user turn (no empty-message
    backend issues), but the LLM no longer mistakes the placeholder for a
    summarization request.
    
    PLUGIN_VERSION -> 2.0.2-rate-slash-compact-silent
    package.json   -> 2.0.11-slash-compact-silent
    tracycam committed May 29, 2026
    Configuration menu
    Copy the full SHA
    27ed95c View commit details
    Browse the repository at this point in the history
  4. fix(compact): mutate output.messages in place — compaction was a no-op

    ROOT CAUSE: opencode (packages/opencode/src/session/prompt.ts:1566) invokes
    the hook as
    
      yield* plugin.trigger("experimental.chat.messages.transform", {}, { messages: msgs })
    
    and then ignores trigger.s return value, continuing to read msgs directly
    on line 1572 (MessageV2.toModelMessagesEffect(msgs, model)).
    
    The previous plugin code reassigned the local reference:
    
      output.messages = [...frozen, ...recent]
    
    which only updated the wrapper object passed to the hook. msgs (the original
    array opencode keeps using) was never mutated. The LLM kept receiving the
    full conversation despite Morph reporting "828 messages -> 3 frozen".
    
    EVIDENCE in trial DB ses_1c53c4870ffeSjEoAkn6vHiy53:
    
      Before first auto compact (00:06:01): cache.read=517972, total=518853
      After  first auto compact (00:08:04): cache.read=519046, total=521255
    
    cache.read stayed flat. Anthropic saw the same prompt prefix. Compaction
    was silently a no-op end-to-end.
    
    FIX: helper replaceMessages(output, next) does
    
      output.messages.splice(0, output.messages.length, ...next)
    
    which mutates the same array reference opencode holds. All four assignment
    sites (under-threshold reuse, first compact, re-compact, re-compact failure
    fallback) are routed through it. Spread is replaced with a push loop above
    50k elements as a stack-safety guard.
    
    PLUGIN_VERSION -> 2.0.3-rate-inplace-mutation
    package.json   -> 2.0.12-inplace-mutation
    tracycam committed May 29, 2026
    Configuration menu
    Copy the full SHA
    96452f8 View commit details
    Browse the repository at this point in the history
  5. fix(compact): key compactionState by sessionID — subagents no longer …

    …poisoned by parent
    
    ROOT CAUSE: compactionState and forceCompactOnNextTransform were module-
    level lets, shared across every session in the trial process. After the
    parent session compacted, every subsequent LLM call in any session
    (retries, subagents spawned via task tool) hit the same global. The
    transform hook then ran `replaceMessages(output, [...frozen, ...uncompacted])`
    where `frozen` came from the parent and `uncompacted` was the subagent's
    tiny new messages array — overwriting the subagent's actual prompt with
    the parent's frozen block.
    
    OBSERVED: 3 explore subagents spawned at 01:35 with completely different
    review prompts ALL answered the same unrelated question about FFI/WASM
    flash API — which was the dominant topic captured in the parent's frozen
    block from its 01:01 compaction.
    
    NOTE: only became visible AFTER v2.0.3 (in-place replaceMessages). v2.0.0-
    2.0.2 had the same global-state bug, but their `output.messages = [...]`
    reassignment was ignored by opencode (it reads `msgs` not `output`), so
    the poisoned messages array never reached the LLM. v2.0.3 fixed reference
    preservation and exposed the latent global-state bug.
    
    FIX: compactionStateBySession = Map<sessionID, CompactionState>; ditto
    for forceCompactBySession. transform hook reads sessionID off
    messages[0].info.sessionID (SDK guarantees the field). chat.message hook
    reads sessionID directly from input. If sessionID is unavailable, transform
    degrades to no-op — safer than touching another session's state.
    tracycam committed May 29, 2026
    Configuration menu
    Copy the full SHA
    aa73443 View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2026

  1. Merge pull request morphllm#17 from morphllm/fix/issue-13-compact-event

    Fix Morph handling of OpenCode compaction events
    bhaktatejas922 authored Jun 1, 2026
    Configuration menu
    Copy the full SHA
    dbc6d62 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a0235a3 View commit details
    Browse the repository at this point in the history

Commits on Jun 2, 2026

  1. fix: bump @morphllm/morphsdk to latest to fix WarpGrep failures (morp…

    …hllm#9) (morphllm#20)
    
    Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
    DhruvBhatia0 and claude authored Jun 2, 2026
    Configuration menu
    Copy the full SHA
    330353b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    966590a View commit details
    Browse the repository at this point in the history
  3. chore: track bun.lock in version control (morphllm#21)

    bun.lock was gitignored, so the SDK bump in morphllm#20 only updated
    package-lock.json. Track bun.lock so bun users get the pinned
    dependency tree too.
    
    Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
    DhruvBhatia0 and claude authored Jun 2, 2026
    Configuration menu
    Copy the full SHA
    15d45e4 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    79dcb11 View commit details
    Browse the repository at this point in the history
  5. feat: allow API key via opencode config file (morphllm#11) (morphllm#22)

    Desktop users can set `morph.apiKey` in opencode.json instead of the
    MORPH_API_KEY env var. Env var still takes precedence.
    
    Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
    DhruvBhatia0 and claude authored Jun 2, 2026
    Configuration menu
    Copy the full SHA
    1530983 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    d7d5446 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2026

  1. fix: await async generator return value in warpgrep_codebase_search

    The morphsdk WarpGrepClient.execute() async generator returns a Promise
    from processAgentResult() via `return promise`. Node.js auto-awaits it
    per ECMAScript spec, but Bun does not — the unresolved Promise becomes
    the .next() value.
    
    Without the explicit await, result was a Promise whose .success was
    undefined, and formatWarpGrepResult returned the generic failure message:
    "Search failed: search returned no error details."
    
    The fix is a single line: `result = await value`. This is harmless on
    Node.js (await on a non-Promise is a no-op) and resolves the Promise on
    Bun.
    
    Closes morphllm#24
    fpdy committed Jun 14, 2026
    Configuration menu
    Copy the full SHA
    9a8d60a View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2026

  1. Merge pull request morphllm#25 from fpdy/fix/warpgrep-snapshot-worktr…

    …ee-fallback
    
    fix: await async generator return value in warpgrep_codebase_search (Bun compatibility Issue)
    bhaktatejas922 authored Jun 17, 2026
    Configuration menu
    Copy the full SHA
    27208e7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e25f748 View commit details
    Browse the repository at this point in the history
  3. Merge origin/main into fix/compact-force-and-per-session-state

    Reconcile the per-session compaction work with main's native-compaction
    rework. Both code paths now coexist:
    
    - chat.message `/morph compact` slash command (force-compact) and the
      session.compacted event handler are kept as separate hooks; the event
      handler now clears per-session state (compactionStateBySession) instead
      of the removed global.
    - sessionID is resolved once at the top of the transform hook so the
      native-compaction branch can use replaceMessages() (the in-place
      no-op fix) and clear its own session's frozen block.
    - Compaction log lines keep the per-session context and adopt main's
      formatCompressionPercent() helper.
    - PLUGIN_VERSION restored to main's value (dropped the dev label).
    
    typecheck clean; 67/67 tests pass.
    bhaktatejas922 committed Jun 17, 2026
    Configuration menu
    Copy the full SHA
    cbafd9a View commit details
    Browse the repository at this point in the history
  4. Merge pull request morphllm#19 from tracycam/fix/compact-force-and-pe…

    …r-session-state
    
    fix(compact): make compaction effective, per-session state, and add /morph compact trigger
    bhaktatejas922 authored Jun 17, 2026
    Configuration menu
    Copy the full SHA
    54e20d0 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    aac111a View commit details
    Browse the repository at this point in the history
Loading