Skip to content

Split the DEV behaviour test pool between merge-queue and pull-request runs #9373

Closed

Description

@waynesun09

What this asks for

Give merge-queue E2E runs their own part of the DEV test pool, so pull-request runs cannot use up the API quota the queue needs, and the reverse.

cc @ifireball @ggallen @rh-hemartin for a decision on the split and its size.

Why

Pull-request runs and merge-queue runs of E2E Tests both use the dev environment and the same 22 orgs (halfsend-01 to halfsend-22). Each org has its own quota of 5,000 API requests an hour, and every suite claims repos from whichever org has free slots. The two kinds of run therefore spend the same quota.

On 2026-11-11 and 12 this stopped the queue:

  • Five merge groups (max_entries_to_build: 5) plus pull-request runs were in progress at once.
  • All 22 orgs returned 403 rate limit: primary quota exhausted. Suites ran no scenarios and were killed at the 45-minute job limit.
  • Nothing merged from 23:34 to 05:01 UTC. It recovered only after re-runs and re-queues were held back by hand so that about three suites ran at a time.

From that night, the pool carries about three behaviour suites at once (about seven orgs each). This is a measurement from one incident, not a tested limit.

Proposed

Choose the pool's org range from the event that started the run.

Run Orgs today Orgs proposed (starting point)
merge_group halfsend-01 to -22, shared halfsend-01 to -14
pull_request, issue_comment, workflow_dispatch halfsend-01 to -22, shared halfsend-15 to -22
push to main (stage) halfsend unchanged

The code already describes a pool as a range: PoolLayout{FirstOrgIndex, OrgCount, SlotsPerOrg} in pkg/behaviourtest/drivers/install/slotpool.go, and PoolLayoutForEnvironment picks the stage or dev layout. The change is:

  1. Let the dev layout take an optional org range from the environment (for example BEHAVIOUR_POOL_FIRST_ORG and BEHAVIOUR_POOL_ORG_COUNT), validated to stay inside 1..DevPoolOrgCount. Unset means the whole pool, as today, so local runs do not change.
  2. In .github/workflows/e2e.yml, set those two values from github.event_name for the behaviour and playback jobs.
  3. Check everything that is sized from the layout follows the range and not the full pool: test mint groups (planCFMints, groupWorkflowHostRepos), the workflow-identity repo lists, garbage collection of stale slots, and the capacity error text.
  4. Update the behaviour-testing guide: which runs use which orgs, and how to change the split.

Trade-offs to decide

  • Each side gets a lower ceiling. With 14 and 8 orgs, the estimate is two queue suites and one pull-request suite at a time. A second concurrent pull-request suite would wait for slots or hit the quota sooner than it does today.
  • max_entries_to_build should match the queue's share. With a share of about two suites it should be 2, not 5. That is a separate one-line change to the branch ruleset and is needed with or without this split.
  • Alternative: more orgs. Adding orgs for the queue keeps pull-request capacity as it is, at the cost of setting up each org and extending the gateway and mint configuration.
  • Alternative: cap pull-request suites with a concurrency group. No pool change, but GitHub keeps only one pending run per group and cancels the others, so pull-request runs would be cancelled, not queued.

Done when

  • A merge_group run and a pull_request run started together claim repos only from their own org ranges (shown in both job logs).
  • With the range variables unset, the layout is the full pool and existing tests pass unchanged.
  • An out-of-range or unparsable value fails the run at start with a message that names the variable.
  • Unit tests cover the range parsing and that mint groups and repo lists are built from the range.
  • The guide documents the split.

Related

Activity

  1. fullsend-ai-triage commented on Nov 12, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 12:37 PM UTC · Completed 12:38 PM UTC

    Commit: 2a6db51 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.15

  2. added
    triaged
    on Nov 12, 2026
  3. fullsend-ai-triage commented on Nov 12, 2026

    @fullsend-ai-triage

    Triage notes (net-new information only):

    Fix targets verified. The layout code in pkg/behaviourtest/drivers/install/slotpool.go (PoolLayout, PoolLayoutForEnvironment, DevPoolOrgCount), the mint-group helpers in the same package, the behaviour/playback jobs in .github/workflows/e2e.yml (already switching on github.event_name), and the behaviour-testing guide all exist as described.

    Workflow changes required. Step 2 of the proposal edits .github/workflows/e2e.yml. The code agent cannot modify workflow files under current permissions, so it will not be auto-dispatched. A human PR or maintainer action is needed for that part. The Go changes (range parsing, validation, layout-derived mint groups and repo lists, GC) and the docs update can be done separately.

    No conflicting work found. No open PR addresses this. #9353 (cancelling discarded merge groups) and #8883 (pool expansion and concurrency) are complementary and don't block this. #8036 (infrastructure retry) is also complementary.

    Open decision for maintainers. The 14/8 split and the max_entries_to_build value are stated as starting points. Implementing the range as configuration, not hardcoded policy, keeps that decision adjustable after merge.

    Proposed test case:

    Dev layout from env:
    - unset vars          -> FirstOrgIndex=1, OrgCount=22 (unchanged)
    - first=15, count=8   -> orgs 15..22
    - first=0 / count=0 / first+count-1>22 / non-numeric -> error naming the variable
    Layout-derived outputs with first=15,count=8:
    - planCFMints / groupWorkflowHostRepos / workflow-identity repo lists contain only halfsend-15..22
    - stale-slot GC and capacity error text refer only to that range
    

    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  4. ifireball commented on Nov 12, 2026

    @ifireball
    Member

    @waynesun09 IIRC there was wark being done to enable GitHub emulation, how far are we from that, if that is landing soon, perhaps we should make the pre-MQ BT use emulation and only let the MQ and STAGE BT use real orgs.

    If we do implement this, I'd rather we use different org names, eg. halfsend-NN for PR tests, halfsand-NN for MQ tests.

  5. waynesun09 commented on Nov 12, 2026

    @waynesun09
    MemberAuthor

    @ifireball Short answer: emulation is not landing soon enough to replace the PR-stage pool, so the split is still needed now. Status of the two candidates, checked today:

    vercel-labs/emulate (in-process API emulator)

    jctanner/github-emulator on the breadboard K3s stack (executes workflows)

    Blocker Detail
    Unmerged changes The stack carries about 15 patches to this repo and 6 to the agents repo. Open here: #9050, #9051, #9052, #9054, #9056, #9158; some have no PR yet
    Test harness The harness cannot target another GitHub host yet (API base URL, raw-content URLs, an install mode that uses an external mint). Overlaps #9163
    Size Single-node K3s with the emulator, runner pods, sandbox controller, mint and locally built images, on a 32 GB VM. It will not fit a GitHub-hosted runner (16 GB), so it would be a hosted, shared stack that PR jobs call
    Speed About 7 minutes per scenario at concurrency 1. The suite needs about 12 in parallel to fit 45 minutes; nothing above 1 has been measured
    Fidelity Jobs run on the emulator's own runner, not GitHub's. A gating suite there can pass or fail for reasons GitHub would not

    What I'd suggest

    1. Do the pool split and lower max_entries_to_build now.
    2. Start behaviourtest: run dispatch-decision scenarios against a GitHub API emulator, piloted on owners-auth #9161 to take the dispatch-decision scenarios off the real orgs. That is the nearest cut in PR-stage load.
    3. Treat "PR runs on a hosted emulator, queue and stage on real orgs" as a later step, after a green whole-tier run at real concurrency on that stack. A hosted stack is also a shared pool, limited by its VM in place of API quota, and it needs per-run isolation and an owner.

    On naming: separate org names per side (halfsend-NN and halfsand-NN) work for me. Do you mean new orgs for the queue, or renaming part of the existing 22? New orgs keep PR capacity as it is, at the cost of the per-org setup.

  6. jctanner commented on Nov 12, 2026

    @jctanner
    Contributor

    The 32 GB figure is the breadboard Vagrantfile's allocation for the whole development stack — 26 pods including MLflow, observatory, org-pulse, markovd, three emulators (GitHub, GitLab, Jira), the dashboards and the runner. It is not the GitHub emulator's requirement.

    Measured on that stack today: the github-emulator pod runs at ~250 Mi (k8s requests 512 Mi, limits 1536 Mi), and the entire namespace sums to under 4 Gi. An emulator-only deployment for PR-stage testing (emulator + Postgres + k3s + a runner) is a few GB and fits a 16 GB GitHub-hosted runner with room to spare, so a hosted emulator is not blocked on VM size.

  7. waynesun09 commented on Nov 16, 2026

    @waynesun09
    MemberAuthor

    Update: pull-request behaviour tests on a GitHub emulator

    Goal: Stop using the shared test-org pool on pull requests so only the merge queue leases from it.

    Result (on a fork, nothing filed here yet)

    • 86 of the 97 behaviour scenarios, including playback, pass in one workflow run against a GitHub emulator on GitHub-hosted runners.
    • The run takes 14 to 22 minutes. It is one workflow with 6 jobs in parallel (5 behaviour shards and playback), each on its own GitHub-hosted runner.
    • The job uses no secrets, no environment, and no id-token. It needs only contents: read, so it also runs on fork pull requests.
    • The remaining 11 scenarios need a real model and stay in the merge queue.

    Where to look

    Run Emulator build Result Time
    43793810138 0d2233d 86 of 86, first attempt 21m31s
    43802736734 796b88c 86 of 86, first attempt 14m22s
    43805415507 c90fff5 85 of 86, then 86 after rerunning one shard (the shared home directory collision below) 20m41s
    43809138871 c90fff5 85 of 86, then 86 after rerunning one shard (the broken-pipe exit below) 16m20s

    Reliability on real pull requests

    We ported open pull requests from fullsend and agents to the forks and ran them through the job: 121 runs in two rounds. Each ported pull request shows its runs in the Checks tab:

    Repository Round 1 Round 2
    fullsend 35 of 37 37 of 37
    agents 21 of 24 19 of 23

    No failure came from a pull request's change. The 9 failed runs have four causes:

    • An emulator bug, 1 run. Fixed.
    • A broken-pipe exit in the agents post-code script, 5 runs. It also fails on the live suite, and an open agents pull request fixes it.
    • The sandbox refusing its first outbound call, 3 runs. The sandbox network is ready 7 to 15 s after start, and fullsend's pre-flight does not retry "permission denied". The live suite shares this exposure.
    • Two installs colliding in a home directory shared by the job's runners, 1 run. Fixed in the job.

    How it works

    Each job starts the emulator (jctanner/github-emulator), 12 real actions/runner processes, a locally built token mint, and one sandbox host on the same VM. A stub answers model calls.

    Target split

    Pull request Merge queue
    behaviour-emulator (new, includes playback) Runs Skipped
    behaviour and playback (live, all 97) Skipped Run
    Shared test-org pool Not used Used

    A failure that only real GitHub can reveal then appears in the merge queue, not on the pull request. Maintainers can still run the live suite on a branch through its manual trigger.

    What it needed

    • fullsend: the test harness can target an emulator, and the standalone mint, the sandbox, and the OIDC fetch honour a configured GitHub server.
    • Emulator: 62 fixes, each with a test, mostly for running the real Actions runner under load. They are on a fork and not in the emulator project yet.

    Decision asked of the team

    1. Use the emulator job as the pull-request behaviour check and keep the live suite for the merge queue only. Pull requests then need no test-org pool at all, so the pool split this issue proposes would no longer be needed.
    2. Decide where the emulator lives and who maintains it. fullsend CI would pin it by commit, and the 62 fixes have to land there first.

    Next, if the team agrees

    1. Settle where the emulator lives and land the fixes there.
    2. File the fullsend changes as issues, including the pre-flight retry, then add the workflow beside the live suite as a non-required check.
    3. After two green weeks, make it required and stop the live behaviour and playback checks on pull requests in one change.
  8. waynesun09 commented on Nov 16, 2026

    @waynesun09
    MemberAuthor

    Update 2: the emulator job now takes about 9 to 10 minutes

    Pull request feedback time matters, so we widened the job and shortened its start-up. This follows the first update. Everything is still on forks; nothing is filed here.

    Result

    • All 86 scenarios passed on the first attempt in both runs of the final layout, taking 8.9 and 10.0 minutes. Previously, the job took 14 to 22 minutes.
    • The workflow runs 17 parallel jobs, each on its own GitHub-hosted runner: 16 behaviour shards and playback.
    • One aggregate check, behaviour-emulator, passes only when every shard and playback pass. The ruleset would name that one check, whatever the shard count.
    • You can rerun a flaky shard alone with "Re-run failed jobs"; the other shards keep their results.
    • This costs about 50% more runner minutes per run. Permissions remain unchanged: no secrets, contents: read only.
    Layout Runs First attempt Wall time, minutes Runner minutes per run
    5 shards, 6 workers each (before) 4 86, 86, 85 and 85 of 86 14.4 to 21.5 71 to 88
    11 shards, 4 workers each 2 86 of 86 in both 12.4 and 14.0 112 and 114
    16 shards, trial runs 5 86 of 86 in all 5 8.7 to 11.2 117 to 133
    16 shards, final 2 86 of 86 in both 8.9 and 10.0 107 and 121

    Wall time runs from the first job start to the last job end. It excludes any wait for hosted runners.

    Where to look

    What made it faster

    • Lighter VM load. A hosted VM has 4 vCPUs. At 4 workers, it runs at 77 to 87% CPU, making scenarios take 2 to 3 times longer. The longest scenario takes 283 s alone on a VM, but took about 600 s in the 5-shard layout. Most shards now run 2 scenarios at a time.
    • Shorter start-up, down from 184–209 s to 110–187 s per job. Runners register in parallel, while downloads, the mint build, and the test compile run in the background.
    • Cheaper file reads in the emulator. Loading the agent harness takes about 1,000 file requests per job. Each request previously started three git processes; it now starts one. Under load, harness load time dropped from 65–104 s to 6–8 s.

    What sets the floor now

    • Start-up takes 2 to 3 minutes of every job.
    • The 18 mint-scope rows form one scenario outline and run as one shard. Splitting it requires a tag filter in the test harness. We have not done this.
    • Playback runs 5 agent stages in a row, taking about 7 to 9 minutes as a job.

    Emulator changes in this round

    We landed 6 changes and checked each against github.com. These checks found and fixed 4 more differences from GitHub in the touched code: runner registration tokens, runner scope, raw-bytes file requests, and files of 1 MiB or more.

    Unchanged from the first update

    The scenario count (86 of 97), the reliability numbers, the two fixes worth landing first (the agents post-code broken-pipe exit and a pre-flight retry in fullsend), and the decision asked of the team remain unchanged.

  9. waynesun09 commented on Nov 17, 2026

    @waynesun09
    MemberAuthor

    Update 3: the whole suite in one job, and why shards help

    Short answer to "why shards, and can one job run the suite in parallel?": one job works. On a 4-vCPU hosted runner it gets no more done past 2 to 3 scenarios in parallel. One job costs less than half the runner minutes of 16 shards, but takes about 38 minutes instead of about 10. The choice is feedback time against runner minutes.

    We ran all 85 non-playback scenarios in one job and profiled it. Everything is still on forks; nothing is filed here.

    Result

    "Workers" below means scenarios running in parallel in one job.

    • One job with 3 workers passes all 85 scenarios. The tests take 35 minutes, and the job takes 38 including setup.
    • One job with 6 workers is slower: 55 minutes of tests, 60 for the job, 84 of 85 passing. The one failure is the agents post-code broken-pipe exit from update 1, not the emulator.
    • Playback still runs as a separate job in parallel, taking about 7 to 9 minutes. The table includes it.
    Layout Wall time, minutes Runner minutes per run (all jobs added up)
    One job, 3 workers, plus playback about 38 about 46
    One job, 6 workers, plus playback about 60 about 68
    16 shards plus playback (update 2) 8.9 and 10.0 107 and 121

    Why more workers in one job do not help

    Past 2 to 3 workers, the runner gets no more work done, and each scenario takes longer. CPU is not simply full: it is still idle about a quarter of the time. The emulator is the part that cannot run in parallel:

    • The emulator is one Python process with one SQLite write lock. At 6 workers, requests waited 370 s in total for that lock, against 8 s at 3. Most of each lock hold is spent waiting for the busy process, not writing to the database, and every other write waits behind it.
    • In the emulator's profile, starting git processes takes 12.5% of its time, and re-reading workflow files on each event takes about 9%.
    • The same 85 scenarios cost about 45% more CPU at 6 workers than at 3, not counting the profiler. The profiler ran only on the 6-worker job and used about 12% of its CPU, so some of the gap between 55 and 35 minutes is profiler cost.

    Disk, memory and network are not the limit. I/O wait stays under 2%, and there is no memory pressure and no swap.

    What would make one job faster

    Three emulator changes, which we have not made yet:

    1. Start git outside the emulator's request loop, or start fewer git processes. The emulator starts about 380 per scenario.
    2. Cache parsed workflow files between events.
    3. Hold the write lock only for database work.

    The emulator itself (Python and the git it starts) is about 40% of the CPU at 3 workers. Runners, checkout, the sandbox and the Go build make up the rest. So we expect these changes to cut one job from 35 to roughly 30 minutes of tests, and to stop 6 workers from being slower than 3. They would not bring one job near 10 minutes, and they would barely change the 16-shard time. That is our estimate; we have not measured it. A larger hosted runner (8 or 16 vCPUs) is the other option, also untried.

    Where to look

    • One-job run: 44081162817. Each job's artifact has the CPU, I/O and lock logs. The 6-worker job also has an emulator profile.
    • Probe branch: waynesun09/fullsend bt-f1-io-probe at b93994fd6. A manual run with features=all repeats the comparison. It uses the same emulator build, d1d00d2.

    Unchanged from update 2

    The 16-shard layout stays the proposal for pull requests. If the team prefers fewer runner minutes to faster feedback, the one-job layout works today with no other change.

  10. self-assigned this
    on Nov 17, 2026
  11. waynesun09 commented on Nov 17, 2026

    @waynesun09
    MemberAuthor

    The fixes that stand on their own on main are now four pull requests, tracked in #9607. All four are ready to merge and need only a maintainer approval.

    PR What it fixes Checks Threads Review
    #9613 Bot identity probes verify the token from the JWKS n and e, not only x5c All pass, incl. behaviour and playback 0 open Review bot approved
    #9616 Standalone mint honours a configured GitHub API and issuer All pass, incl. behaviour and playback 0 open Review bot approved
    #9625 fullsend run binds the GitHub provider profiles and the OIDC host to the configured server All pass, incl. behaviour, playback and codecov 0 open Review bot approved
    #9624 Sandbox pre-flight retries until policy DNS is ready, instead of failing on the first refused connect All pass, incl. behaviour and playback 0 open Review bot approved
    • Merge order doesn't matter; the four don't touch the same files.
    • The merge queue limit dropped from 5 to 3 groups built at once (chore(rulesets): build at most 3 fullsend merge groups at once org#67, merged and live), so the queue stays within what the test pool can carry.
    • The emulator job itself and the harness changes that only matter against another server wait until the emulator has a home in the org.
  12. waynesun09 commented on Nov 23, 2026

    @waynesun09
    MemberAuthor

    Closing: the goal is met by a different route

    This issue asked that pull-request runs stop using the API quota the merge queue needs. We did not split the pool by org range. Pull requests no longer use the pool at all: they run the behaviour suite on a GitHub emulator, as @ifireball suggested above. Follow-up work is in #9812.

    What landed

    Change Where Date
    Merge queue builds at most 3 groups at once (was 5) fullsend-ai/org#67 2026-11-17
    Four fixes found by running against another GitHub server #9616, #9624, #9625, #9731 (tracked in #9607) 2026-11-19 and 11-20
    behaviour-github-emulator job: 86 of 97 scenarios, about 9 minutes, no secrets, works on forks #9734 2026-11-20
    Check required on main; live behaviour and playback run only in the merge queue and on main fullsend-ai/org#73, #9740 2026-11-20
    A maintainer can run the live suites on a pull request with /ok-to-test <sha> live #9762 2026-11-20
    fullsend-ai/agents made the same switch agents#2142, agents#2148, fullsend-ai/org#81 2026-11-21
    The emulator has a home in the org, with releases that this repository pins by commit fullsend-ai/github-emulator, now at 2026.11.21 (#9776) 2026-11-21
    Developer guide for the pull-request check #9771 2026-11-21

    Result so far

    • Pull requests, 2026-11-20 to 11-23: 166 finished emulator runs, 137 passed, 27 cancelled by newer pushes, 2 failed. Both failures were on pull requests that changed the job itself.
    • Merge queue, 2026-11-21 to 11-23: no rate-limit failure. The failed logs have no 403 or quota lines, and the lowest quota reading was 2,323 of 5,000 remaining.
    • The queue's live suite still fails about one run in three for other reasons. Behaviour tests: merge-queue reliability and follow-ups after the emulator switch #9812 lists the signatures.

    Not done, and why

    • The org-range split proposed here (BEHAVIOUR_POOL_FIRST_ORG, BEHAVIOUR_POOL_ORG_COUNT) is not needed while pull requests stay off the pool.
    • max_entries_to_build is 3, not the 2 proposed here. It matches the roughly 3 suites the pool carries.

    Moved to #9812

    Queue failure signatures, #9353 and #9354, #9414 and #9420, #8883, #9154, the live check on agents main, the slow agents job in pull-request runs, and #9756.

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

Metadata

Metadata

Assignees

Labels

triaged

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions