Agents and AI
Repository fixers
Fixers regenerate files that are a pure function of other files: lockfiles, generated build
files, indexes. Declared in the repository, they run on every change version on the server and
locally with tjet fix, so nobody hand-merges a lockfile again.
Declaring fixers
.tjet-fixers.toml at the repository root (an AG-4 protected path: changing it needs the
protected-path approvals):
version = 1
[[fixer]]
name = "decisions-index" # 1..64 lowercase letters, digits, dashes
command = ["python3", "tools/decisions.py", "index"] # argv, run at the tree root, no shell
triggers = ["docs/decisions/D-*.md"] # a version touching one of these (or an output) runs it
outputs = ["docs/decisions/INDEX.md", "docs/decisions/TOPICS.md"] # the only paths it may write or delete
tool_paths = ["tools/decisions.py"] # its own code (informational: shown, protect it with stream policy)
mode = "auto-apply" # auto-apply | suggest | check-only
regenerate_on_conflict = true # rebase conflicts in its outputs are regenerated
timeout_seconds = 60 # 1..=1800, default 300
# env = { NAME = "value" } # not PATH, HOME, LD_*, TJET_*
# tools = ["cargo"] # runner-provided read-only tool directories
Patterns are anchored repository paths: * and ? within one segment, ** any number of
segments (at most two). Unknown keys, modes or a newer version are errors: the fixers check
then fails closed (FIXERS_INVALID). The configuration that decides is the one at the head of
the change's target stream, never the change's own copy.
On the server
A stream turns fixers on by naming fixers in its required checks and listing the runner's
service principal in trusted_executors (tjet stream policy ...). For every new version of a
change targeting it the runner runs the triggered fixers twice, sandboxed, and reports:
| Result | What happens |
|---|---|
| nothing changes | the version passes the fixers check |
auto-apply changes files | <org>/fixer-bot adds a new version of the change (timeline: fixer.applied); that version is checked again and must come out clean |
suggest changes files | shown on the change (tjet fixer status); advisory |
check-only changes files | the check fails: run tjet fix and save |
a path outside outputs | the result is refused, the check fails and the version's approvals are revoked (fixer.refused) |
Approvals of the version survive on the bot's version when (1) the bot's version differs from
the approved one only within the fixers' declared outputs, (2) the output is reproducible (a
second execution agreed, or the server's own action-cache entry for the same fixer and inputs
held it), and (3) the change does not edit .tjet-fixers.toml — whatever else the change
touches. Anything else resets them: the bot's version is then an ordinary service-written
version. The bot writes only paths the change's owner may write.
A rebase whose conflicts all lie in outputs of regenerate_on_conflict fixers succeeds: those
files take the target's content and the fixer regenerates them on the merged tree before the
change can land.
The bot has no rights of its own: give <org>/fixer-bot the developer role on repositories
where it should write (tjet fixer status shows its principal once a runner claimed a run).
Running fixers
tjet fix [--fixer NAME] [--check]runs the fixers on your working files (sandboxed; the.tjetdirectory and.tjetignored files are not part of the copy) and applies what they change within their outputs. On a clean workspace its result equals the bot's.tjet fixer run --repo R [--once] [--tool cargo=DIR] [--cache cargo=DIR]is the runner, run with a service principal's token.tjet presubmit run --fixers [--fixer-tool cargo=DIR] [--fixer-cache cargo=DIR] ...is one runner for both checks: before each presubmit claim it runs every waiting fixer job, so fixers run first and presubmit tests the fixed version. Whatever the runner layout, when a stream requires both checks the server leaves a change version's presubmit run queued until that version's fixer run has finished; a fixer version then gets its own presubmit run and the earlier one goes STALE without being built.tjet fixer status --repo R CHANGEshows the runs of a change.
The sandbox
Linux, bubblewrap (unprivileged user namespaces): every namespace unshared (no network), an
empty environment (PATH, HOME=/tmp, LANG=C.UTF-8, TZ=UTC, SOURCE_DATE_EPOCH=0,
TJET_FIXER, TJET_FIXER_SANDBOX=1 and the declared env), read-only /usr, /bin, /lib*,
a private /tmp, the copy of the version as /work (the only writable tree), runner tools and
package caches read-only under /opt/tjet. Symbolic links may not be created or changed;
results are at most 1000 files, 16 MiB per file, 64 MiB in total. Without a working sandbox the
runner refuses to run; tjet fix --unsandboxed exists for your own machine only (macOS,
Windows).