Verify agent changes in CI
Takeaway
Choose error for clear, tested requirements that agents should address before merging. Choose warn for advisory feedback that allows more discretion. Validate the verifier's behavior before relying on either level.
This guide creates a verifier for a repository invariant, connects it to tessl.json, and runs it against pull request changes. If you are deciding whether a verifier fits your standard, start with Verifiers overview.
Prefer to start from generated candidates? Generate and review them in the web UI, then use Add to repository to have your agent propose the definitions and scope. Adding them doesn't enable CI. Your agent's tessl.json change already holds a group for each verifier, so skip the error-ux example in steps 1 and 2: choose each new group's severity as step 2 explains, then calibrate it from step 3. See Generate and review verifiers in the web UI.
1. Write the verifier
Create verifiers/actionable-errors.json:
Keep relevant_when specific. It should name the observable trait that makes a target applicable, rather than a broad category such as "TypeScript file."
Use context to explain the problem the check prevents, why it matters, and any legitimate exceptions. This rationale helps agents distinguish a faulty check from a valid failure that needs a code fix.
Validate the file before running it:
2. Choose its scope and severity
Add a group to the verify block in tessl.json:
Severity belongs in tessl.json, not in the verifier file. Choose it according to the feedback you want:
errorfor requirements: use it for clear rules that you have tested against representative code and that produce reasonable, actionable feedback. A failing check puts the requirement in front of the agent. The example above treats recovery guidance as a requirement; validate it in step 3 before enabling CI.warnfor suggestions: use it for advisory feedback where judgment and legitimate exceptions are expected, such as suggestions about comment quality. Warnings provide lighter feedback without failing the check, but agents may miss them. A warning can remain advisory indefinitely; promotion toerroris a policy choice.
Both choices need concrete criteria and useful feedback. Validate compliant examples, intended violations, and relevant exceptions.
An agent can propose correcting a verifier in the same PR when it is wrong, overly broad, or no longer reflects the intended requirement, just as it can correct a faulty test. Before editing, read the verifier's instruction, context, and examples. Explain the counterexample that motivates the edit, and check that legitimate violations still fail while compliant examples pass. A valid failure normally calls for a code fix. Identify any change to the underlying requirement explicitly as a policy change; do not rewrite the rule or its rationale just to make CI pass.
By default, verifier edits apply only to files in the active diff, so correcting a rule does not require fixing every historical violation in the same PR. Consider a separate audit and remediation loop to bring unchanged files into compliance. Use tessl change verify --all --recursive --level error to audit error-level file- and paths-scoped rules across linked manifests; diff-scoped rules need representative changes. The CLI does not create this loop for you.
3. Inspect the matched files
Preview a full-repository run before spending judge calls:
Check that the output contains the files you intend to cover and excludes unrelated files. Adjust the group's include and exclude globs or the verifier's relevant_when if the scope is too broad or narrow.
Then judge a small sample:
This sends the selected source content to Tessl's LLM judge. Limit the verifier's scope to content your organization is authorized to send, and exclude credentials, personal data, and other sensitive material.
Review each result against the invariant. Refine the verifier until the same evidence produces consistent pass or fail decisions.
4. Run it on pull requests
Run verifiers on pull requests with the Tessl Reviewer GitHub App, or with a workflow you own. The App needs no workflow and no stored token.
With the Tessl Reviewer GitHub App
- Sign in to tessl.io, select your organization, and open Reviewer in the sidebar.
- Open the Verify PRs tab. If the App is not installed yet, select Connect GitHub and install it as described in Set up Tessl Code Review.
- Select Turn on next to the repository, switch on Turn on for this repository, and select Save settings.
Turning Verify PRs on and changing its settings takes an organization admin.
Verify PRs runs when a pull request opens or gets new commits, and when someone comments @tessl-verify. It checks the pull request against its base branch the same way as the workflow below run with --recursive, so it covers every linked manifest in the repository, and reports the result as a Tessl Verify GitHub Check. A finding from a warn verifier shows as a warning and the Check still passes. A finding from an error verifier fails the Check. If tessl.json declares no verifiers, the Check is skipped.
The repository's settings also set:
- Run on draft pull requests: when off, a draft gets a skipped Check until it is marked ready for review or someone comments
@tessl-verify. - Judge calls per run: the most judge calls one run makes. A run that needs more stops without judging, and its Check says it did not finish.
- Time limit, seconds: how long a run may spend judging.
The Verify PRs tab shows each repository's last result. When a repository has no verifiers yet, its settings offer Write verifiers with an agent: a prompt that has a coding agent propose verifiers for the repository and open a pull request.
In your own GitHub workflow
CI needs a Tessl API key in the TESSL_TOKEN environment variable. For key creation and storage guidance, see Authenticating in CI. A pull request can change its workflow, verifier, and manifest configuration, so its branch location does not establish trust. Use a pull_request workflow, not pull_request_target, and protect the credentialed job with a GitHub environment that requires approval from reviewers who are authorized to approve the configuration and source changes.
The following job and steps assume the workflow runs on pull_request, has checked out the repository, and installed Tessl with tesslio/setup-tessl@v2. The job skips an external head repository by comparing repository identities, so it still runs for same-repository pull requests when the repository itself is a fork. Create the tessl-verify environment in GitHub with required reviewers, store TESSL_TOKEN as an environment secret, and do not approve it until the pull request's workflow, verifier, and manifest changes have been reviewed:
--base "origin/$BASE_REF" compares against the pull request's actual target branch, which the fetch step records as a remote-tracking ref. By default, the command checks only the pull request's changed files, including when it edits a verifier JSON file or the verify configuration. Add --changed-verifiers-scope all when applying a changed rule should require compliance across its full configured scope. With the default diff, a pull request that changes only verifier files or tessl.json can have no targets; that does not validate the rule. Validate rule changes against representative unchanged files and known good and bad cases. If your repository needs ongoing full compliance, arrange a separate tessl change verify --all audit and cleanup process; the CLI does not set one up. --all skips diff-scoped verifiers, which need representative changes. --github emits annotations for findings. A warn finding is advisory, while an error finding makes the command exit non-zero.
--max-calls 200 is the gate's call budget. The command stops before judging if its planned scope exceeds that limit; narrow the group's scope or choose and document a larger limit before changing the workflow.
If you run the command from a monorepo root with linked child manifests, add --recursive to each invocation.
5. Review and maintain enforcement
Track false positives, missed applicable files, and unclear findings at either severity. Keep warn for useful suggestions. If the team decides an advisory rule is a requirement and its feedback is reliable enough to enforce, change its group or per-verifier level to error. A rule that is already a tested requirement can start at error.
At error, the Tessl Verify Check, or your own workflow's command, fails on pull requests with failing findings. You do not need to add --fail-on-warn. To stop those pull requests from merging, make the check required in the branch's protection rules.
Next
- Read the
verifyblock reference for group filters and per-verifier overrides. - Add Tessl Code Review when you also want general pull request review beyond named repository invariants.