PR gate
CI should not run models. A daemon on a box you control does that. CI only asks TheSpider whether the campaign passed.
pull request → TheSpider creates an incremental campaign
daemon → clones the commit, runs models, posts results
CI job → thespider-agent gate --campaign <id>
0 pass · 1 fail · 2 pending · 4 degraded
Webhook
Self-service GitHub connection is not in Cloud yet. TheSpider has to enable the hosted integration for a project. Do not try to wire a webhook secret by hand.
Once enabled, an opened or updated pull request creates an incremental campaign from the changed paths (paths only, not file contents).
One profile per gate
The gate runs exactly one audit profile: the project's default. A webhook campaign carries no profile of its own.
- Switching the default away from Security removes security gating on every PR. TheSpider does not recommend it.
- A Hygiene default fails PRs on cruft.
- A Pipeline default fails PRs on pipeline findings.
Run Bugs, Hygiene and Pipeline as manual or scheduled campaigns alongside a Security gate instead. A new project whose first audit is Hygiene or Pipeline keeps Security as its default for this reason. The default is changed in the project's Settings (admin).
Run the daemon
On a team box or self-hosted runner:
thespider-agent daemon --workdir /var/lib/thespider --models xai/grok-4.6
Set the project's repo_remote_url to a URL that user can clone with ssh-agent or an HTTPS helper. Never put a token in the stored URL.
Flags and the clone loop: The agent.
Poll from CI
CI needs a project-scoped TheSpider token. There is no gate-only scope yet.
thespider-agent gate --campaign <id>
# 0 pass · 1 fail (new findings) · 2 pending · 4 degraded
The CLI does not retry. CI should retry exit 2 with a delay until its own timeout.
| Exit | Meaning | Typical CI action |
|---|---|---|
0 | No new findings on the PR | allow merge |
1 | New findings on this branch (and, for incrementals, in changed_paths) | block |
2 | Work still outstanding — pending, running, or a failed slice that can still be retried | wait and poll again |
4 | Finished with no new findings, but part of the change was never audited: at least one slice failed every attempt (failed_slices), was skipped because its model was disabled (skipped_slices), or the campaign was cancelled (reason: "campaign_cancelled") | block. Read the reason: for failed slices, fix the cause and run thespider-agent repair; for a disabled model, re-enable it and run again; for a cancelled campaign, do not repair (it is refused), replace it like for like by pushing again or redelivering the PR webhook (thespider-agent run creates a full audit instead) |
gate and thespider-agent wait use different exit codes. gate2 means "not done yet." wait uses 3 for timeout and never emits 2. Both use 4 for a degraded run. gate1 is any new finding; wait1 respects --fail-on (default critical,high). A triage of accepted or wont_fix quiets both. See Agent CLI contracts.2while it can still be retried. Once its attempts are spent (three by default, whether the model failed or the worker crashed) it stops being outstanding, and the gate settles on 4degraded instead of waiting forever. New findings still win: a degraded campaign with new findings is 1. So 0 means "no new findings and every slice was audited". Slices skipped by models disable are not retried and not outstanding either, so they let the campaign finish, but they count the same way: a finished campaign with skipped slices is degraded. A CI script that only treats pass as success blocks on degraded; that is intended.A cancelled campaign
A member can cancel a campaign that is still new or running. The gate then answers at once, never pass and never pending:
degraded(exit4), withreason: "campaign_cancelled"in the response, pluscancelled_slices,cancelled_at,cancel_reasonandcancelled_by_label.thespider-agent gateprints the reason, who cancelled and why. The exit mapping does not change: a CI script that already blocks on4needs no update.fail(exit1) when a finding that is new on this branch came from a slice that finished before the cancel. A new finding outranks the cancellation, the same way it outranks other degradation, and thereasonkey stays on the response.
skipped_slices includes the cancelled slices (it counts every slice that will never be audited), so a client that predates the reason key still reads a cancelled campaign as degraded. A repair cannot fix it: repair on a cancelled campaign is refused with 409 campaign_cancelled. To re-audit the pull request like for like, push to it again or redeliver the webhook at the same head commit: either creates a new incremental campaign, billed as new work. thespider-agent run --profile <profile> at that commit also creates a new campaign, but a full one: it audits the whole repository, bills more slices, and its gate does not filter findings by the PR's changed paths. Cancelled campaigns are never used as a gate baseline or as the previous campaign for a comparison.
Hardening notes still fail the gate
A finding marked as a hardening note (evidence basis speculative: no concrete exploit or
failure path was shown, see Triage)
still makes the gate fail when it is new on the PR. The label could be wrong, and a real problem
rated as a hardening note must not slip through CI. The gate response carries evidence_basis on
every new finding, and thespider-agent gate marks those rows [hardening note], so the job log shows
which failures are hardening advice. To let the PR through, decide them: triage accepted (follow up
later) or wont_fix, and the gate stops counting them. wait --fail-on treats them the same way.
High is stored as high, and a finding takes the highest
severity of its reports). gate fails on any new finding whatever its severity, so this changes
nothing for gate, but wait --fail-on critical,high can start matching findings it used to miss.
See the upgrade note in Triage.