Integrations

Agents, severity and review fixes

A product says which agents work on it. That switches its pull-request flows on, role by role. The reviewer's finding becomes a severity you can see and filter on the board, a medium or worse finding asks GitHub for changes, and a low one can be fixed by an agent with a draft pull request into the reviewed branch.

Where this comes from

Decision D-102, rule BR-61 in BRD §9.6, cases TC-800 … TC-818 in the QA test plan. The pull-request flows themselves are described in Pull-request agents, and the fix machinery in Defect auto-fix. The examples use an invented product, Route Planner.

What it gives you

You wantWhereWhat happens
To see which agents serve a productBack office → Agents, pick the productThe list narrows to that product's agents; each agent shows the products it is assigned to as chips.
To turn a pull-request flow on or off for one productAgents → Edit assignmentsA role with an assigned agent runs; a role without one plans no card on that product.
To find the reviews a person must readBoard → Severity → Medium or worseThe kanban and the table show only medium, high and critical reviews.
To have GAOS block a risky pull requestConfigure the product (any save)A medium or worse finding is posted as changes requested.
To have small findings fixed for youAssign the fixer, turn auto-fix on, list the branchesA low finding becomes a draft pull request into the reviewed branch.
To have GAOS decide what a pull request needs automatedAssign Orion, the automation plannerAn e2e card with no case asks the planner; its decision waits for you to release the card.
To find cards that did not come from GitHubBoard → Label → source:api or source:bundleCards an API client or a bundle's test planner created.

Every i button on the Agents page, beside the board's Severity filter and on the Auto-fix page opens the matching section of this page.

Assignment

A product lists the agents assigned to it. One agent can be assigned to several products: Kite, the unit-test builder, can serve Route Planner and three other products at once. The list is stored on the product record (Product.assignedAgents, Product.assignedSet), so it survives a restart and needs no schema change.

Three states of a product

StateHow you get therePull-request flowsReview event
Not configuredThe default for every product, old and newAll run, as before this featureComment only
ConfiguredSave in Edit assignments, with at least one agentOnly the roles with an assigned agentMedium or worse requests changes
Configured, emptySave with no agent tickedNone; the page says soMedium or worse requests changes

Stop gating returns a product to “not configured” and forgets its list. Cards already on the board when a role is switched off are left alone and finish normally; only new cards are affected.

Which roles assignment switches

RoleAgentThe card it switches
pr-reviewerJunoThe review card when a pull request opens
qaEmber, FlintThe e2e automation card on open and the e2e run card on a staging deploy; without one the staging callback answers 422 unassigned
unit-testKiteThe unit-test card when a pull request merges
fixerMicaReview fixes only (below); the defect auto-fix of D-091 keeps its own switch
automation-plannerOrionThe automation planner’s card, for an e2e automation card with no case or a test planner’s handoff; without one the e2e card keeps its old reason and says the planner was not started

Assignment switches a role on for a product; it does not choose which agent runs a card. Each of these roles has one agent except qa, and the QA tool, not an agent, runs the e2e work. Cards planned by an external-tasks API client and the test planner's cards from a bundle are never gated: they are explicit requests. They carry a source label instead, so you can filter them.

Who may change it

Only an account listed in GAOS_AUTOFIX_ADMINS sees the editor and may post to POST /agents/assign (fields product, agent repeated, action=save|reset). Every change is a RecordUpdated event naming the account's alias, never its address; the first save of a product says that gating and requested changes are now on.

Severity on the board

The reviewer ends its reply with a severity: none, low, medium, high or critical. GAOS stores it as a label of the family severity:* on the card, before anything is posted, so a review that was held for a secret or failed to post still shows what was found.

An operator may correct a severity through the label route (for example to downgrade a false critical). That changes the record only: nothing is posted again and the card does not move.

Comment or request changes

SeverityNot configuredConfiguredCard afterwards
none, lowCommentCommentDone (a low may plan a review fix)
mediumCommentRequest changesDone
high, criticalCommentRequest changesStays in Review, labelled pr-review:needs-manual

GAOS never approves. It requests changes only when it knows the pull request's author and the account that posts the review, and they differ; otherwise it comments. GAOS reviews a pull request once and never dismisses its own review, so a request-changes body ends with: “GAOS reviews once. When these points are addressed, a maintainer dismisses this review.” On a pull request whose author is an agent (ai-assisted, or opened by GAOS) it only comments, and reviews again after each revision: see the revision loop (D-112).

Whose name is on the review

The review posts under the account of GAOS_GITHUB_TOKEN_FILE. If that is a person's token, a request for changes appears as that person's judgement, and where branch protection requires approvals it blocks the merge until someone dismisses it. Use a bot account's token before configuring a product.

On GitLab “request changes” is an unresolved thread and the review is advisory (D-114): the reviewer, triager, test planner and e2e cards work there; the fixer, the automation planner and the unit-test watcher do not yet. See GitLab.

Low findings fixed by an agent

