Skip to content

Opencode Forces Compaction #4

Closed

Description

@null-axiom

I noticed that after changing the execute_threshold_percentage configuration, Opencode shows an error toast saying I’ve exceeded the model’s context window.

To preface, I’m using gpt-5.3-codex, which has a 400k context window, and magic-context has already been shrinking the context over time. Even at 30%, that should still be around 120k tokens, so I wouldn’t expect this limit to be hit.

Afterwards, it starts compacting using the built-in Opencode compaction and not magic-context compaction.

Once I reverted the change to the configuration, it seemed to work just fine.

One more thing I noticed: in the TUI popup for /ctx-status the execute threshold stays at 65% and doesn't reflect the configuration.

Image Image

Activity

  1. changed the title [-]Opencode Forces Compression[/-] [+]Opencode Forces Compaction[/+] on Apr 9, 2026
  2. ualtinok commented on Apr 9, 2026

    @ualtinok
    Contributor

    Could you share the full config file and
    bunx @cortexkit/opencode-magic-context@latest doctor
    output.

  3. null-axiom commented on Apr 9, 2026

    @null-axiom
    Author

    config that failed (i removed the execute_threshold_percentage after and it was fine):

    {
      "$schema": "https://raw.githubusercontent.com/cortexkit/opencode-magic-context/master/assets/magic-context.schema.json",
      "enabled": true,
    	"execute_threshold_percentage": {
    		"default": 50,
    		"openai/gpt-5.3-codex": 30
    	},
      "historian": {
        "model": "anthropic/claude-sonnet-4-6",
        "fallback_models": ["anthropic/claude-sonnet-4-6"]
      }
    }
    

    doctor output:

    ┌  Magic Context Doctor
    │
    ◆  OpenCode installed
    │
    ◆  OpenCode config: /Users/xxx/.config/opencode/opencode.json
    │
    ◆  Magic Context config: /Users/xxx/.config/opencode/magic-context.jsonc
    │
    ◆  Plugin registered in opencode.json
    │
    ◆  No conflicts detected (compaction, DCP, OMO hooks)
    │
    ◆  TUI sidebar plugin configured
    │
    ◆  Plugin cache up to date (v0.8.3)
    │
    ●  Log file: /var/folders/m2/k53h3fjs6wjc7lpx8s6kk6fw0000gn/T/magic-context.log (4449 KB)
    
    │
    └  Everything looks good! ✨
    
  4. ualtinok commented on Apr 9, 2026

    @ualtinok
    Contributor

    Interesting,

    One more thing I noticed: in the TUI popup for /ctx-status the execute threshold stays at 65% and doesn't reflect the configuration.

    This one suggests that there was an error with the config which loaded the default values for everything (65% exec thresh) but that doesn't explain the Input exceeds context window model.

    Were you able to reproduce? Also if your log still has logs for when that compaction happened, we can understand better.

  5. null-axiom commented on Apr 9, 2026

    @null-axiom
    Author

    magic-context.log

    this was the log at the bottom of the doctor output

    also I can reproduce this every time the configuration is set

    regarding this:

    One more thing I noticed: in the TUI popup for /ctx-status the execute threshold stays at 65% and doesn't reflect the configuration.

    I think it might not be reading the config correctly and displaying it because the compaction occurs when I set the configuration so it is properly reading it somewhere...

  6. ualtinok commented on Apr 9, 2026

    @ualtinok
    Contributor

    Okay found the issue: execute_threshold_percentage minimum configurable value is 35 and unfortunately when lower than 35 is set, currently, the whole plugin disables itself. This will be fixed in the next release. (also lowering the min to 20)

  7. null-axiom commented on Apr 9, 2026

    @null-axiom
    Author

    I know this isn't the right thread for it but can u look at #3 again...

    I left a comment on it, but since it's closed I'm not sure you'll see it again.

  8. added a commit that references this issue on Apr 10, 2026
    ebfcab3
  9. added a commit that references this issue on May 3, 2026
  10. added a commit that references this issue on Jun 3, 2026
  11. 24 remaining items

  12. added 3 commits that reference this issue on Aug 27, 2026
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