Skip to content

Git designed for AI agents.

docs: the priority of the holder, the total inline time of a batch, and the known gaps

Federico Elia9004a86dd316
diff --git a/doc/graft/CONFIGURATION.md b/doc/graft/CONFIGURATION.md
index ec0d8b9..eca6a72 100644
--- a/doc/graft/CONFIGURATION.md
+++ b/doc/graft/CONFIGURATION.md
@@ -202,7 +202,7 @@ cause.
| `verify_concurrency` | int | `2` | Verifications that run at once in the Gitaly process (of any resolution: a rule's, an agent's, a model's), all out of the lane, in a pool of their own that exists whenever `verify.enabled` is set, with or without an AI resolver, as `verify.command` takes minutes. A verification waits for a free slot within the land's deadline. The wait is in `graft_resolver_verify_slot_wait_seconds`. |
| `resolve_concurrency` | int | `2` | Resolutions that run at once in the Gitaly process, in a pool apart from the checks', so that long resolutions never delay a check. A resolution waits for a free slot within the land's deadline (`timeout`), and fails closed when it expires. The wait is in `graft_resolver_resolve_slot_wait_seconds`. |
| `resolve_rounds` | int | `32` | Safety cap on the rounds of a land whose conflicting files keep changing while it is resolved out of the lane. The rounds are bounded by `timeout`; a land that loses a round waits for its turn on its files in a queue, so that it does not lose them one after the other (RESOLVE.md, "Out of the lane"), and the cap is not reached in practice. It is no contract. |
-| `inline_timeout` | string (Go duration) | `"1s"` | Bound of the call with which the lane resolves a member's conflicting files itself, as the rules (trivial, union, rerere, a command that is a rule) and never a model: the request carries `rules_only` and announces no capability but `origin`. The lane never waits for a slot (the calls have a pool of their own; with it taken the member goes out of the lane), and the time it may lose to calls that fail is bounded once per batch attempt: a call that fails or is cut at `inline_timeout` is charged to the batch, and once the batch has lost `inline_timeout` the other members go out of the lane without a call (a resolver that leaves child processes holding its output may keep the lane up to 2 s more, the kill delay). A member whose files the rules cannot resolve within it is resolved out of the lane, as any other. `"0s"` turns the inline resolution off. Never used with `verify.enabled`: every tree is then verified out of the lane. |
+| `inline_timeout` | string (Go duration) | `"1s"` | Bound of the call with which the lane resolves a member's conflicting files itself, as the rules (trivial, union, rerere, a command that is a rule) and never a model: the request carries `rules_only` and announces no capability but `origin`. The lane never waits for a slot (the calls have a pool of their own; with it taken the member goes out of the lane), and the time it spends in inline calls is bounded once per batch attempt: all the time of every call, a successful one too, is charged to the batch, and once the batch has spent `inline_timeout` the other members go out of the lane without a call (fast rules, milliseconds, do not notice; a resolver that leaves child processes holding its output may keep the lane up to 2 s more, the kill delay). A member whose files the rules cannot resolve within it is resolved out of the lane, as any other. `"0s"` turns the inline resolution off. Never used with `verify.enabled`: every tree is then verified out of the lane. |
| `paths_allow` | array of strings | empty (every path) | Globs of paths that may be sent to the resolver, with the syntax of policy refs. |
| `paths_deny` | array of strings | empty | Globs of paths that are never sent. Deny wins over allow. |
| `actors` | array of strings | empty (every caller that may land) | Globs of the identities that may request resolution: agent names, or `shared` for the shared token. Without `[[graft.agent]]` no caller has an identity, so a non-empty list admits nobody (the server warns at startup). |
diff --git a/doc/graft/PLAN10.md b/doc/graft/PLAN10.md
index 4b2d660..8f9b614 100644
--- a/doc/graft/PLAN10.md
+++ b/doc/graft/PLAN10.md
@@ -1296,18 +1296,25 @@ The resolution is bound to the files instead:
took: a model, a verification, a rule that does not end within `inline_timeout` (default 1 s) or one that cannot
resolve a file go out of the lane, to the path below. With the rules in the lane the bench has no hand-back, no
ticket and one resolver call per resolution, and its numbers are v0.2.0's. The lane is bounded: it never waits for
- a slot (the calls have a pool of their own; with it taken the member goes out of the lane), and the time it may
- lose to calls that fail is bounded once per batch attempt (`landInlineBudget`: `inline_timeout` in all, not per
- member). A land that the rules cannot resolve (the resolver refuses, or a file may not be sent) is resolved out of
- the lane for the proposals and ends there, without a ticket: without a verification a model's resolution never
- lands, so a ticket would protect nothing. The request announces no capability but `origin`, so that a
+ a slot (the calls have a pool of their own; with it taken the member goes out of the lane), and the time it
+ spends in inline calls is bounded once per batch attempt (`landInlineBudget`: `inline_timeout` in all, not per
+ member): all the time of every call is charged to it, one that succeeds as well as one that fails, so a rule of
+ 0.9 s does not stall a batch of N members for N x 0.9 s; once it is spent the other members go out of the lane,
+ where the queue guarantees their progress, and fast rules (milliseconds) do not notice. A land that the rules
+ cannot resolve (the resolver refuses, or a file may not be sent) is resolved out of the lane for the proposals and
+ ends there, without a ticket, and gives back the one it took if it had queued for it: without a verification a
+ model's resolution never lands, so a ticket would protect nothing. The request announces no capability but `origin`, so that a
graft-resolve that gates the models on the capabilities (any since they were added) refuses to call one even if it
ignored `rules_only`; v0.2.0 has no gating and may.
2. **A queue for the lands that lose a round out of the lane.** A land that lost a round takes a ticket, first in
first out, on its files (per file; per branch when `verify.enabled`, since the tree that is verified is the
branch's), keeps it until it lands, its deadline ends or it fails, and is the only land of the branch that resolves
them again; the others wait without calling the resolver, and the lane hands back any land with a verdict made out
- of the lane on a ticketed file, so that the holder's verdict is the one that lands. A ticket never stops the
+ of the lane on a ticketed file, so that the holder's verdict is the one that lands. The holder that lost a round
+ out of the lane holds its files with priority until it is done: the lane also hands back the inline resolutions of
+ the others on them, which would change the files under its verdict at every round (a rule slower than
+ `inline_timeout` on a hot file would never land); they wait behind it and go back to the lane when it is done.
+ Otherwise a ticket never stops the
rules in the lane: the inline attempt comes before the check of the tickets, and the land that waited for its turn
goes back to the lane, not to a new pre-resolution; a lane round does not count toward `resolve_rounds`. The
queue alone, measured on the same bench before the rules were resolved in the lane (the first form of this fix, not
@@ -1344,7 +1351,13 @@ The resolution is bound to the files instead:
The start loads of the last six runs (the wrapper's control and the failure) were not logged; the cooldown that
holds each start until the load is below 2 was in force, and the whole batch ran in a few minutes.
The limits, stated. The queue is in memory and per process, like the lanes: against another node of the same branch
- (authoritative storage) the lands go on in rounds, without the guarantee. A holder's verdict is invalidated by a land
+ (authoritative storage) the lands go on in rounds, without the guarantee. A land that holds a file with priority
+ makes the inline resolutions of the others on it wait for its resolution, which is as long as a slow rule or the
+ deadline allows. Two gaps are known: a resolver that crashes (a non-zero exit with no refusal in its answer) is
+ taken as the rules not being able to resolve, so the land is resolved out of the lane for the proposals; and a
+ v0.2.0 graft-resolve, which has no gating and ignores `rules_only`, that is cut at the timeout on a model's conflict
+ is never recognised as an older one (only an answer that does not echo `rules_only` is), so it pays the lane's
+ budget at every batch; with it set `inline_timeout = "0s"`. A holder's verdict is invalidated by a land
that changes its file cleanly and lands first (each such land lands once, and the holder resolves again, which is
cheap for a rule); with a verification every tree is verified out of the lane, and any land that moves the branch
while a holder verifies, a clean one included, makes the verified tree stale: on the bench with a verification of 1 s,
diff --git a/doc/graft/RESOLVE.md b/doc/graft/RESOLVE.md
index c0780fe..fe88af4 100644
--- a/doc/graft/RESOLVE.md
+++ b/doc/graft/RESOLVE.md
@@ -551,17 +551,23 @@ A round is lost when another land changed one of the files. The rules do not wai
model for it. What a rule cannot resolve, or does not resolve in time, is handed back and resolved out of the lane as
described above. The lands on a hot file ride the same batches as the others, as they did in v0.2.0. The lane is
bounded: it never waits for a slot (the calls have a pool of their own, so a model that holds the resolve slots does
- not stop the rules; with it taken the member goes out of the lane), and a call that fails or is cut at `inline_timeout`
- is charged to the batch attempt: once the batch has lost `inline_timeout` the other members go out of the lane without
- a call, so a batch stalls once, not once per member. A land the rules cannot resolve (the resolver refuses) is
- resolved out of the lane for the proposals and ends there, without a ticket (without a verification a model's
- resolution never lands). A resolver that does not echo `rules_only` is an older one: its answer is dropped and the
- lane never asks again for the life of the server process.
+ not stop the rules; with it taken the member goes out of the lane), and the time it spends in inline calls is charged
+ to the batch attempt, all of it, a call that succeeds as well as one that fails or is cut at `inline_timeout`: once
+ the batch has spent `inline_timeout` the other members go out of the lane without a call, so a batch stalls once,
+ not once per member (fast rules, milliseconds, do not notice). A land the rules cannot resolve (the resolver
+ refuses) is resolved out of the lane for the proposals and ends there, without a ticket (it gives back the one it
+ took if it had queued for it: without a verification a model's resolution never lands). A resolver that does not
+ echo `rules_only` is an older one: its answer is dropped and the lane never asks again for the life of the server
+ process.
* **A queue for the rest.** A land that loses a round out of the lane (a verification, or a rule that takes more than
`inline_timeout`, or a file that changed meanwhile) takes a ticket on its files, first in first out, and keeps it until
it ends. It is the only land of the branch that resolves those files again; the others wait without calling the
- resolver, and the lane hands back any other land whose verdicts were made out of the lane. The rules in the lane do
- not wait for a ticket, and a land that waited for its turn goes back to the lane. A land that waits past its
+ resolver, and the lane hands back any other land whose verdicts were made out of the lane. The holder that lost a
+ round out of the lane holds its files with priority until it is done: the lane also hands back the inline resolutions
+ of the others on them, which would change the files under its verdict at every round (a rule slower than
+ `inline_timeout` on a hot file would never land); they wait behind it, and go back to the lane when it is done. Apart
+ from that the rules in the lane do not wait for a ticket, and a land that waited for its turn goes back to the lane.
+ A land that waits past its
deadline ends with the merge conflict and its package, its files `NOT_ATTEMPTED` with the reason `the time ran out
waiting for the other lands on the same files`.
The tickets are per file, or per branch with `verify.enabled` (the tree that is verified is the branch's). They are in
@@ -804,8 +810,11 @@ them. Cost: two model calls per region.
and drops the answer, which is not a rule's, whatever it is. A batch pays at most `inline_timeout` for such calls
(the lane's budget), and the first answer that does not echo `rules_only` makes the server stop asking, for the life
of the process (`graft: the resolver did not honour a request for its rules only` in the log). After that the rules
- are resolved out of the lane, with the queue, as before this release. Set `inline_timeout = "0s"` to avoid even
- those calls with the `graft-resolve` of v0.2.0.
+ are resolved out of the lane, with the queue, as before this release. A `graft-resolve` of v0.2.0 that is cut at
+ `inline_timeout` while it calls a model for a conflict, without ever answering, is never recognised as an older one,
+ so every batch pays the lane's budget for it: set `inline_timeout = "0s"` with the `graft-resolve` of v0.2.0.
+ (A resolver that crashes, with a non-zero exit and no refusal in its answer, is taken as a refusal: the land is
+ resolved out of the lane for the proposals.)
Upgrade both in the same maintenance window anyway.