A low finding can become a review fix. GAOS records it as a defect of kind review, already triaged easy, and the auto-fix pipeline does the rest: the fixer agent edits the code, and GAOS opens a draft pull request into the reviewed pull request's own branch, on top of the exact commit the reviewer read. On an agent’s pull request no draft is opened: the revision loop pushes the change onto the pull request itself.

The fix follows the source's root branch. Route Planner's feature/route-limits was cut from staging and targets staging; the fix lands in feature/route-limits and reaches staging when that branch merges. GAOS never opens a review fix against staging, main or any other shared branch.

When a review fix is planned

  1. The product is configured and Mica (fixer) is assigned to it.
  2. Auto-fix is on for the product.
  3. The head branch matches one of reviewFixHeads — patterns with a literal first segment such as feature/*; *, ** and a bare branch name are refused.
  4. The repository is one of the auto-fix targetRepos and not an automation repository.
  5. The day's reviewFixCap (default 3, at most 20, per product, UTC day) is not reached.
  6. The head has not moved since the review, the file list is complete, and the pull request changes nothing under .github/.

The review card's reason says what happened: review posted; review fix planned (<card>), or a reason such as ; no fixer assigned, ; auto-fix off, ; branch not allowed for review fixes, ; review fix cap reached, ; head moved since review.

The settings

Two fields join the product's auto-fix settings (POST /products/{id}/autofix, admins only):

FieldMeaning
reviewFixHeadsOne branch pattern per line, at most 8. Empty: review fixes are off.
reviewFixCapReview fixes planned per UTC day. 0 means the default 3; at most 20. Counted apart from the defect fix cap.

The checks before anything is written

GAOS reads the pull request again before the agent runs, and once more before any branch exists. Any of these blocks the card with the reason shown and closes the review fix:

ReasonWhy
review-pr-closedThe pull request closed or merged.
review-base-changedIts head is another branch now.
review-base-movedIts head is not the commit the reviewer read.
review-forkIt comes from a fork (always refused).
review-shared-branchIts branch is the default branch, the auto-fix base, an allowed retarget base, or protected.
review-branch-not-allowedIts branch no longer matches reviewFixHeads.
review-files-incompleteGitHub's file list was cut short.
review-workflowsIt changes .github/.
review-not-targetThe repository is no longer a fix target.
review-unassignedThe fixer was unassigned since.
review-outside-pathsThe agent edited a file the pull request does not change, or added a file outside their folders.

The fixer sees the review findings and the pull request's code as untrusted data, fenced, after its instructions. Every other auto-fix check still applies: the allowed and forbidden paths, the CI-secret check, the egress screen. When the draft opens, GAOS posts one line on the reviewed pull request: GAOS opened a draft fix: <url>.

What happens next

Where a card came from

Cards planned from a GitHub event or the staging callback carry no source label. The two kinds of card that assignment does not gate say where they came from, so you can filter them on the board's Label select:

LabelThe card
source:apiCreated by an external-tasks API client (a review, unit tests, an e2e automation or run it asked for).
source:bundleThe test planner's card for a bundle of merged pull requests.

The planner sets them; an operator cannot. An API request for a card GitHub already planned adopts that card and adds no label to it. There is no backfill: only cards planned from v0.64.0 on carry a source label.

The automation planner

Since v0.74.0 (D-111). The automation-planner role, agent Orion, decides from a pull request’s own test scenarios what its tests need: a spec written for a case, an existing spec updated, a new epic added to the test catalog, or nothing. It never starts a spec itself: every outcome waits for a person to release the card (BR-67).

When it starts

It is refused, and the reason says so, when the role is not assigned on the product (unassigned:automation-planner) or when GAOS_PLANNER_DAILY planners (default 10, 0 switches the planner off) already started for the product that UTC day (daily).

What it reads

Its context is rebuilt by the poller after a restart before the card can run, as the test planner’s is.

What it may output

DecisionWhat it carriesWhat happens
automateA known case and create or update (with a note); only for a pull request’s plannerThe e2e card stays BLOCKED with qa-planned case:<code> mode:<mode> — move to Ready to start. Moving it to Ready sends the case to the QA tool. An update needs the QA tool’s update capability; without it the card says to update the spec by hand.
catalogA new epic: code, title, path under docs/test-catalog/, contentGAOS opens a draft pull request on gaos/catalog-<epic> in the automation repository, labelled gaos-catalog. A person reviews and merges it; when its cases sync, add QA-case: and move the e2e card to Ready.
noneA summaryThe e2e card stays BLOCKED with the automation planner found nothing to automate.

Every plan carries a summary for the person. When the pull request names no test scenario and the context does not settle it, the planner asks instead: the card waits in Needs you with three options. A plan that breaks a rule, or a reply with no plan, fails the planner card, and the e2e card says so and waits. A catalog plan, or a planner that could not plan, is sent as an automation:planned line, to the pull request’s author for an e2e card, to the group for a bundle. A none or automate plan asks nothing of a person and is never sent (D-123): the decision is on the planner card and the e2e card.

The catalog pull request

GAOS writes only a new file, and refuses, naming the class, when the product has no automation repository (catalog-no-repo), the repository is public (catalog-public), the file already exists (catalog-file-exists), or a workflow with secrets would run on the branch (ci-secrets). Since v0.74.3 the commit carries [skip ci], which GitHub honours for push and pull_request workflows, so only a secret-using workflow on another trigger, such as pull_request_target, refuses the write. A refused write ends the planner card FAILED, so Retry runs it again once the cause is fixed. An open catalog pull request for the same epic is reused. GAOS never merges it, never marks it ready and never pushes to it again. It uses the write token, GAOS_GITHUB_WRITE_TOKEN_FILE, whose scope must cover the automation repository with contents and pull-request write; a 403 or 404 is catalog-token-refused.

The model

The planner runs on claude-opus-5-5, a scoped exception to BR-36 made at the operator’s request. Set GAOS_MODEL_AUTOMATION_PLANNER to change it without a release; a malformed value is ignored. A vendor policy that names a model wins, under Antigravity the product’s own model applies, and no other role changes.

Set it up for a product

  1. Sign in to the back office with an account listed in GAOS_AUTOFIX_ADMINS.
  2. Open Agents, choose the product in the filter, open Edit assignments.
  3. Tick Juno · PR Reviewer, Kite · Unit Test Builder and a QA agent (Ember or Flint), then Save. The notice under the filter now says which roles do not run.
  4. For review fixes: also tick Mica · Defect Fixer, and in the product's auto-fix settings turn auto-fix on, list the target repositories, and set reviewFixHeads (for example feature/* and bugfix/*).
  5. For the automation planner: also tick Orion · Automation planner, and make sure the write token’s scope covers the product’s automation repository.
  6. Check the Board: the next opened pull request shows a review card, then a severity chip.

To undo it, open Edit assignments and press Stop gating.

The second release: e2e kinds, staging creates and merged specs

Built in v0.65.0, waiting on the QA tool

GAOS's half of parts 1–3 shipped in v0.65.0 (D-103, design docs/designs/release-b-e2e-kinds-merge-unit-tests.md). The QA tool's half follows in its own pull requests. Until the QA tool lists a capability, GAOS sends what it sends today, so nothing changes by itself. Unit tests (part 4) get a design of their own.

The second release finishes the e2e automation builder. In short: when a repository is deployed to staging, GAOS runs its automation of the repository's kind and, if the product asks for it, has the QA tool create what is missing; a person approves each new spec; the QA tool may let it merge by itself once its checks pass; GAOS then runs it.

How it works: the data flow

Three systems take part: your CI (it deploys to staging), GAOS (it plans cards and asks), and the QA tool (it writes and runs the specs). GitHub merges; GAOS never does. Each flow below reads left to right; the numbered list says who calls whom.

A. A staging deploy runs the automation, and creates what is missing.

1 · CIcalls GAOS's staging callback
→
2 · GAOSplans the run card (+ creates)
→
3 · QA toolruns the cases of the kind
→
4 · GAOScard Done or Failed
  1. The pipeline calls POST /api/v1/products/{id}/staging with the repository and commit (HTTP Basic, one credential per product).
  2. GAOS plans one run card, labelled with the repository's kind. If staging creates is on and this is a new commit, it also plans up to two create cards for planned cases with no automation yet.
  3. GAOS's QA runner asks the QA tool for a job per card (POST /api/v1/gaos/automation with kind, only when the QA tool lists that capability) and polls it.
  4. A run ends the card Done (the results are on the QA side and in the catalog) or Failed with its reason.

B. A new spec: created, approved, merged, then run.

1 · QA toolwrites the spec, runs it on staging
→
2 · Personapproves it in the QA tool
→
3 · QA toolpushes, opens the PR, arms auto-merge
→
4 · GitHubmerges when the checks pass
→
5 · GAOSruns that case once
  1. The create card's job generates the spec and repairs it against staging. The card waits in Needs you.
  2. A person approves the spec. Only an approval given in the QA tool can lead to an auto-merge; an answer from the GAOS Inbox opens the pull request for a person to merge.
  3. The QA tool pushes the commit (GAOS records it as the approved commit) and opens the pull request. If GAOS still allows it (GET /api/v1/products/{id}/spec-auto-merge: the product's auto-merge switch on, the Working or Complete band) and every repository check passes, it turns on GitHub's auto-merge pinned to that commit.
  4. GitHub merges when the required checks pass. Otherwise a person merges.
  5. GAOS's pull-request poller sees the merge. If the merged head is the approved commit and the QA catalog shows the case implemented, GAOS plans one run of that case. Any other head is noted on the Pull requests page and not run.

C. A pull request is opened, reviewed, and a low finding fixed.

1 · GitHubPR opened (via Brain Town)
→
2 · GAOSreview card for Juno
→
3 · GAOSposts the review, labels severity
→
4 · Micaa low finding: draft fix PR
  1. Brain Town forwards pr.opened for a repository the product lists.
  2. GAOS plans a review card when a PR reviewer is assigned (see Assignment).
  3. The review is posted on GitHub; medium and worse request changes, and the card gets a severity:* label.
  4. A low finding on an allowed branch becomes a draft pull request into the reviewed pull request's own branch (Low findings fixed by an agent).

1. A kind per repository

KindA staging run runsThe QA tool may create
none (not set)every automated case, as todaynothing on staging
be — backend onlyAPI and GraphQL casesAPI specs (tests/api/rest/)
fullstack — frontend and backendevery casebrowser specs (tests/web/); API specs too when the product has no be repository

Open the Agents page, pick the product, and open E2E repository kinds (admins only, the same accounts as auto-fix). Choose a kind for each repository and save. The staging run card of a repository with a kind carries e2e-kind:be or e2e-kind:fullstack: shown and filterable like every label, never settable by hand. Route Planner's acme/route-api is be; acme/route-web is fullstack. Saving kinds never touches assignment.

2. On a staging deploy: create what is missing

Tick On a staging deploy, ask the QA tool to create missing automation in the same editor. It is off by default, because it lets the staging credential start generation jobs. Then:

  1. The devops pipeline calls the staging callback, as today. GAOS plans the run of the repository's kind.
  2. On a new commit only, GAOS reads the product's QA catalog for planned cases with no automation at the kind's levels, and plans a create card for each: at most 2 per deploy (GAOS_E2E_CREATE_MAX) and 4 open per product (GAOS_E2E_CREATE_OPEN). The answer carries creates.
  3. A case is never created twice. Each of these blocks it: an open card creating it; its spec pull request open (30 days); merged but not yet implemented in the catalog (14 days); closed, or its create card failed (7 days).
  4. The QA tool writes the spec and waits for a person to approve it in the QA tool. The card ends Done when the spec pull request is open, and its reason says how it will merge.

3. The approved spec merges by itself, then runs

Tick Let the QA tool auto-merge a spec a person approved (off by default; it applies only in the Working or Complete readiness band). After a person approves a spec in the QA tool (an answer given in the GAOS Inbox leaves the pull request for a person), the QA tool asks GAOS (GET /api/v1/products/{id}/spec-auto-merge, QA token) and, when allowed, turns on GitHub's auto-merge pinned to the exact commit that was approved. It does so only when the automation repository has a ruleset that lets only the QA tool's account push qa-auto/* branches and a required check from a fixed source; otherwise it leaves the pull request for a person. GAOS never merges and holds no merge token.

When the spec pull request merges, GAOS plans one run of that case if the merged head is the approved commit, a qa agent is assigned, and the QA catalog shows the case implemented. If the catalog has not caught up yet, the row on the Pull requests page says waiting for the catalog and the run is planned when the result arrives (within 14 days). A merge at another commit is noted on the row and in the activity feed, and its case is not run.

What GitHub must allow first

The QA tool turns auto-merge on only after it has read, through GitHub's API, a ruleset that restricts updates and deletions of qa-auto/* branches and required checks bound to their source on the base branch. On a private repository GitHub offers rulesets only on a paid plan (Team, or Pro for a personal account); on the free plan the API answers "Upgrade to GitHub Pro or make this repository public" and every spec is left for a person to merge. The QA tool's GitHub account must also be a bot account without admin or maintain rights on the automation repository: an admin could bypass the rules, so the QA tool refuses one. Until both hold, keep the auto-merge switch off: GAOS still runs each new case once a person merges its spec.

Spec auto-merge is off by default everywhere. The GAOS switch is off for every product until an admin ticks it, and the QA tool’s QA_SPEC_AUTO_MERGE is unset, which is off. Keep both off for a private automation repository on GitHub’s free plan: without rulesets nothing can be merged safely, so every spec waits for a person.

4. Unit tests: read from the repository’s own CI result

Built in v0.67.0 (D-105, BR-65; design docs/designs/release-b4-unit-tests.md). GAOS runs no test. The repository owner adds one GitHub Actions workflow (the template is below); GitHub runs it on every merge commit in a disposable VM, and GAOS reads the result of that one workflow. A failure becomes a defect that waits for an auto-fix admin before any agent works on it. The feature is off for every product until an auto-fix admin turns it on. Writing missing tests is a later design (docs/designs/release-b4b-unit-create.md).

Two result sources (v0.68.0, D-106). Each product chooses where its result comes from: GitHub Actions (the default: GAOS reads the workflow’s check, the flow below) or Jenkins (the organisation’s Jenkins runs the tests on its own agents and posts the result to GAOS, below). Either way GAOS executes nothing, the defect, the hold, the close on a pass and the notices are the same, and a merge with no result is never a pass. Under either source, tests that need a database or the network must skip under -short before the switch is turned on.

1 · MergeBrain Town forwards it
→
2 · GitHubruns the unit-tests workflow
→
3 · GAOSreads that run’s check
→
4 · GAOSa failure: defect, held
→
5 · Adminreleases it; triage and fix
  1. Turn it on. On the Auto-fix page, open Unit tests (CI) for <product> (auto-fix admins only; POST /products/{id}/autofix/unit), read its Before you switch this on checklist, and choose where results come from. It needs auto-fix on, a fixer and a triager assigned, a fix-target repository, GitHub and the Brain Town reader (and, for Jenkins, the product’s unit-results credential). You can name another workflow file or check name, extra bases beside the auto-fix base branch (or the default branch), and a daily cap of new unit defects (default 5). First merge the workflow and make sure its run on the base is green.
  2. A merge plants a watch. A pull request of a fix-target repository merged into a unit base gives GAOS its merge commit. For that repository the old agent unit-test card is no longer planned; other repositories and products keep it, as Pull-request agents describes.
  3. GAOS reads the check. Every 2 minutes, at most 10 merges at a time: the push run of the workflow on that commit and base, and the check run named unit-tests of that run’s own check suite from the github-actions app. A check posted by anything else, and every commit status, is ignored. A failure counts only when the run carries the workflow’s unit-tests-total notice, so a job that never started (a billing or spending limit) files nothing.
  4. A failure files a held defect. One open unit defect per repository and base (plus one for a failed build), naming at most ten failing tests; a new failing set updates it. Its triage card is born Blocked; only an auto-fix admin can release or cancel it (the cancel closes the defect), and nobody else can close it. The group gets one line.
  5. After release the usual auto-fix path runs: triage, then a draft fix pull request against the branch whose tests failed. The fix may not change the failing tests’ files, add tests beside them or add TestMain or init, and it is never retargeted.
  6. A later green check closes it, or, while its card is still held, marks it (“checks passed at …”) so the admin can close it by cancelling the card.
The checkWhat GAOS does
successcloses the open unit defects of that base (marks a held one)
failure, with the total noticefiles or updates the unit defect (a build defect when no test was named)
failure, every test name withheldfiles nothing; one line to the group
failure without the total noticeinconclusive: the workflow did not report (job not started?); a line at most once a day
no run 6 hours after the mergeno-ci: is the workflow installed? A line at most once a day
cancelled, skipped, timed out, unread, anything elseinconclusive: nothing is filed or closed; never read as a pass

The workflow the repository owner adds

Merge it through an ordinary reviewed pull request as .github/workflows/unit-tests.yml; GAOS never writes workflow files. Set the repository’s default workflow permissions to read-only and let no other workflow grant checks: write. Verify each pinned action SHA before merging (gh api repos/actions/checkout/commits/<sha> --jq .sha, and the tag’s ref points to it). The go test step holds no secret; a private-module token is used only by go mod download. Tests that need a database or the network are skipped with -short.

yaml
name: unit-tests
on:
  push:
    branches: [develop, staging, main]
  pull_request:
permissions:
  contents: read
jobs:
  unit-tests:
    name: unit-tests
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
        with:
          go-version-file: go.mod
      - name: modules
        env:
          MODULES_TOKEN: ${{ secrets.MODULES_TOKEN }} # only if private modules are needed
        run: |
          if [ -n "$MODULES_TOKEN" ]; then
            git config --global url."https://x-access-token:${MODULES_TOKEN}@github.com/".insteadOf "https://github.com/"
          fi
          go mod download
          git config --global --unset-all url."https://x-access-token:${MODULES_TOKEN}@github.com/".insteadOf || true
      - name: go test
        shell: bash
        run: |
          set +e +o pipefail
          go test -short -json ./... > test.json
          status=$?
          mod=$(go list -m)
          # leaf tests only: a parent fails when a subtest fails; keep the deepest names
          fails=$(jq -r 'select(.Action=="fail" and .Test!=null) | "\(.Package) \(.Test)"' test.json | sort -u |
            awk '{a[NR]=$0} END {for(i=1;i<=NR;i++){leaf=1; for(j=1;j<=NR;j++) if(j!=i && index(a[j], a[i]"/")==1) leaf=0; if(leaf) print a[i]}}')
          n=$(printf '%s\n' "$fails" | grep -c . || true)
          printf '%s\n' "$fails" | head -n 10 | while read -r pkg test; do
            [ -z "$test" ] && continue
            dir=${pkg#"$mod"}; dir=${dir#/}; [ -z "$dir" ] && dir=.
            file=$(grep -l "func ${test%%/*}(" "$dir"/*_test.go 2>/dev/null | head -n 1 || true)
            file=${file#./}
            echo "::error file=${file},title=${test}::${pkg} ${test} failed"
          done
          echo "::notice title=unit-tests-total::${n}"
          exit $status

Jenkins posts the result

With Results come from: Jenkins, GAOS reads no GitHub check. The organisation’s Jenkins builds each merge commit of a unit base, runs go test -short on its own agents and posts one result per build. The result finishes that merge’s watch exactly as a GitHub check would: a failure files or updates the held defect, a pass closes it (or marks a held one), and a merge with no result 6 hours after it was merged ends no-ci with a line to the group at most once a day (“no unit-test result from Jenkins on a merge; is the Jenkins stage installed?”). The events a posted result causes are attributed to jenkins:<product>.

1 · MergeBrain Town forwards it
→
2 · Jenkinstests the merge commit
→
3 · Jenkinsposts the result to GAOS
→
4 · GAOSa failure: defect, held
→
5 · Adminreleases it; triage and fix

The route and the credential. POST /api/v1/products/{id}/unit-results, HTTP Basic with the product’s unit-results credential: a line productId:user:password in the file named by GAOS_UNIT_RESULTS_BASIC_AUTH_FILE (mode 0600, a password of at least 32 characters, made with openssl rand -base64 32). It is checked by the staging callback’s gate but is never the staging credential: neither opens the other route. A credential of another product answers 404; five failures from one address in 5 minutes lock that address out of this route for 5 minutes. An empty file leaves the route off (503 jenkins-off). GAOS_JENKINS_ORIGIN (optional, e.g. https://jenkins.acme.example) is the only origin whose build links the Auto-fix page shows as links.

The body is strict JSON, at most 64 KiB, no unknown field:

json
{"repo":"acme/route-api","commit":"0123456789abcdef0123456789abcdef01234567","branch":"develop",
 "result":"failed","total":2,
 "failing":[{"test":"TestPlanRoute/empty_stops","file":"planner/route_test.go"},
            {"test":"TestDistance","file":"geo/distance_test.go"}],
 "summary":"","runUrl":"https://jenkins.acme.example/job/route-api/job/develop/42/"}
FieldRule
repoowner/repo, a fix-target repository of the product
committhe merge commit, 40 hex
branchthe branch Jenkins built; it must be the merge’s base
resultpassed, failed (at least one test named) or build-failed (no test named; summary says why)
total, failingthe failing leaf tests: the count (0 to 100000) and up to 50 named, {"test","file"}; GAOS keeps the first 10 it accepts, and drops a name that is not a Go test, a path that is unsafe, or anything over 512 bytes
summarybuild-failed only; cut to 2 KiB
runUrloptional; an https build link, otherwise stored empty (never refused)
GAOS answersMeaning, and what the stage does
202 {"accepted":true,"outcome":…}the merge’s watch ended with that outcome; done
200 {"duplicate":true}the same result was already recorded (a replayed build); done
409 no-watch, Retry-After: 60GAOS has not seen this merge yet; retry once a minute for 10 minutes
409 already-finisheda different result was recorded first; it stands, and the group is told once
409 branch-mismatch, unit-checks-off, not-jenkinsanother branch, unit checks off, or the product reads GitHub Actions; not retried
422 rejected, not-targetthe body is wrong, or the repository is not a fix target; not retried
401, 404 not-foundno or a wrong credential, or another product’s; never retried (each counts toward the lock)
429 throttled, 502, 503, no answerretry once a minute for 10 minutes

A result that arrives within 24 hours after its merge ended no-ci (a long Jenkins queue) is still accepted. Verified on: none yet — the two templates below are checked by reading; the first real run is the check: merge a pull request with a deliberately failing test, see one held card and one group line, then revert it. On that first run, also check that the watch’s commit is the pull request’s merge commit, that the caller’s address GAOS recorded is Jenkins’ public address, that a branch build cannot bind the credential, that a Jenkins account that is not an administrator sees neither Configure nor Replay nor Build on the report job, nor the credential on its folder, and that the report job runs with the Groovy sandbox off and no per-signature approval was added.

The work is split in two, because in a multibranch pipeline every branch builds its own Jenkinsfile and whoever pushes a branch controls it:

Conditions the owner must meet (GAOS cannot check them)

The credential is bound only by the report job (folder-scoped), or, if there is no separate job, is branch-restricted to the unit bases — otherwise anyone who can push a branch the pipeline builds can read it. Run and Replay on the unit-base jobs are restricted to the people trusted to post results. Configure, Replay and Build on the report job, and every credential permission on its folder, are held only by Jenkins administrators. A holder of the credential can post any result for a pending merge of its product; the hold and the admin release bound what a forged failure can do.

groovy
// Jenkinsfile (multibranch) — Route Planner (p-9), repository acme/route-api. Verified on: none yet.
// The test stage holds no credential. The image tag matches the `go` line of go.mod.
pipeline {
  agent none
  options { copyArtifactPermission('gaos-unit-report') }
  stages {
    // … the organisation's existing stages …
    stage('unit tests') {
      when { beforeAgent true; anyOf { branch 'develop'; branch 'staging'; branch 'main' } }
      agent { label 'docker' }                          // a node with Docker; both containers share its workspace
      steps {
        script {
          env.UNIT_COMMIT = env.GIT_COMMIT                  // Groovy, before any test runs (a cross-check only)
          def go = docker.image('golang:1.24-bookworm')      // matches the go line of go.mod
          def goEnv = "export HOME=$WORKSPACE/.home GOCACHE=$WORKSPACE/.cache/go-build GOMODCACHE=$WORKSPACE/.cache/go-mod;"
          // Modules, with network. Private modules only: bind the module token here, then remove the rewrite.
          go.inside { sh "${goEnv} go mod download" }
          // Tests, with no network and no fetch: test code reaches no service.
          go.inside('--network none') {
            sh("${goEnv} export GOPROXY=off GOFLAGS=-mod=readonly;" + '''
          set +e
          mkdir -p unit
          go test -short -json ./... > unit/test.json 2> unit/test.err
          echo $? > unit/status.txt
          mod=$(go list -m)
          # leaf tests only: a parent fails when a subtest fails; keep the deepest names
          sed -n 's/.*"Action":"fail","Package":"\\([^"]*\\)","Test":"\\([^"]*\\)".*/\\1 \\2/p' unit/test.json | sort -u |
            awk '{a[NR]=$0} END {for(i=1;i<=NR;i++){leaf=1; for(j=1;j<=NR;j++) if(j!=i && index(a[j], a[i]"/")==1) leaf=0; if(leaf) print a[i]}}' > unit/fails.txt
          grep -c . unit/fails.txt > unit/total.txt
          : > unit/failing.tsv
          head -n 50 unit/fails.txt | while read -r pkg test; do
            dir=${pkg#"$mod"}; dir=${dir#/}; [ -z "$dir" ] && dir=.
            case "$dir" in /*|*..*) continue;; esac
            file=$(grep -l "func ${test%%/*}(" "$dir"/*_test.go 2>/dev/null | head -n 1); file=${file#./}
            [ ${#test} -gt 512 ] || [ ${#file} -gt 512 ] && continue
            printf '%s\t%s\n' "$test" "$file" >> unit/failing.tsv
          done
          { cat unit/test.err; sed -n 's/.*"Action":"build-output".*"Output":"\\(.*\\)"}$/\\1/p' unit/test.json; } | head -c 1800 > unit/summary.txt
          exit 0
            ''')
          }
        }
        archiveArtifacts artifacts: 'unit/status.txt,unit/total.txt,unit/failing.tsv,unit/summary.txt',
                         followSymlinks: false            // a symlink left by test code archives nothing
      }
    }
  }
  post {
    always {                                             // after every stage: never gates deploy
      script {
        if (env.UNIT_COMMIT) {
          catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
            build job: 'gaos-unit-report', wait: false,
                  parameters: [string(name: 'COMMIT', value: env.UNIT_COMMIT)]
          }
        }
      }
    }
  }
}
groovy
// Job "gaos-unit-report" — a Pipeline job an administrator defines in Jenkins, in the folder that holds
// the credential "gaos-p-9" (the product's unit-results credential). Not in any repository. Verified on: none yet.
pipeline {
  agent none
  parameters { string(name: 'COMMIT', defaultValue: '') }
  options { timeout(time: 15, unit: 'MINUTES') }
  stages {
    stage('report to GAOS') {
      steps {
        script {
          def up = currentBuild.getBuildCauses('org.jenkinsci.plugins.workflow.support.steps.build.BuildUpstreamCause')
          if (up.size() != 1) { error('not triggered by a unit-base build') }
          def job = up[0].upstreamProject, num = up[0].upstreamBuild.toString()
          def branch = job.tokenize('/').last()
          // The full path, not any folder ending in route-api.
          if (!(job ==~ /^acme\/route-api\/(develop|staging|main)$/)) { error("not a unit-base job: ${job}") }
          // The commit the upstream build recorded, and no Replay. this job runs with the
          // Groovy sandbox OFF and an administrator approves the WHOLE script once. Never approve these calls
          // one signature at a time: that would open them to every pipeline on the instance.
          def run = Jenkins.get().getItemByFullName(job)?.getBuildByNumber(num as int)
          if (run == null) { error('upstream build not found') }
          if (run.getCause(org.jenkinsci.plugins.workflow.cps.replay.ReplayCause) != null) { error('a replayed build is not reported') }
          // Exact repository match: normalise scheme, user, host case and a trailing .git; exactly one BuildData.
          def norm = { String u -> u.replaceFirst(/^[a-z+]+:\/\//, '').replaceFirst(/^[^@\/]+@/, '').replaceFirst(/:/, '/').replaceFirst(/\.git$/, '').toLowerCase() }
          def want = 'github.com/acme/route-api'
          def hits = run.getActions(hudson.plugins.git.util.BuildData).findAll { d -> d.remoteUrls.any { u -> norm(u) == want } }
          if (hits.size() != 1) { error("expected exactly one checkout of ${want}, found ${hits.size()}") }
          def commit = hits[0].lastBuiltRevision?.sha1String
          if (!(commit ==~ /[0-9a-f]{40}/)) { error('no recorded commit') }
          if (params.COMMIT && params.COMMIT != commit) { error('the COMMIT parameter differs from the recorded commit') }
          def runUrl = "${env.JENKINS_URL}${up[0].upstreamUrl}${num}/"
          def answer = ''
          for (int i = 0; i < 10; i++) {
            node('gaos-report') {                       // label restricted to this job; has jq and curl
              deleteDir()
              catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
                copyArtifacts projectName: job, selector: specific(num), filter: 'unit/*'
                withEnv(["U_COMMIT=${commit}", "U_BRANCH=${branch}", "U_RUN=${runUrl}"]) {
                  sh '''#!/bin/bash
                    set -e
                    for f in unit/*; do                       # no symlink, nothing over 64 KiB
                      [ -L "$f" ] && { echo "refused: $f is a symlink"; exit 1; }
                      [ "$(stat -c %s "$f")" -le 65536 ] || { echo "refused: $f is over 64 KiB"; exit 1; }
                    done
                    status=$(cat unit/status.txt); n=$(cat unit/total.txt)
                    jq -R -s 'split("\\n") | map(select(length > 0) | split("\\t") | {test: .[0], file: (.[1] // "")})' \
                      unit/failing.tsv > failing.json
                    summary=''
                    if [ "$status" = 0 ]; then result=passed; n=0; echo '[]' > failing.json
                    elif [ "$(jq length failing.json)" -gt 0 ]; then result=failed
                    else result=build-failed; echo '[]' > failing.json; summary=$(cat unit/summary.txt)
                    fi
                    jq -n --arg repo acme/route-api --arg commit "$U_COMMIT" --arg branch "$U_BRANCH" \
                      --arg result "$result" --argjson total "$n" --slurpfile failing failing.json \
                      --arg summary "$summary" --arg runUrl "$U_RUN" \
                      '{repo: $repo, commit: $commit, branch: $branch, result: $result, total: $total,
                        failing: $failing[0], summary: $summary, runUrl: $runUrl}' > body.json
                  '''
                }
                withCredentials([usernamePassword(credentialsId: 'gaos-p-9',
                                                  usernameVariable: 'GAOS_USER', passwordVariable: 'GAOS_PASS')]) {
                  answer = sh(returnStdout: true, script: '''#!/bin/bash
                    cred=$(printf '%s:%s' "$GAOS_USER" "$GAOS_PASS" | sed 's/[\\\\"]/\\\\&/g')
                    code=$(printf 'user = "%s"\\n' "$cred" |
                      curl -sS -K - -o answer.json -w '%{http_code}' -H 'Content-Type: application/json' \
                        --data-binary @body.json 'https://gaos.acme.example/api/v1/products/p-9/unit-results' || true)
                    err=$(jq -r '.error // ""' answer.json 2>/dev/null || true)
                    echo "${code:-000} ${err}"
                  ''').trim()
                }
              }
            }
            def code = answer.tokenize(' ')[0] ?: '000'
            def err = answer.tokenize(' ').size() > 1 ? answer.tokenize(' ')[1] : ''
            def again = (code == '409' && err == 'no-watch') || code in ['429', '000', '502', '503']
            if (!again) { break }
            sleep(time: 60, unit: 'SECONDS')               // outside node: no executor is held
          }
          if (!(answer.startsWith('200') || answer.startsWith('202'))) { unstable("GAOS answered ${answer}") }
        }
      }
    }
  }
}

GAOS never writes the Jenkinsfile or the report job. Review of the merged pull request does not guard branch builds; the credential’s scope does.

A GitLab pipeline

With Results come from: GitLab pipeline (D-117), GAOS reads the job named as the check in the newest pipeline that ran the merge request’s last head commit, and on a failure the pipeline’s JUnit report. Every fix-target repository must be on GitLab. The details are on the GitLab page.

Tests that need a database or the network skip under -short

Both sources run go test -short. A unit base whose suite needs a live database, the network or another service is red on every clean merge, and every merge would file a defect. So before the switch is turned on, make each such test skip under -short:

go
func TestRouteStore(t *testing.T) {
    if testing.Short() {
        t.Skip("needs a database")
    }
    // …
}

A package whose TestMain opens the service checks testing.Short() after flag.Parse() and returns m.Run() without opening it. To find the tests to mark, run go test -short ./... once on a machine with no database and no network (for example in a container started with --network none after go mod download): every failure there is a test to mark or a real defect. A build tag (//go:build integration) is an equivalent way to keep such tests out; -short is the documented one because both templates pass it. The Auto-fix page shows the same rule in its Before you switch this on checklist.

Status

PartGAOSQA tool
1. Repository kindsBuilt (v0.65.0)Built: kind and GET /api/v1/gaos/capabilities
2. Create on stagingBuilt (v0.65.0)Nothing new needed
3. Auto-merge, then runBuilt (v0.65.0)Built, off until QA_SPEC_AUTO_MERGE=on; needs the automation repository's rulesets (a paid GitHub plan for a private repository) and a bot account
4. Unit tests (run)Built (v0.67.0; Jenkins source v0.68.0), off by defaultNothing: GitHub Actions runs the repository’s own workflow, or the organisation’s Jenkins posts the result
4b. Unit tests (write missing)Draft designNeeds a separate GitHub identity and an approval in the QA tool

When something is off

You seeWhy, and what to do
No review card for a new pull requestThe product is configured and Juno is not assigned. Assign Juno, or press Stop gating.
The staging callback answers 422 unassignedNo QA agent is assigned. Assign Ember or Flint.
A medium review was posted as a commentThe product is not configured, or the author is the review account, or a login could not be read (the reason says comment only).
A low review planned no fixRead the review card's reason; it names the missing condition.
A fix card is Blocked with review-…The table above says which check refused it; nothing was written to GitHub.