Merge changes
Configuration
Two files configure bay: .bay/config.toml for the repository and .bay/policy.toml for the checks.
Two files on main configure bay. .bay/config.toml names the plugins, the runner timings, retention, promotion targets and lanes. .bay/policy.toml lists the checks a change must pass before it merges. bay reads both only from main, so a change never sets its own rules.
.bay/config.toml
bay reads it only from main: the committed copy at <remote>/<main>. A work tree's copy and a change's own commits never set the rules that change runs under. bay finds main first, from bay.main and bay.remote in local Git config, else the remote's default branch. Without main, or without this file at main, bay refuses with CONFIG_MISSING. A machine's own settings, such as updates, runner limits and bay.claudeConfigDirs, live in its global Git config. A key that a newer bay brought is unknown to an older one, so run bay update on that machine.
# .bay/config.toml, read from main
main = "main" # optional; must match main: the remote's default branch
remote = "origin" # optional; must match the clone's remote, origin by default
[origin] # optional: a bay origin near your machines
url = "ssh://git.internal/srv/git/app.git"
[trailers] # map Intent and Actor to your own trailer keys
intent = "Intent"
actor = "Actor"
[plugin.notify]
command = "scripts/bay-notify" # the notify plugin
[plugin.wake]
command = "scripts/bay-wake" # the wake plugin: an accepted talk, or an outcome to act on
[plugin.runtime]
command = "scripts/bay-runtime" # optional: running and effective records for bay status
[plugin.assets]
command = "scripts/bay-assets" # optional: your own large-file store; without it, the remote's own
over_limit = "offload" # "refuse", the default, refuses them with CHANGE_TOO_LARGE
[policy]
profile = "default" # the [profile.<name>] that bay status judges completion by
evidence_reuse = "exact-inputs" # optional: reuse a pass on matching inputs; a throughput key turns it on
[hooks]
cache_max_age_s = 30 # older coordination cache: COVERAGE_UNKNOWN
checkpoint_idle_s = 600 # a draft checkpoint after this much idle time
[view]
warm_history = false # true: bay start also fetches the declared paths' history
refresh_on_conflict = false # true: the idle wait refreshes a view after MERGE_CONFLICT
[red]
window = 50 # main's commits a red judgement reads, 1 to 10000
# undo_after_s = 1800 # optional: a runner undoes a red's culprit this long after its owner was told
# [expedite] # optional: bay merge --expedite runs a change next
# per_day = 2 # 1 to 100 a UTC day, one at a time
[agent]
product = "claude" # or "codex"; leave this table out with no agent hooks
instructions = ["AGENTS.md", "CLAUDE.md"] # compared with main at SessionStart
[runner]
# command = "scripts/bay-runner" # optional: an external runner; it must exist, or bay merge fails
submission_timeout_s = 120
execution_budget_s = 1800 # no default; the queue deadline assumes 30 minutes
lease_s = 60 # an owner silent this long may be replaced
heartbeat_s = 10
takeover_s = 120 # default: twice the lease
publish_window_s = 60
bisect_post = false # true: find the commit that turned a post check red
ahead = 0 # throughput; turns evidence reuse on
footprint_lanes = false # throughput; turns evidence reuse on
parallel_checks = 1 # 1 to 16 of a candidate's checks at once; 1 by default
# author = "Deploy Bot <deploy@example.com>" # optional: the author of bay's commits on main; bay stays the committer
[retention]
window_s = 604800 # one week
ref_budget = 0 # 0: none; else the most bay refs the remote keeps
[plugin.prune]
command = "scripts/bay-on-prune" # optional: runs after each branch bay prune deletes
timeout_s = 30 # 1 to 600 seconds; 30 by default
[[target]] # optional: a promotion target
name = "staging"
ref = "refs/heads/staging" # default: refs/heads/<name>
from = "main" # main, or another target's name
requires = ["e2e"] # checks that must pass on the promoted commit
soak_s = 3600 # the commit's least age before promotion
advance = false # true: the runner moves it to its newest promotable commit
[[hold]] # optional: hold main, or one target, until end
target = "staging" # optional: with no target, the hold is on main
end = "2026-12-24T00:00:00Z" # RFC 3339 UTC, to the second
reason = "release week"
[[lane]] # optional: sandbox refs whose changes never merge
name = "research"
refs = ["refs/heads/research/*"]
window_s = 86400 # shorter than [retention] window_s| Key | Meaning |
|---|---|
main | Optional. The branch bay serves, any name, such as main or dev. It must match this clone's main: the remote's default branch, unless bay install --main named another. When they differ and this clone takes main from the remote's default, bay asks the remote again. It follows the default if it moved. Otherwise it refuses, and says to make that branch the remote's default or run bay install --main <name>. |
remote | Optional. It must match the remote this clone uses: origin, unless bay install --remote named another. |
[origin] url | Optional. The URL of an origin that bay host --upstream made. bay sends its refs, its notes and main there, and other refs keep their remote. Update every machine first: an older bay refuses the key, and each command that reads the config fails. Serve your machines from an origin explains it. |
[trailers] intent, actor, requester | Your own trailer keys for Intent, Actor and Requested-by. The other bay trailers have fixed names. Update every machine before you set requester: an older bay refuses the key, and each command that reads the config fails. |
[plugin.notify] command | The notify plugin. It gets one event and exits 0 when it delivered it. |
[plugin.wake] command | The wake plugin. bay asks it once when this machine accepts a talk, and records its answer on the ack. A runner also asks it once for an outcome the change's author must act on. |
[plugin.hold] command | Optional. The hold plugin: bay runs its program from main's tip as <command> status, and it answers {"held": true|false, "reason": "..."}. While it answers held, or gives no answer bay can read, main is held. |
[plugin.hold] timeout_s | How long the hold plugin may take, from 1 to 120 seconds. The default is 10. |
[plugin.prune] command | Optional. The prune plugin: after bay prune deletes a branch, bay runs its program from main's tip as <command> pruned <branch> <sha> <archive ref>. Its outcome never undoes the delete. An empty value is refused. |
[plugin.prune] timeout_s | How long the prune plugin may take for one branch, from 1 to 600 seconds. The default is 30. |
[plugin.assets] command | Optional. Your own assets plugin. Without it, bay keeps large files in the remote's own store. Keep large files out of Git explains both. |
[plugin.assets] over_limit | offload sends each new file over [limits] max_file_mib to the large-file store. refuse, the default, refuses it with CHANGE_TOO_LARGE. |
[plugin.assets] timeout_s | How long one call of the assets plugin may take, in seconds, at least 1. The default is 300. |
[plugin.notify], [plugin.wake], [plugin.runtime] timeout_s | How long one call of that plugin may take, in seconds, at least 1. The defaults are 5, 5 and 10. |
[policy] profile | The [profile.<name>] of the policy that bay status judges completion by. The default, default, requires merged and checked. A name with no such table makes the verdict unknown. |
[policy] evidence_reuse | Optional. exact-inputs reuses a pass only when every input matches, and off turns reuse off. Left out, reuse is on only when a throughput key of [runner] is set. It needs a key registry that signs everything, or [policy] reuse_unsigned = true in .bay/policy.toml. |
[hooks] notice_budget_bytes | The notice bytes one session gets per hour. The default is 2048. |
[hooks] cache_max_age_s | The oldest coordination cache the hook accepts, in seconds. The default is 30. With an older cache, a write to a declared input gets COVERAGE_UNKNOWN. |
[hooks] checkpoint_idle_s | How long after its last checkpoint a session's next hook event saves a draft checkpoint. The default is 600. A killed session loses at most this much work. |
[view] warm_history | true makes bay start fetch the history of the declared paths, also when it picks up a change. Off by default. It needs Git 2.54 or newer. |
[view] refresh_on_conflict | true makes the idle wait run bay start <change> after a MERGE_CONFLICT refusal, so the view moves onto main with the conflict markers. Off by default. bay before 0.7.78 refuses this key: update every machine that runs bay on the repository first. |
[red] window | How many first-parent main commits the red and unattributed judgements read. The default is 50, at most 10,000. A post check that no commit in the window answers is red_pending, never green, so set it as deep as your post checks lag. A bay merge that a merge outside bay put off that line counts at that merge. |
[red] undo_after_s | Optional, and off when absent. A runner undoes a red's culprit on its own this many seconds after bay told the culprit's session. The value is 0 to 2,592,000 seconds (30 days). Undo a merge names when the runner does it. |
[red] reach | How far back a red post check with no pass in its window reads main for its newest pass. The default is 250 main commits, or the window when that is larger. A reach below the window, or above 10,000, is invalid. With no pass found, suspect.last_passed is null, and suspect.searched says how many commits bay read. |
[expedite] per_day | Optional, and off when absent. How many bay merge --expedite asks the line grants in one UTC day, whoever asks: 1 to 100. Only one expedite waits at a time, and it runs alone. |
[status] serve_stale_s | The age, in seconds, of a sweep that bay status answers from at once, while one shared sweep refreshes the store. The default is 60. 0 makes each read past the sweep window wait for its own sweep. |
[agent] product | The agent product whose hooks bay installs: claude or codex. Codex's hooks only sense, so main stays the guard. Leave the table out to use no agent hooks. Any other value installs no hooks, and bay doctor shows its hooks row off. |
[agent] instructions | The instruction files bay compares with main at SessionStart. The default is AGENTS.md and CLAUDE.md. |
[runner] command | An external runner that follows the runner contract. Leave it out to use bay runner run. The command must exist on every machine that runs bay merge. When it cannot start, or refuses, bay merge and bay merge --wait end failed, and nothing merges that request later. |
[runner] submission_timeout_s | How long the runner's submit may take before the submission ends as timed out. The default is 30. |
[runner] execution_budget_s | The time budget for the checks before merging. It has no default. Without it, only each check's timeout_s applies. The queue deadline assumes 30 minutes. |
[runner] lease_s | An owner whose chain does not move for this long may be replaced. The default is 60. |
[runner] heartbeat_s | How often an owner renews its lease. The default is 10. |
[runner] takeover_s | How long a change stays idle before another agent may adopt it. A lock that no step renews for this long goes to the next edit. The default is twice the lease. It must be longer than lease_s. |
[runner] publish_window_s | Time added to the execution budget for the head of the queue. The default is 60. A head past both loses its place. After three times, bay blocks its operation with QUEUE_DEADLINE_EXCEEDED. |
[runner] post | true makes the runner run each post check itself, once on main's newest commit with no record of it. Off by default. |
[runner] bisect_post | true makes a runner find the merge that turned a post check red, by bisecting its suspect range. Off by default. |
[runner] ahead | How many queued entries behind the head a runner checks early, on the base the entries ahead predict. The default is 0, off. At most 16. |
[runner] footprint_lanes | true checks a queued entry early on the current main when its paths are disjoint from every entry ahead of it. It also turns on carrying footprint = true records. Off by default. |
[runner] warm | true makes the runner run each check with footprint = "observed" once on main's newest commit, so a change runs only the checks whose reads it touches. Off by default. Like the other throughput keys, it turns evidence reuse on. |
[runner] batch | { min, max, max_failure_rate } checks the head and the entries behind it as one tree. Absent, it is off. The defaults are 1, 8 and 0.3. A batch always has two members or more, and at most 64. |
[runner] parallel_checks | How many of a candidate's checks one runner runs at once, each in its own directory. The default is 1, one after another, and at most 16. It needs no evidence reuse. |
[runner] author | Optional. "Name <email>", the author of the commits bay makes on main. Set it when your host takes a commit only from an author it knows. bay stays the committer, and a draft a person wrote keeps its own author. bay refuses any other shape. Update every machine first: an older bay refuses the key. |
[runner] sandbox | Not allowed: a repository can never turn off the check sandbox. Only a machine can, with git config --global bay.runnerSandbox none. |
[retention] window_s | How long a closed change keeps its drafts before the retention cut, and its clean view before bay start releases it. Session records untouched that long go too. The default is one week. |
[retention] ref_budget | The most bay refs the remote keeps. Past it, a runner cuts the oldest ended changes, even inside the window, and moves their refs into shard indexes. The default is 0: no budget, so the retention window alone cuts. |
[plugin.runtime] command | Optional. The runtime plugin. bay status asks it for running and effective records about a merged commit. Only producer-signed records count, so it needs a key registry. |
[[target]] | Optional. A promotion target, such as staging: name, ref (default refs/heads/<name>), from (main or another target), requires (check ids) and soak_s. bay never merges onto it. bay status names its newest promotable commit. Each name and ref appears once, and neither is main's. The ref sits under refs/, outside refs/bay/ and refs/notes/bay/. A from chain must reach main. |
[[target]] advance | true makes each pass of bay runner run move the target to its newest promotable commit. Off by default. It needs requires. |
[[hold]] | Optional. Holds main until end, an RFC 3339 UTC time to the second, with a reason that is not empty. With a start before end, it holds only from then, so a window can be booked ahead. Until then only a change that carries Fixes: or Reverts: merges, and others wait with MAIN_HELD. |
[[hold]] target | Optional. Holds that promotion target instead of main. Until end, only a merge that carries Fixes: or Reverts: is promotable to it. |
[[lane]] | Optional. A sandbox lane: a name of 1 to 64 characters of a-z, 0-9 and -, used once. refs lists at least one full ref pattern under refs/, outside refs/bay/, each with at most one *. No pattern may match main. A change opened with bay start --lane <name> runs its checks and never merges. |
[[lane]] window_s | How long an ended lane change keeps its view. The default is one day, or the retention window when that is shorter. It must be shorter than [retention] window_s. |
.bay/policy.toml
The acceptance policy lives on main at .bay/policy.toml. bay judges each candidate by the policy at its base. A change to the policy or a check's adapter paths also runs its own new paths, and both must pass. Without .bay/policy.toml at a change's base, the runner blocks its merge with POLICY_MISSING. To merge with no checks, set revision = 1 and unchecked = true in the policy. bay raises revision on every policy change, which merges as an ordinary checked change.
# .bay/policy.toml (on main)
revision = 5 # an integer; every policy change raises it
[[check]]
id = "tests"
environment = "linux-x86_64"
command = "scripts/bay-check tests"
when_paths = ["src/**", "tests/**", "pytest.ini", "scripts/bay-check", "scripts/bay-check.d/**"] # a change elsewhere skips it
adapter = ["scripts/bay-check", "scripts/bay-check.d/", "pytest.ini"]
inputs = [] # inputs beyond the tree; "commit" or "history" keys evidence by commit
expected_minimum = 400 # required, no default
timeout_s = 1800
path = ["/usr/local/bin", "/usr/bin", "/bin"] # absolute directories; the check's PATH
env = ["DATABASE_URL"] # the only variables passed from the runner
retry_on_failure = 1 # rerun a failure on the same tree, up to 5 times
allow_flaky = false # a failure then a pass is flaky: CHECK_FLAKY
[[check]]
id = "e2e"
environment = "linux-x86_64"
command = "scripts/bay-check e2e"
when_paths = ["src/**", "e2e/**", "scripts/bay-check", "scripts/bay-check.d/**"]
adapter = ["scripts/bay-check", "scripts/bay-check.d/"]
expected_minimum = 20
[[quarantine]] # optional: one check set aside for a stated time
id = "e2e" # a required check with expected_minimum above zero must remain
environment = "linux-x86_64"
reason = "red on main since change k3m7p2ra; fix in progress"
end = "2026-10-25" # a date or a Change-Id
owner = "platform-team" # optional: who answers for it
since = "2026-10-18" # optional: when it was set aside; bay status shows its age
[limits] # optional; each key a positive integer
max_file_mib = 10 # any one file the change adds or changes, in MiB
max_files = 200 # the files it touches
max_added_lines = 5000 # the lines it adds; a binary file adds none
max_waiting_approvals = 5 # changes that may wait for a yes at once| Key | Meaning |
|---|---|
revision | Required. A whole number, 0 or more. bay raises it above main's when a change edits the policy or a check's own files. |
[[check]] id | The check id. |
[[check]] environment | The environment the check runs in. One check can be required on several environments. |
[[check]] command | The command that runs the check. Its executable must be in adapter. |
[[check]] adapter | Every path that computes the verdict: the command, its harness, and the test tool's configuration. |
[[check]] inputs | Inputs beyond the tree: commit or history. Both key the evidence by commit, so a result for one commit never stands for another with the same tree. history also gives the check read-only access to the repository's history. Any other value makes the policy invalid. |
[[check]] fixtures | Optional. Content-addressed files the check reads, each <name>@sha256:<64 lowercase hex>, each name once. They enter the check's definition. bay passes them to the check and never reads the files. |
[[check]] expected_minimum | Required for a check bay runs, with no default. The least number of tests the check must collect. An approval check leaves it out. |
[[check]] path | Absolute directories that make the check's PATH. The default is /usr/bin and /bin. In the macOS sandbox, bay puts the developer tools' bin immediately ahead of any /usr/bin. A relative entry, or one with :, makes the policy invalid. |
[[check]] env | The only variables the check gets from the runner. Their names enter the digest, never their values. PATH, HOME, TMPDIR, LANG and BAY_ADAPTER_DIR are not allowed. |
[[quarantine]] | One check set aside, with id, environment, reason and end, a YYYY-MM-DD date or a change id. Its id and environment must match a [[check]], or the policy is invalid. |
[[quarantine]] owner | Optional. Who answers for the quarantine. bay status and bay doctor show it. An empty owner is invalid. |
[[quarantine]] since | Optional. The date (YYYY-MM-DD) the check was set aside. bay status counts the entry's age in days from it. A since in any other form makes the policy invalid. |
[[check]] timeout_s | The time limit of the check in seconds. The default is 1800. Queue wait does not count. |
unchecked | true merges changes with no check. It cannot sit beside a [[check]]. |
[talk] | Talk between agents: enabled = true turns it on, and the other keys narrow it. Talk to other agents explains each key. |
[[check]] paths | Optional. The only files and directories of the candidate the check sees. Without it, the check gets the whole tree. Each entry is relative, listed once, without !, . or ... |
[[check]] materialize | Optional. "changed" gives the check only the files the candidate changes against its base, plus its paths. Its record then counts only for the same tree and base tree, and the check still batches. Not with footprint = true, and not on an approval check. |
[[check]] materialize_timeout_s | Optional. The time limit for copying the candidate for the check, 600 by default. |
[[check]] network | Optional. true lets the check use the network. The default is false, and bay reads it at the base. Not with footprint = "observed". |
[[check]] first | Optional. true runs the check before every other check of a run, so a failure there ends the run before any slow check starts. |
[[check]] stage | pre, the default, is required before merging. post is answered after merging and never blocks it. A failed post check turns main red on its paths. |
[[check]] when_paths | Optional globs. The check is required only when the candidate's own diff touches a matching path. An empty list is invalid. A glob that starts with ! drops the paths it matches. The last glob that matches decides. Each glob is relative, without . or .., and listed once. |
[[check]] producers | Optional. Only records from these producers answer the check. An empty list is invalid. Each name appears once. |
[[check]] kind | check, the default, is a check bay runs. approval is answered by an enrolled approver's signed record, and never runs. An approval check needs when_paths and is never post. It sets no key for running a check: command, adapter, expected_minimum, env, inputs, fixtures, paths, network, retry_on_failure or allow_flaky. |
[[check]] carry | Optional, on an approval check only. Left out, an approval holds for later candidates of the same change while the files under when_paths stay the same. false asks for an approval on every candidate. bay reads it at the base, and it enters the check's definition digest only when set. A check bay runs that names it makes the policy invalid. Require a person's approval explains it. |
[[check]] footprint | Optional. "observed" makes bay record what each run reads, and reuse the record where those bytes are unchanged. true says the verdict reads only the check's paths, else its when_paths. A record then carries to a later candidate whose read set is byte-identical, with [runner] footprint_lanes on. true needs paths or when_paths. Either value is invalid with materialize = "changed". "observed" is also invalid with network = true: bay cannot see what a check reads over the network. |
[[check]] retry_on_failure | How many times bay reruns a product_failure on the same tree. The default is 0, at most 5. A failure then a pass is flaky. A post check may set it too. |
[[check]] allow_flaky | true lets a flaky check merge, named in coverage_gaps with every run. The default, false, refuses it with CHECK_FLAKY. Not on a post check. |
[[check]] baseline | Optional. "base" fails a change only on failing units that did not also fail on its base. Pre-existing failures merge named in coverage_gaps as baseline_failures. Not on a post or approval check. |
[[check]] waivable | Optional. true lets an enrolled approver waive the check on one candidate, with a signed reason. A waiver is never a pass: the merge names it in coverage_gaps with the real verdict. It needs a key registry. On an approval check it makes the policy invalid. bay reads it at the base, and it enters the check's definition digest only when set. Require a person's approval explains it. |
[[check]] logic_only | Optional, on an approval check only. true asks no yes for a covered path whose change touches only comments. A check bay runs that names it makes the policy invalid. bay reads it at the base, and it enters the check's definition digest only when set. bay before 0.7.79 cannot read the key. Require a person's approval explains it, and what an older bay does then. |
[[check]] reuse | Optional. "units" lets a run skip each group of units that passed on the base with the same key. It is the only value. On an approval check it makes the policy invalid. bay reads it at the base. bay before 0.7.79 cannot read the key. Write a check explains it, and what an older bay does then. |
[profile.<name>] require | The completion dimensions this profile requires: merged, checked, running, effective, or a [[dimension]] name. [policy] profile in the config picks one. |
[profile.<name>] require_signed | true counts only signed evidence. A dimension that rests only on unsigned records is then unknown. |
[[dimension]] name | A completion dimension of your own, such as reviewed. It cannot reuse a name bay defines, or appear twice. |
[[dimension]] kind | The evidence kind that meets it, such as review. |
[[dimension]] producers | The producers whose records count. List at least one. |
[agent] require_actor | true makes bay start refuse with ACTOR_UNNAMED while BAY_ACTOR is unset. |
[agent] require_actor_proof | true makes bay merge refuse with ACTOR_UNPROVEN while several actors share one OS account that can read a file agent key. Off by default. |
[agent] question_wait_s | How many seconds the question hook waits for a person's signed answer, from 0, the default, to 90. A larger value is POLICY_INVALID. Update the host and runners first: an older bay refuses the key. |
[agent] max_live_changes | The most live changes one actor may hold. At that many, bay start refuses with WIP_LIMIT. A lane change counts. No limit by default. |
[policy] signing | What a key registry signs. all, the default, signs every request, merge and record. approvals signs only approval and waiver records, and everything else runs unsigned. Any other value makes the policy invalid. [[access]] rules need all. This [policy] table takes one other key, reuse_unsigned, and is apart from the one in .bay/config.toml. Keys and the registry explains both modes. |
[policy] reuse_unsigned | true lets evidence reuse, early checks, footprint carry and batch run where evidence counts unsigned: without a registry, or with signing = "approvals". Off by default, and only true or false. Results still say trust: unsigned or approvals. bay reads it at the base, so a change never turns it on for its own merge. With a registry that signs everything, it changes nothing. |
[[access]] paths | Globs of the paths that only the rule's writers may change, read as when_paths reads them. The first glob must take paths, not start with !. Each glob appears once, and a glob is a relative path, without ., .. or empty parts. Let only named agents change a path explains it. |
[[access]] writers | The actor names that may change the rule's paths. List at least one, and each name once. An actor changes a covered path only when each rule that covers it names that actor. |
[assets] keep | Optional lines { paths = "<glob>", days = <n> }: how long the assets store may keep the bytes of files under each glob, from their save. The store purges. bay only checks the lines. Empty paths or 0 days make the policy invalid. |
[assets] hold | Optional paths whose stored bytes no store may purge, such as a legal hold. A file ever saved under one stays held. A store asks bay assets held <id> before it purges. |
[limits] | Optional caps on one change: max_file_mib, max_files and max_added_lines. Each is a positive integer. Over one, bay refuses CHANGE_TOO_LARGE. Cap the size of a change explains them. |
[limits] max_waiting_approvals | Optional. The most live changes that may wait for an approval at once, a positive integer. At that many, bay merge refuses WIP_LIMIT for a change that needs one more. Require a person's approval explains it. |
[[input]] name | A named input, <kind>:<name>, that a change declares with bay start --input. Each name appears once. |
[[input]] provider | The command that prints the input's version for a tree. Its executable must be in adapter. |
[[input]] adapter | Every path the provider's answer depends on. bay runs them from the base, like a check's. |
[[input]] path | Absolute directories that make the provider's PATH. Without it, the provider runs with no PATH. |
[[input]] phase | Optional: expand, migrate or contract. In expand or migrate, a new version never invalidates a change. Without it, every new version does. |
[[input]] timeout_s | The provider's time limit, from 1 to 300 seconds. The default is 30. |
Rules for checks
- Each pair of
idandenvironmentappears only once. - The executable of
commandmust be inside theadapterlist. - bay runs the
adapterpaths from the base. - A change to the policy or an
adapterpath also runs the new paths. - One check
idbelongs to one stage,preorpost, never both. - bay refuses an unknown key in any table with
POLICY_INVALID, naming the key, its table and its line.
What a check sees
Each check runs in a sandbox that binds only an allow-list of paths. It sees its candidate, its adapter paths and the system files a program needs to start. It never sees the machine's HOME, the rest of the repository's .git, another view or bay's key files. A program under HOME or /opt is not visible to the check, unless the machine names its directory. A check has no network unless its [[check]] entry sets network = true. bay reads that entry at the base, so a candidate cannot grant itself the network.
- bay copies the candidate for each check without packing the whole tree, so large repositories check quickly.
pathslimits a check to those files and directories of the candidate. An empty list is invalid.materialize_timeout_sbounds that copy, 600 seconds by default. Running over isinfra_failure, never a pass.
Let checks read a directory on the machine
Some checks read a directory outside their tree, such as a package store or a tool cache. Name each one on the machine that runs checks, with bay.checkReadPath in Git config. Each value is an absolute path, or starts with ~/ for the machine's HOME. The sandbox binds each one read-only, so a check reads it and never writes to it.
Set it globally or for one clone. A repository cannot set it. bay doctor lists the paths in its check-read-paths row, and marks a missing one degraded. On a machine that runs checks, a value that refuses every check makes the row red: CHECK_READ_PATH_REFUSED.
git config --global --add bay.checkReadPath '~/.cache/pnpm' # read-only in every check on this machineA check finds its programs through PATH, and the sandbox can hide a PATH directory. A program of the same name later on PATH then runs in its place. So a PATH directory that this machine has and the sandbox hides fails the check as infra_failure before it runs. The reason names the directory and the bay.checkReadPath line that lets checks read it. bay doctor names each link on a check's PATH to a file that the sandbox hides.
Check only the changed files
materialize = "changed" gives a check only the files its candidate changes against the base: the request's changed_paths. bay adds the check's own paths to them, such as a config file the check always reads. A file the change deleted is absent, and the adapter paths still come from the base. The request then says "materialized": "changed", so the check knows the tree is partial. What the check sees depends on the base, so its record counts only for the same tree and base tree. bay reads the setting at the base, and it enters the check's definition digest.
[[check]]
id = "lint"
environment = "linux-x86_64"
command = "scripts/bay-check lint"
adapter = ["scripts/bay-check"]
expected_minimum = 1
materialize = "changed" # only the changed files, plus paths
paths = [".lint.toml"] # always given to the checkRules for expected_minimum
- Each
[[check]]must setexpected_minimum. There is no default. - A check that collects fewer tests than
expected_minimumisunknown, neverpass. expected_minimum = 0lets a mapped check pass on an empty selection, as a reported coverage gap.- Unless the policy says
unchecked = true, at least one required check needsexpected_minimumabove zero. - Otherwise the policy is invalid, and bay judges changes by the last valid one on main.
Choose when a check is required
when_paths makes a check required only when the candidate's own diff touches a matching path. * matches within one path part, ** any number of parts, and a trailing / a whole directory. A change to the policy or an adapter path requires every check, whatever its when_paths. The merge result lists each skipped check under not_required, with the reason. producers names the producers whose records answer a check. A record from a producer the list leaves out does not count.
[[check]]
id = "web"
environment = "linux-x86_64"
command = "scripts/bay-check web"
adapter = ["scripts/bay-check"]
expected_minimum = 50
when_paths = ["web/", "package.json"] # required only when the diff touches these
producers = ["ci-1", "ci-2"] # only these producers' records countSee which checks hold a change
bay start states in detail.pre_merge whether a check will hold the change's merge. checks lists each pre-merge check a file under your declared paths can wake, with that path and an example file. at_once is true when no check waits, the change declares paths, and no other change goes first. A declared path that holds the policy or an adapter path also makes it false. The merge itself still judges the files the change holds.
A pre_merge row in bay doctor names each check every change waits for. It is advice, never red.
Say what done means
Merged is not always done. A change may also need to run in production and work there. bay status <change> reports four dimensions under completion: merged, checked, running and effective.
running needs a pass record that names the merged commit and the sha256: digest of an artifact built from it. effective needs a pass record on that commit for an artifact that a counted running record names. Only a record that a producer key signed counts for either, so both need a key registry that signs everything. A [profile.<name>] lists the dimensions a change needs, and [policy] profile in the config picks one.
# .bay/policy.toml
[profile.production]
require = ["merged", "checked", "running", "effective"]
# .bay/config.toml
[policy]
profile = "production"Ask a runtime plugin
Your deploy or monitoring tool knows what runs. [plugin.runtime] command lets bay status ask it. bay asks it only when you name one change, its profile needs running or effective, and a registry signs everything. bay sends change, commit and tree as JSON on stdin.
The plugin prints a JSON list of signed bay.evidence/1 records of kind running or effective. bay counts each record that a producer key signed about that commit, and lists the rest under completion.runtime.refused. bay status writes no evidence. A producer that wants a record kept writes it to its own notes ref.
# .bay/config.toml
[plugin.runtime]
command = "scripts/bay-runtime" # gets {"change", "commit", "tree"}; prints a list of records
timeout_s = 10 # 10 by defaultAdd a site dimension
A [[dimension]] table defines a completion dimension of your own, such as reviewed. bay status reports it, and a profile may require it. It never blocks a merge. Wire any reviewer to bay explains how bay judges it.
[[dimension]]
name = "reviewed"
kind = "review"
producers = ["review-bot"]
[profile.reviewed]
require = ["merged", "checked", "reviewed"]Name an input's provider
A change can depend on a named input, such as an API contract: bay start --input contract:api.orders. An [[input]] entry in the policy names the provider that reads that input's version. The provider runs in the check sandbox, and gets input and tree as JSON on stdin. It prints a version, and consumers: each a path and a kind of historical, generated or executable. When main needs a version the change has not read and checked, bay refuses its merge with INPUT_UNOBSERVED or INPUT_CHANGED. A provider that gives no version blocks the merge with COVERAGE_UNKNOWN.
[[input]]
name = "contract:api.orders"
provider = "scripts/contract-version api.orders"
adapter = ["scripts/contract-version"]
path = ["/usr/bin", "/bin"]
phase = "expand" # expand, migrate or contract
timeout_s = 30Run a check after merging
stage = "post" marks a check that runs after merging. It never blocks the merge it judges. The runner runs it with [runner] post, or a producer writes its record with bay evidence record. --check and --environment name the post check, as the policy names it. The merge result lists it under post_checks, and bay status shows it pending until its record arrives. One check id cannot be in both stages, so give the post check its own id.
bay evidence record --kind check --verdict pass --commit a1b2c3d --check smoke --environment linux-x86_64Let the runner run post checks
With [runner] post = true in .bay/config.toml, the runner runs post checks itself, after its queue's work. It runs each one once, on main's newest commit that has no record of it yet. So many merges cost one run of a slow, whole-tree check, and no outside producer is needed. Of the live runners that serve the check's environment, one runs it. Another takes over when that runner stops, or gives no answer within timeout_s after the tip merged. A red result names the newest commit, and [runner] bisect_post narrows it to the merge that broke it.
# .bay/config.toml on main
[runner]
post = true
bisect_post = trueWhat a red post run covers
On a new tip, bay asks a red post check what changed since the red's last pass. So a check that picks its tests by changed paths runs the failing tests again. Its request also names the units that failed last, in rerun. After a failing run that answered each such unit, bay asks the next run only what changed since that run. A run that found each asked unit gone, and ran none, does not narrow the range. Then bay asks the next run what changed since the last pass again.
When no worker answers
A post check no worker answers waits ten times what its try cost, from ten minutes to the hour. While it holds changes, it waits five minutes.
When a post check fails
A failed post check turns main red on its paths: its when_paths, or every path. A change on those paths never waits: it runs the red check before its merge, judged against main. It merges unless it adds a failure main lacks, and detail.red_checked names each check it ran. To judge it, bay uses a record of the check on main, or runs the check on main once. Before bay runs the check on main, it reads main's records again.
bay status lists each red check under detail.red, with its paths, merge, change, fixes, suspect and culprit. A post check that no commit in the window answers is in detail.red_pending, never green. Its state is pending, or pending_beyond_window when its last answer is older than the window. Neither state refuses a merge.
- Fix it: a
bay start --fixeschange naming the check, or a merge the red names, goes first. - After a fix: the check is
pending_fixuntil a run on the fix or later passes. - Undo it:
bay undoof a merge the red names, or a change that supersedes one, goes first too. - Undo it on its own: with
[red] undo_after_s, a runner undoes the culprit when no fix comes in time. - A later pass: a pass of the post check on a newer merge turns main green.
- Quarantine: a
[[quarantine]]entry for the check clears the red too.
A change that merges on a red check with a run that passed against its base leaves the check red. The next change on the check's paths runs the red's failed units again.
When bay names no culprit
- A rerun is due: until a failure's last rerun is due, the check reads as not yet answered.
- The same bytes: with a footprint, a pass and a first failure that read the same bytes name no culprit.
- The check changed: a merge that changed the check itself is never its culprit. Its post ran the old check.
- One record: with
bisect_post, a one-merge culprit on one record is checked again at that merge.
The owner is told
When a post check turns main red, bay tells the change that owns it, once. Of the live runners that serve the check's environment, one writes a red_owner event, to the change red[].fixes names. Its id comes from the check, its environment and the owner. A runner that has fetched that event writes nothing.
bay asks the wake plugin once to wake that change's session, with cause red. The session's hook tells it as one notice line: the check, its paths and the fix. A red that a fix already answers, or whose failure names no change, tells no one.
bay: change c7k2m4qa: main is red on smoke; your change broke it: the check passed on the merge before it and failed on it. Changes on its paths run it before they merge. Fix it with a new change: bay start <intent> --fixes c7k2m4qaWhen a merge changed the check
When the evidence names no merge as the cause, bay tells the merge that changed the check. Its line names the merge where the changed check first failed, in first_failure. bay also tells each merge on the check's paths after it, up to that failure, with since_change and among. When a run of the new check failed on the merge that changed it, bay tells only that merge.
When a fix waits for its run
A pending_fix check's fix is on main already, and only its run decides. Until that run, a change on its paths runs the check before its merge, as for a red check. A repair, a change that answers another red check, does not run it. A repair still runs any other check that is red on its paths.
Which merge is the fix
After a check's newest failure, the oldest merge that names the red is its fix. A merge names the red by its check, its owner, or the red's fixes. With none, a merge that names a suspect merge, or a change the red failed on, can be its fix. It must change a file on the red's paths, or change the check.
Another red can hold the same merge. So naming it alone does not make a merge each red's fix. A change that answers the red still merges, named its fix or not.
The culprit, or where the check was seen failing
With no culprit, the red row's change, its owner, and suspect.first_failed are only where the check was seen failing. They name no cause. The row's say says so, and how many merges since the last pass hold the cause. The cause is one of suspect.merges, on the check's paths or not. With no pass in its [red] window, bay reads back down to [red] reach main commits for one. With no pass found, suspect.last_passed is null, and suspect.searched says how many commits bay read.
Find the merge that broke it
A post check may skip merges, so its first failure can come after the merge that broke it. So each red check names its suspect range: the last pass, the first failure, and the merges between. When the last pass sits right below the first failure, the evidence leaves one merge: the culprit. The culprit then owns the red, and detail.red names it. culprit lists the verdict of each merge read, from the pass up to the newest failure.
- With
bisect_post = true, a runner runs the post check on the range's midpoint merges. - A failure keeps the older half, and a pass keeps the newer half.
- At one merge left, it runs the check there once more, to rule out a flake.
- A second failure names the culprit. A pass marks that merge
flaky, and names no culprit. - A range of n merges costs at most log2(n) runs, rounded up, plus that one rerun.
- Each run is ordinary post evidence, signed by the machine's producer key when the repository has a registry.
# .bay/config.toml
[runner]
bisect_post = true # bisect a red post check's suspect rangeWhen two machines answer the pass and the failure
The last pass and the first failure right above it can come from producers that share none. Their machines can differ where the merge does not, so bay names no culprit, and suspect.apart names both sides. With bisect_post = true, a runner of a producer that failed runs the check once at the pass. A pass there names the culprit as before. A failure there is an infra_failure, and that machine leaves the check to the other machines for a day.
The check's environment
- A check starts with a fixed environment:
PATHfrompath,HOMEandTMPDIRin the sandbox, andLANG=C.UTF-8. - bay also sets
BAY_ADAPTER_DIRto the directory of the check'sadapterpaths. - It also gets each variable that
envnames. A named variable the runner lacks isinfra_failure.
Rerun a flaky check
A flaky check passes and fails on the same tree. retry_on_failure = N reruns a product_failure on the same tree, up to N times, at most 5. bay stops at the first answer that is not a failure, and keeps every run as evidence. A failure and then a pass is flaky, never a plain pass. By default, bay refuses a flaky check with CHECK_FLAKY. With allow_flaky = true the change merges, and the result names the check in coverage_gaps with every run.
[[check]]
id = "tests"
environment = "linux-x86_64"
command = "scripts/bay-check tests"
adapter = ["scripts/bay-check"]
expected_minimum = 400
retry_on_failure = 2 # rerun a product_failure up to twice
allow_flaky = false # true: merge a flaky check, named in coverage_gapsJudge only new failures
Sometimes a required check already fails on main, and every change inherits that failure. baseline = "base" on a [[check]] fails a change only on failures its base does not share. bay compares each failing unit, by its id, with the same check's result on the change's base.
A unit that failed on the base too is pre-existing. A unit the base passed or lacks is new. A base record answers only the units that it ran or named gone. When every failure is pre-existing, bay judges the rest of the result. A merge names them in coverage_gaps as baseline_failures. bay never reports a pre-existing failure as a pass.
[[check]]
id = "tests"
environment = "linux-x86_64"
command = "scripts/bay-check tests"
adapter = ["scripts/bay-check"]
expected_minimum = 400
baseline = "base" # fail a change only on failures main does not shareLet a check read history
Each check request also names the base commit, the change with its intent and actor, and its messages. messages holds the change's own commit messages, oldest first, at most 50 commits and 64 KiB. A check whose verdict reads these fields declares inputs = ["commit"] or ["history"]. Then its evidence counts only for that exact commit, never for another commit with the same tree. With inputs = ["history"], the request also carries git: a temporary Git directory that reads the repository's history. The sandbox binds the object store read-only, so the check cannot write to it.
[[check]]
id = "commit-rules"
environment = "linux-x86_64"
command = "scripts/bay-check commit-rules"
adapter = ["scripts/bay-check"]
expected_minimum = 1
inputs = ["history"] # the request's git reads history; evidence keyed by commitIn a blob-less clone, bay walks only the new commits before such a check runs. Those are the commits that its last walk of the same paths did not reach. The store keeps that last commit for each set of paths, under bay/history/ in its Git directory. When the store does not hold the commit that a mark names, bay walks the whole history again.
Set a broken check aside
Sometimes a required check is red on main itself, and it would block every change. Add a [[quarantine]] entry for it in a checked policy change. The entry names the check, a reason and an end, and optionally an owner and a since date. The merge result names the quarantine as a coverage gap.
bay status lists each entry with its owner, its age in days from since, and whether it is overdue. Remove the entry in the change that fixes the check. Past its end, it stays in force until then.
Hold main
Sometimes main must take only fixes for a while, such as during an incident or a migration. A [[hold]] with no target holds main until end, and a [plugin.hold] command can hold it too. While main is held, only a change that carries Fixes: or Reverts: merges. Any other change stays queued with MAIN_HELD, gives up its queue place, and merges once the hold clears. bay asks before it runs a change's checks, and again before each push to main. bay status names the hold under detail.hold: its source (window or plugin), reason and end.
# .bay/config.toml on main
[[hold]] # no target: the hold is on main
end = "2026-11-02T06:00:00Z" # RFC 3339 UTC, to the second
reason = "database migration"
[[hold]] # booked ahead: holds only in its window
start = "2026-11-14T08:00:00Z"
end = "2026-11-14T22:00:00Z"
reason = "launch day"
[plugin.hold]
command = "scripts/bay-hold" # answers {"held": true|false, "reason": "..."} to "status"
timeout_s = 10 # 1 to 120 seconds; 10 by defaultLet only named agents change a path
An [[access]] rule in .bay/policy.toml lists paths globs and the writers that may change them. The globs work as when_paths globs do. A path that no rule covers stays open to every actor. An actor changes a covered path only when each rule that covers it names that actor. Rules need [policy] signing = "all", the default. A rule or an approval check must also cover .bay/policy.toml, or any change could remove the rules.
# .bay/policy.toml on main
[[access]]
paths = [".bay/", "billing/"] # globs; a later "!" glob drops paths
writers = ["alice", "billing-agent"]bay start refuses PATH_NOT_WRITABLE when a rule covers a declared path whole and does not name the actor. A declared directory counts only when the rule covers every path under it. The runner blocks such a change when its merged tree changes a covered path, so nothing merges. The host refuses a runner-signed merge of such a change, by the rules at its parent. A batch never takes a change that touches a covered path, so bay judges it at its own turn. A policy repair that a registry key signs is not held to the rules.
Cap the size of a change
A [limits] table in .bay/policy.toml caps how big one change may be. max_file_mib caps the size of any one file the change adds or changes, in MiB. max_files caps the files it touches, and max_added_lines the lines it adds. A binary file adds no lines that count, so only max_file_mib judges it. bay judges the caps by the policy at the base, so a change never lifts its own. bay merge refuses a change over a cap with CHANGE_TOO_LARGE, before it submits anything.
# .bay/policy.toml on main
[limits] # each key optional; leave one out for no cap
max_file_mib = 10
max_files = 200
max_added_lines = 5000Say how each path collides
How a path merges is said once, in .gitattributes on main, with Git's own patterns. bay reads main's copy, never the change's, so a change cannot loosen the rule for its own files. A change to .gitattributes is checked like a policy change, and an edit made outside bay is named.
# .gitattributes on main
cards.md merge=union
art/** lockable
*.pdf bay-offload| Attribute | What bay does with the path |
|---|---|
merge=union | Merges both sides' lines, for a list every change adds to. |
lockable | One session at a time edits it, and a change merges it only while holding its lock. |
bay-offload | Every new file goes to the large-file store, whatever its size. |
Keep large files out of Git
A video, a design file or a data set makes every clone slow once it enters Git. With [plugin.assets], a new file over [limits] max_file_mib never enters Git. bay keeps its bytes in the remote's own store, so no clone needs a store setup of its own. The change carries one line in .bay-assets instead: the file's SHA-256, its size and its path. So main names exactly the bytes you saved, and bay undo of the change removes the line. A path main's .gitattributes marks bay-offload goes to the store too, whatever its size.
# .bay/config.toml on main
[plugin.assets]
over_limit = "offload" # "refuse", the default, refuses the file with CHANGE_TOO_LARGE
timeout_s = 300 # optional: one call's limit, in seconds
# .bay/policy.toml on main
[limits]
max_file_mib = 10 # files over 10 MiB go to the store
# .gitattributes on main
*.pdf bay-offload # optional: every new .pdf goes to the store, whatever its sizeWhere the store is
The store follows the remote's URL, and bay reaches it through the same login as Git. A plain Git host, such as GitHub, serves no store. There bay refuses a file over the limit, and never puts it in Git. To use a store of your own, name its plugin with command.
| The remote | Where the bytes go |
|---|---|
A path, or a repository from bay host | bay/store/ beside the repository |
ssh://host/path or host:path | The same store on the host, over Git's own ssh and its login |
https://… | The server's /bay-store/v1/, uploaded in parts, with Git's own login for that remote |
What bay does with a large file
- 01
Find it
bay save,bay mergeand every checkpoint of a view look for new files over the cap. - 02
Store it
bay hands each one to the plugin with
put, and checks the identity the plugin names. - 03
Name it
bay writes the file's line in
.bay-assets, sorted by path, and adds the manifest to the change. - 04
Leave it in place
The file stays in your folder. The clone's
.git/info/excludenames it, so Git leaves it alone.
Write an assets plugin
bay runs the plugin from the repository's folder, with only PATH and HOME from its own environment. For a check, it runs the plugin's program as main had it at the candidate's base. It calls the plugin with put, get and exists. A range get and purge are optional. bay hashes every file itself, so it never trusts an identity the plugin names.
#!/bin/sh
# scripts/bay-assets: a store in a shared folder
store="$HOME/asset-store"
case "$1" in
put) mkdir -p "$store" && sum=$(sha256sum "$2" | cut -d' ' -f1) && cp "$2" "$store/$sum" && echo "sha256:$sum" ;;
get) [ -z "${4:-}" ] || exit 2 # no ranges
f="$store/${2#sha256:}"; [ -f "$f" ] || { echo "no such bytes: $2" >&2; exit 1; }; cp "$f" "$3" ;;
exists) [ -f "$store/${2#sha256:}" ] ;;
*) exit 2 ;; # no purge
esac| Call | The plugin does | bay checks |
|---|---|---|
<command> put <file> | Stores the file's bytes, prints sha256:<64 hex> on stdout and exits 0. Storing bytes it already holds is not an error. | The printed identity matches the SHA-256 of the file. Another one fails the save. |
<command> get <identity> <file> | Writes exactly those bytes to <file> and exits 0. Purged bytes exit 3, and an identity it never stored exits with another code. | The written bytes hash to the identity. Other bytes are removed, and the call fails. |
<command> exists <identity> | Exits 0 when it holds the bytes, 1 when it does not, and 3 when it purged them. | Any other exit is an error: an unknown answer never counts as held. |
<command> get <identity> <file> <start> <end> | Optional. Writes bytes start to end of the file, or exits 2 when it offers no ranges. | bay itself reads whole files. A range serves a preview. |
<command> purge <identity> | Optional. Drops the bytes and keeps the address, so get and exists then exit 3. Exits 2 when it offers no purge. | bay never purges on its own. |
Get the files back
bay uses the plugin's get to bring each file back by its hash: in clones, views and checks. bay install in another clone writes the files its main checkout lacks, and so does bay save after a merge. A view gets the files its declared paths cover when bay makes it. A check gets the files it sees, read-only. bay hashes each file before it uses it, and keeps a file already there with the manifest's size. The clone's .git/info/exclude names each file, so Git leaves it alone.
A merge needs the bytes in the store
Before a merge, bay asks the plugin exists for each line the change adds to .bay-assets. When the store lacks the bytes, or bay cannot read the answer, it refuses the merge with ASSET_MISSING. It refuses when it builds the candidate, before any check runs. Save those files again, so the store holds their bytes, then bay merge again. The machine that merges runs the plugin as main holds it, so every runner must reach the store.
When a store purges a file
A store may purge a file's bytes and keep its line in .bay-assets, for example after a takedown. History keeps the line, so its signatures stay whole. bay install and bay save name such a file under assets_purged and go on, and bay makes a view without it. A check runs without a purged file, so one purge never blocks later merges. A change's own new files are never purged: the store must hold them before the change merges.
Say how long a store keeps files
[assets] keep in .bay/policy.toml says how long a store may keep the bytes of some files, such as renders. Each line names a glob and a number of days, counted from the save. The store reads the lines from main's policy and purges. bay only checks them.
# .bay/policy.toml on main
[assets]
keep = [{ paths = "renders/", days = 30 }] # the store may purge renders 30 days after their saveHold files a store must keep
[assets] hold lists paths whose stored bytes no store may purge, such as files under a legal hold. A file ever saved under a held path stays held, even after it is deleted. keep never overrides a hold. Before it purges a file, a store asks bay assets held <id>, which reads main and changes nothing. When bay cannot fetch main, it answers nothing, never "not held".
# .bay/policy.toml on main
[assets]
hold = ["matters/acme/"] # no store purges a file ever saved hereKeep the files in a folder
For a host with no store, bay ships folder-store, a plugin that keeps files in one folder by SHA-256. The folder can be any directory every machine reaches, such as a shared drive. Copy the script into the repository, make it executable, and name the folder after it. Its source: https://github.com/gudjon/bay/tree/v0.4.0/examples/assets/folder-store.
# .bay/config.toml on main
[plugin.assets]
command = "scripts/folder-store /Volumes/studio/bay-assets"
over_limit = "offload"When the plugin fails
A put that exits non-zero, runs past timeout_s or names other bytes stops the save. The result is failed, exits 20, and its sentence quotes the plugin's first line on stderr. bay makes no change and merges nothing then, because an unknown result is never a pass.
Test the assets plugin
bay plugin test assets -- <command> runs eight cases on a 64 KiB sample in a scratch folder. put must name the sample's bytes, and a second put must name them again. get must write exactly those bytes, and get of an identity it never stored must fail. exists must answer 0 for the sample and 1 for an unknown identity. A range get and purge pass when the plugin answers 2 for not offered, or does them right. It writes nothing in the repository, and exits 0 only when every case passes.
bay plugin test assets -- scripts/bay-assetsKeep required checks short
Without the throughput settings, one main branch takes one change per required check run. So the length of your required checks sets how many changes merge each day. Require a few fast checks before merging. Run the broad suite after merging, ordered by risk. A red found after merging gets a fix, or bay undo.
Change a check or its files
When a candidate changes the policy or an adapter path, bay raises revision itself. bay checks that candidate twice: once with the base's adapter files, once with its own. Both runs must pass every required check. Such a candidate requires every check, whatever its when_paths. As a last resort, a registry key can sign a repair of a broken check. That repair touches only .bay/policy.toml and adapter paths, and its new files must pass.
Repair a policy under approvals
Under signing = "approvals", a valid change to only the policy and its check scripts is a repair. Main's checks still judge it, and an enrolled approver may waive each one on that candidate. Its own new policy still runs every check, and none of those is waivable. A check that main's policy asks approval for still waits for a yes. A waiver is never a pass: the merge names it in coverage_gaps with the real verdict.
Test a check or a plugin
bay plugin test runs bay's contract cases against a check command, or a wake, notify or assets plugin. It runs the command through bay's own code, with the same environment and time limits. Each case names what bay sent, what came back, the result and why. detail.bay_records shows what bay itself would record for the first request. It never merges, pushes or writes a ref, and it runs a check in a scratch repository. It exits 0 only when every case passes, and its result is failed otherwise.
bay plugin test check --expected-minimum 50 -- scripts/bay-check web
bay plugin test wake -- scripts/bay-wake
bay plugin test notify -- scripts/bay-notify
bay plugin test assets -- scripts/bay-assets