Skip to content

Agent context budget check fails on unrelated pull requests after main lowers a budget value #40022

Closed

Description

@juliusmarminge

What goes wrong

The Agent context budget check fails on pull requests that never touch apps/server/src/provider/agentContextBudget.json, whenever main lowers a value in that file after the pull request's merge commit was built. Running the check again does not help: a re-run checks out the same merge commit and fetches an even newer main.

On 2026-11-20 three merges changed the file on main within 90 minutes (b985057 cut mcpToolListJsonBytes from 57751 to 57696), and five unrelated pull requests failed the check twice each: #37080, #39267, #39529, #37212, #39583. Example from #37212: its merge commit was built on main at 0bc9b57 (57751); the job fetched main five minutes after b985057 and reported mcpToolListJsonBytes: 57696 -> 57751 (+55).

Steps

  1. Open a pull request that does not touch agentContextBudget.json. The check passes.
  2. Merge a change to main that lowers any value in that file.
  3. Re-run the Agent context budget check on the pull request (or add or remove a label, which also triggers it) without pushing.

Now: the check fails with Agent context grew compared to main, naming growth the pull request did not make.

Expected: the check passes, because the pull request adds nothing to the agent context. It should fail only when the pull request's own change raises a value.

Where

.github/workflows/agent-context-budget.yml, step Compare with main: it compares the file in the checked-out merge commit with origin/main as fetched during the job (git fetch --depth=1 origin main, FETCH_HEAD). The merge commit was built on an earlier main, so any value main lowered since then shows up as growth. Comparing with the main commit the merge commit was built on (its first parent, or github.event.pull_request.base.sha) measures only what the pull request changes.

Activity

  1. juliusmarminge commented on Nov 21, 2026

    @juliusmarminge
    MemberAuthor

    Fixed by #40035, now on main: The check now compares the PR merge commit's budget with its own first parent, so a later reduction on main no longer produces false growth on unrelated PRs or reruns.

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