Skip to content

Drops never happen in 0.41.0 #401

Description

@tenshiak

Short description

As in the title

What happened?

Execution threshold at 70%, but the drop never happens.

[2026-08-31T09:12:18.831Z] [magic-context][01a054c2-f060-7b80-9def-76931176cc6d] historian trigger eval: usage=79.2% (195902 tokens) [session_meta], checking trigger...
[2026-08-31T09:12:18.850Z] [magic-context][01a054c2-f060-7b80-9def-76931176cc6d] compartment trigger: not firing at 79.2% because projected post-drop usage is 47.6% (target 52.5%)

Then I told it to use ctx_reduce and it went even lower.

[2026-08-31T09:12:41.256Z] [magic-context][01a054c2-f060-7b80-9def-76931176cc6d] historian trigger eval: usage=79.6% (196841 tokens) [session_meta], checking trigger...
[2026-08-31T09:12:41.268Z] [magic-context][01a054c2-f060-7b80-9def-76931176cc6d] compartment trigger: not firing at 79.6% because projected post-drop usage is 30.6% (target 52.5%)
[2026-08-31T09:12:41.268Z] [magic-context][01a054c2-f060-7b80-9def-76931176cc6d] historian trigger eval: shouldFire=false (no trigger condition met)

I suspect there is some wrong comparison check (>= instead of <= or something). If the projected post-drop usage is below the target, it should drop.

EDIT: Yes it fails if projected post drop is below drop target. Which makes no sense. It should be reversed if I understand this error correctly.

projectedPostDropPercentage <= relativePostDropTarget
and
projectedPostDropPercentage <= relativePostDropTarget

    // Force only at the threshold-derived band; below it the proactive path retains precedence.
    if (usage.percentage >= forceMaterializationPercentage) {
        if (
            projectedPostDropPercentage !== null &&
            projectedPostDropPercentage <= relativePostDropTarget
        ) {
            sessionLog(
                sessionId,
                `compartment trigger: skipping force band ${forceMaterializationPercentage}% because projected post-drop usage is ${projectedPostDropPercentage.toFixed(1)}% (target ${relativePostDropTarget.toFixed(1)}%)`,
            );
            return { shouldFire: false };
        }

Diagnostics

Plugin version

No response

OpenCode version

No response

Platform

No response

Client

Pi

Log output (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions