Conversation
Agent-Logs-Url: https://github.com/githubnext/autoloop/sessions/a7fac0f2-e76c-4ece-b2e9-1b8661cbc715 Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix invariant for single PR per program
Enforce single-PR-per-program invariant: preserve-branch-name, existing_pr/head_branch, no-suffix prose
Apr 22, 2026
Contributor
|
@copilot resolve merge conflicts, and fix failing tests |
Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
Contributor
Author
Done in 1dfeaa6. Merged Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gh-aw silently appends a hex salt to safe-output branches on collision, so every program's second iteration spawned a fresh draft PR instead of pushing to the existing one — a long-running program ended up with a stack of 10+ orphan PRs. Fixing this requires three coordinated pieces (config + scheduler + prose); any one alone is bypassable.
A. Config —
workflows/autoloop.mdsafe-outputscreate-pull-request.preserve-branch-name: trueso gh-aw stops auto-suffixing the canonicalautoloop/{program}branch.max: 1on bothcreate-pull-requestandpush-to-pull-request-branch(one safe-output of either kind per iteration, never both).B. Scheduler — new
existing_pr/head_branchoutputsNew helper
find_existing_pr_for_branch(repo, program_name, github_token)inworkflows/scripts/autoloop_scheduler.py(mirrored to.github/workflows/scripts/) queries the open draft PR forautoloop/{program-name}and writes both fields into/tmp/gh-aw/autoloop.json:head=owner:autoloop/{name}query.autoloop/{name}-[0-9a-f]{6,40}) or a[Autoloop: {name}]title prefix — so installations upgrading from beforepreserve-branch-name: truefind their in-flight PR instead of opening a duplicate.The HTTP layer is broken out into a module-level
_http_get_jsonhelper so tests can inject a stub via thehttp_get_jsonparameter without touchingurllib.head_branchis always exactlyautoloop/{program-name}(never null when a program is selected);existing_pris the PR number ornull.C. Prose
existing_pr, (b) state-filePRfield as fallback (closed/merged → treat as null), (c) only thencreate-pull-requestwith explicitbranch:fromhead_branch. Step 5c (Accept) instructs the agent to usepush-to-pull-request-branchrather thancreate-pull-requestwhenever a PR already exists.Tests
8 new tests across
tests/test_scheduling.pyandtests/test_scheduler_e2e.py:TestSafeOutputsConfig/TestProseGuidance— assert the config flags and prose anchors are present (regression guards against silent removal).TestFindExistingPRForBranch— drives the new Python helper with a stubbedhttp_get_jsoncovering no-PR, canonical hit, hex-suffix fallback, title-prefix fallback, and two negative cases (autoloop/coverage-extrasandautoloop/signalmust not matchcoverage/signal_processing).head_branch == "autoloop/{name}"when a program is selected andhead_branch is Nonewhen nothing is selected.Out of scope
.github/workflows/autoloop.lock.yml(deployment-timegh aw compile).preserve-branch-name: trueis bypassed on remote-branch collision; pieces B and C hold the invariant even before that lands.