Skip to content

Commit 9c32ad7

Browse files
fix(fork-ci): the agent context budget compares against the PR base, not upstream main (#1905)
## Problem Upstream's `agent-context-budget.yml` compares a PR's budget against `main`. On the fork, `main` mirrors upstream, so a fork PR that shrinks the budget still fails when the fork carries more context than upstream (#1904: `claudeSystemAppendBytes: 5135 -> 5258`). ## Change `hyprws-agent-context-budget.yml` copies upstream's check but compares against the PR's base branch, so a stack layer compares against the layer below it. - **Label:** `agent-context-increase` created - **Docs:** fork-sync covers `hyprws-*` copies After merge, upstream's `agent-context-budget.yml` gets `gh workflow disable`, like the other upstream workflows. ## Scope and approval Requested by the maintainer after the false red on #1904. ## Verification - `vp run fork:ci` → exit 0 - **Self-test:** this PR's budget run reads `hyprws` Claude Opus 5.5, Claude Code. ## Fork trailers Fork-Domain: fork-meta Fork-Tier: bugfix Fork-Upstreamable: no Co-authored-by: donjor <[email protected]>
1 parent 8392dad commit 9c32ad7

3 files changed

Lines changed: 68 additions & 9 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: hyprws Agent Context Budget
2+
3+
# Fork copy of upstream's agent-context-budget.yml, which compares against `main`,
4+
# the fork's upstream mirror. This one compares against the PR's base branch, so
5+
# a stack layer is judged against the layer below it. Fails when a PR raises a
6+
# value in agentContextBudget.json; the agent-context-increase label accepts it.
7+
on:
8+
pull_request:
9+
types: [opened, synchronize, reopened, labeled, unlabeled]
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: hyprws-agent-context-budget-${{ github.event.pull_request.number }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
budget:
20+
name: Agent context budget
21+
runs-on: ubuntu-24.04
22+
timeout-minutes: 5
23+
env:
24+
BUDGET: apps/server/src/provider/agentContextBudget.json
25+
BASE_REF: ${{ github.base_ref }}
26+
ALLOW_INCREASE: ${{ contains(github.event.pull_request.labels.*.name, 'agent-context-increase') }}
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v6
30+
with:
31+
sparse-checkout: apps/server/src/provider/agentContextBudget.json
32+
sparse-checkout-cone-mode: false
33+
34+
- name: Compare with base
35+
run: |
36+
git fetch --quiet --depth=1 origin "$BASE_REF"
37+
if ! git cat-file -e "FETCH_HEAD:$BUDGET" 2>/dev/null; then
38+
echo "$BASE_REF has no agent context budget yet."
39+
exit 0
40+
fi
41+
git show "FETCH_HEAD:$BUDGET" > "$RUNNER_TEMP/base.json"
42+
grown=$(jq -r --slurpfile base "$RUNNER_TEMP/base.json" '
43+
to_entries[]
44+
| select($base[0][.key] != null and .value > $base[0][.key])
45+
| "\(.key): \($base[0][.key]) -> \(.value) (+\(.value - $base[0][.key]))"
46+
' "$BUDGET")
47+
if [ -z "$grown" ]; then
48+
echo "Agent context is not larger than $BASE_REF."
49+
exit 0
50+
fi
51+
printf 'Agent context grew compared to %s:\n%s\n' "$BASE_REF" "$grown"
52+
if [ "$ALLOW_INCREASE" = "true" ]; then
53+
echo "Accepted by the agent-context-increase label."
54+
exit 0
55+
fi
56+
echo "::error file=$BUDGET::Agent context grew compared to $BASE_REF. Cut the added text, or ask a maintainer to add the agent-context-increase label."
57+
exit 1

‎docs/fork/internals/fork-delta.md‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -502,14 +502,15 @@ When a tag ships upstream's external MCP client audience (`pingdotgg/t3code#1522
502502

503503
### Shape
504504

505-
| Item | Role |
506-
| ------------------------------------------------- | ---------------------------------------------------------------- |
507-
| `.github/workflows/hyprws-ci.yml` | Checks, tests, trailer check, desktop build |
508-
| `.github/workflows/hyprws-body.yml` | Advisory body checks: citations, squash trailers |
509-
| `.github/workflows/hyprws-release.yml` | Human-cut stable releases plus a prerelease per `hyprws` landing |
510-
| `scripts/fork-release-version.ts` | Resolves channel metadata and the previous tag in that channel |
511-
| `scripts/build-desktop-artifact.ts` | Derives the update feed from `GITHUB_REPOSITORY` |
512-
| `apps/desktop/src/updates/updateChannels.fork.ts` | Maps a nightly tag to the `hyprws-nightly` updater channel |
505+
| Item | Role |
506+
| --------------------------------------------------- | ---------------------------------------------------------------- |
507+
| `.github/workflows/hyprws-ci.yml` | Checks, tests, trailer check, desktop build |
508+
| `.github/workflows/hyprws-body.yml` | Advisory body checks: citations, squash trailers |
509+
| `.github/workflows/hyprws-release.yml` | Human-cut stable releases plus a prerelease per `hyprws` landing |
510+
| `.github/workflows/hyprws-agent-context-budget.yml` | Upstream's budget check, compared against the PR base |
511+
| `scripts/fork-release-version.ts` | Resolves channel metadata and the previous tag in that channel |
512+
| `scripts/build-desktop-artifact.ts` | Derives the update feed from `GITHUB_REPOSITORY` |
513+
| `apps/desktop/src/updates/updateChannels.fork.ts` | Maps a nightly tag to the `hyprws-nightly` updater channel |
513514

514515
Stable tags are `vX.Y.Z-hyprws.N`; nightlies are `vX.Y.Z-hyprws-nightly.YYYYMMDD.N`, with a six-hour changed-head check as fallback.
515516
`hyprws-release.yml` omits upstream's `concurrency.queue: max`, because one pending slot supersedes builds the newest commit already contains.

‎docs/fork/operations/fork-sync.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,9 @@ Add the `merge_group` trigger before requiring a queue in the ruleset.
253253

254254
### Upstream workflows and merge settings
255255

256-
Keep only the five `hyprws-*.yml` workflows enabled.
256+
Keep only the `hyprws-*.yml` workflows enabled.
257257
Disable every other workflow with `gh workflow disable`; they expect upstream secrets and runners.
258+
A sync can add an upstream workflow, which arrives enabled: disable it, or adapt it as a `hyprws-*.yml` copy.
258259

259260
```bash
260261
gh repo edit RSI-Software/t3code-hyprws \

0 commit comments

Comments
 (0)