Skip to content

cli: compaction rejected as out-of-origin free-tier request while inside opencode #55575

Closed as not planned

Description

@Irsyadmr354

Summary

Compaction fails with:

OpenCode's free tier can only be used from within OpenCode. Download it at https://opencode.ai and keep building.

The session is inside opencode. Compaction appears to issue its summarization request through a path that bypasses the in-session origin, so the free-tier gate classifies an internal request as an external one.

Environment

  • opencode version: 1.19.0 (opencode), v0.0.0-beta-17823 (opencode2) — both reproduce
  • OS: Windows_NT 10.0.26200 (win32 x64)
  • Terminal: TERM=xterm-256color, TERM_PROGRAM unset, COLORTERM unset
  • Shell: C:\WINDOWS\system32\cmd.exe
  • Install/channel: beta (opencode2); opencode on PATH as stable
  • Active plugins: C:\Users\irsya.config\opencode\plugins\orca-opencode-status.js
  • Config: none of opencode.json, opencode.jsonc, .opencode/opencode.json, ~/.config/opencode/opencode.json present

Reproduction

  1. Launch opencode (opencode or opencode2).
  2. Build up enough conversation length to trigger compaction (or invoke compaction directly).
  3. Compaction runs and returns the free-tier "can only be used from within OpenCode" rejection.
  4. Note OPENCODE_TERMINAL=1 is present in the session environment.

The rest of the session works normally — only the compaction request is rejected.

Expected Behavior

Compaction is an internal session operation. Its summarization request should carry the same origin as the rest of the session and be permitted on the free tier.

Actual Behavior

The compaction request is rejected as an out-of-origin free-tier request. The user is inside opencode for the entire reproduction. Compaction never completes, so the session cannot be compacted.

Additional Context

  • Two opencode binaries on PATH: opencode (1.19.0) and opencode2 (v0.0.0-beta-17823). Both fail identically, which suggests the compaction request path drops or rewrites the origin marker regardless of binary.
  • OPENCODE_TERMINAL=1 is set. If compaction spawns a sub-request that does not inherit session environment or origin metadata, that would explain the classification.
  • Terminal env is partial: TERM set, TERM_PROGRAM and COLORTERM empty. Possible secondary factor if the free-tier gate does environment-based origin detection.
  • Frequency: consistent on both binaries, every time compaction is reached.
  • Workaround: none found. Compaction is a hard blocker for long sessions.
  • Impact: sessions that exceed the compaction threshold cannot be compacted at all on the free tier.

Activity

  1. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    Thanks for the report! A few details would help us work out what's happening:

    1. Which model and provider are you using when compaction fails (e.g. opencode/big-pickle, Muse Spark, MiMo, ...)? Do normal messages on that same model work fine?
    2. Version: opencode 1.19.0 is v1, which only gets critical fixes, and v0.0.0-beta-17823 is a snapshot build rather than a stable release. Does it also happen on the current stable v2 (npm i -g @opencode/cli, then check opencode --version shows 2.0.29)?
    3. Plugin: does it still happen with orca-opencode-status.js temporarily removed from ~/.config/opencode/plugins?
    4. How compaction starts: does it fail for both automatic compaction and running /compact yourself? Does session title generation work?
    5. A screenshot of the error, or the matching lines from the log file, if you can.

    Please answer briefly in your own words. On the current code, compaction sends the same session and client headers as normal messages, so the cause is probably somewhere else.

    You can reply here, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.

    Possibly related issues, ordered from most to least likely:

  2. Irsyadmr354 commented on Oct 15, 2026

    @Irsyadmr354
    Author

    Resolved on 2.0.29 stable — the beta snapshot was the cause.

    Answers:

    1. Model/provider: opencode/* free tier. Normal messages on the same model work fine; only compaction failed. Title generation was in the same family.

    2. Version: failure was on opencode2 v0.0.0-beta-17823 (2.0 preview snapshot) and on opencode 1.19.0. After npm i -g @opencode-ai/cli, opencode --version reports 2.0.29 and compaction succeeds.

      So the repro is snapshot-specific. Useful to know whether the preview branch still has it or never had it.

    3. Plugin: orca-opencode-status.js was active throughout, including on the working 2.0.29. Not the cause.

    4. Trigger: both automatic compaction and manual /compact failed on the snapshot. Neither works there.

    5. Screenshot: in the original report.

    Environment for the record:

    • Windows_NT 10.0.26200, win32 x64
    • shell cmd.exe, TERM=xterm-256color, TERM_PROGRAM and COLORTERM unset
    • OPENCODE_TERMINAL=1 set in the session environment
    • no opencode.json / opencode.jsonc in the project; config at ~/.config/opencode/opencode.jsonc

    Closing as fixed-by-version. Leaving the details in place so it's searchable by anyone hitting this on a preview build.

  3. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    Thanks for following up, and glad compaction works on 2.0.29!

    On your question about preview builds: the beta-* snapshots were built from the old v2 preview branch. That branch became the main dev line on 2026-10-10, and current releases like 2.0.29 are built from dev, so there isn't a separate preview branch that could still have this bug. In the current code, compaction sends its request through the same path, with the same session and client headers, as normal messages. That matches what you saw on 2.0.29. If you still have an old opencode2 snapshot installed, it's worth removing it so it doesn't get picked up by accident.

    On 1.19.0 (v1), which only gets critical fixes, staying on v2 is the way to go.

    If it comes back on 2.0.29 or a newer release, please reply here with the version and the model you were using. Otherwise this issue will be closed automatically.

  4. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    Closing this one: as you confirmed, compaction works on stable 2.0.29. The failure only happened on the old beta-* preview snapshot and on v1 (1.19.0). Thanks for the clear follow-up and for leaving the details here for anyone who hits this on a preview build.

    If it comes back on 2.0.29 or a newer release, please open a new issue with the output of opencode --version and the model you were using.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions