Skip to content

OpenCode 2.1 compaction events are discarded, so the thread never shows compacting context #26193

Open

Description

@Xzese

What happened

When OpenCode compacts a conversation, T3 does not show “Compacting context” in the thread. OpenCode continues processing, but T3 gives no indication that compaction is happening.

This occurred with a remote T3 server running in a Debian GNU/Linux 13 virtual machine, accessed through T3 Connect.

Diagnosis

The affected T3 build bundles @opencode/client, @opencode/protocol, and @opencode/schema version 2.0.28. Its schemas require a top-level recent string on session.compaction.started and session.compaction.ended.

OpenCode 2.1 removed that field from both events. An event captured from an isolated OpenCode 2.1.4 session contained these data keys:

inputID, reason, sessionID

T3’s original bundled decoder rejected that real event with SchemaError. An instrumented copy with the obsolete requirement removed accepted the same event.

T3 already has adapter branches that translate these lifecycle events into native compaction items. The event fails decoding before those branches can handle it.

Current upstream main, checked at b88da91397c247b98c892831d7e759f72ea4db43, still pins the OpenCode packages to 2.0.28. This source check does not establish that every current build has been reproduced.

Steps to reproduce

  1. Run T3 server 0.1.3-nightly.20261026.3717 with OpenCode 2.1.4.
  2. Open an existing OpenCode-backed T3 conversation containing enough history to compact.
  3. Send /compact through T3.
  4. Observe OpenCode’s session.compaction.started event on /api/event.
  5. Check the T3 thread for a native compaction activity.

Expected: T3 shows “Compacting context” while compaction runs, then records its completion or failure.

Actual before the local patch: OpenCode compacts, but T3 does not create the native compaction item.

Automatic compaction was the original symptom; the controlled reproduction used /compact.

Version

  • T3 server: 0.1.3-nightly.20261026.3717
  • OpenCode: 2.1.4

Environment

Debian GNU/Linux 13, x86_64, running in a Linux virtual machine. T3 runs as a systemd service with a separate OpenCode server. Clients connect remotely through T3 Connect. Exact client build versions were not captured.

Evidence

  • Original T3 decoder: rejected a real OpenCode 2.1.4 compaction-start payload with SchemaError.
  • Patched decoder: accepted that same payload.
  • Patched decoder also accepted a representative completion payload.
  • After activating the local patch, /compact in the existing T3 conversation produced:
    • Compacting context, running, at 2026-10-27T23:15:59.715Z.
    • Context compacted, completed, at 2026-10-27T23:21:46.450Z.

These last two observations came from T3’s persisted native turn items.

Related issues

Related to #22656 and PR #22661, which address missing recent fields in compaction history records, causing rollback to fail.

At PR head 2b6f82208c8dd4c1b960e2ff54537e88c3cbb0da, its normalization applies only to successful message-history requests matching /api/session/<id>/message. The live /api/event stream uses the original authenticated client and bypasses that normalization. The event decoder is unchanged.

Therefore, that PR does not address the live-event failure described here. This report identifies another affected surface of the same schema change.

Fix applied or workaround

A temporary, build-specific local patch removed the obsolete recent requirement from the bundled compaction schemas. The original executable was preserved. This restored native running and completed compaction items in the live thread.

This patch is diagnostic evidence and a local workaround, rather than a proposed upstream implementation.

Filed by

Prepared with Codex, GPT-6.1 Sol, using T3’s triage playbook.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions