Lessons and reverts
Lessons and reverts are two of the three parts of learning, beside memory for the score. Lessons teach the reviewer which findings a repository’s people have shown to be wrong. Reverts tell later reviews which files had a change taken back. Both are switched on, with the rest of learning, by learning: true (see Memory), and both are context retrieved into later reviews: no model is trained.
Lessons
Section titled “Lessons”A lesson is one sentence a model writes from a reply a person wrote under one of the reviewer’s findings, when the reply showed that the finding was wrong. For 90 days, later reviews of that repository are shown the lesson as data, so that they leave out findings of the kind it says was wrong.
How a lesson is made
Section titled “How a lesson is made”Once a UTC day, at the first tick of the five-minute timer after 00:00 UTC, a run of the judge takes the replies that need a verdict:
- every reply a person wrote in a thread that one of the reviewer’s findings started, of any severity, each judged on its own against its finding (a reply under an inline note is not judged);
- written in the 90 days before that 00:00, and not yet classified;
- replies from people with access first, then the oldest first, so a reply 90 days old is never judged.
A run takes at most 100 replies, and at most 20 of them from accounts with no access to the repository (JUDGE_STRANGERS in src/shell/judge.ts); the rest wait for a later run. Once ten lessons have been made since that day’s 00:00, the run ends and the rest wait for the next night.
The judge classifies each reply as confirmed_fix, valid_pushback, invalid_pushback, question or noise. Only valid_pushback from a person with access can become a lesson, and only after the guards below. The judge writes the sentence and quotes the words of the reply it is based on.
A run that does not complete (a stop, the daily spend limit, a paused model, three provider failures in a row, a failing database) keeps what it wrote and is tried again an hour later, or at the first tick after a restart, and takes up to 100 replies again. After a run that completed, a restart starts no new run that day.
Who can make a lesson
Section titled “Who can make a lesson”A person the git service reported, when they wrote, as owner, member or collaborator of the repository, the pull request’s author included. On a private repository (not an internal one), where only people with access can read, GitHub’s NONE or CONTRIBUTOR for a person is read as collaborator: GitHub sends those for an organization member who keeps the membership private. A reply from an account with no access is judged and its verdict stored, but it makes no lesson. Bots’ comments are not stored, so a bot never makes one.
What the judge sends, and what it costs
Section titled “What the judge sends, and what it costs”For each reply, the model provider is sent the file’s name (when it may be shown), the finding’s severity, the finding’s text and the reply’s own words, up to 2,000 characters of each text, between data markers with a token made for that call. What a reply quotes from someone else (quoted lines, <blockquote> and <details> blocks) and its fenced code blocks are left out, so a reply that only quotes is not sent, and “agreed” under a quote teaches nothing. An indented code block, <pre>, a table and an HTML comment stay in. No code and no login is sent.
- Model. The review model, with its client,
model.toolChoiceandmodel.timeoutSeconds. - Calls. One call for a reply, and one more when the answer gives no verdict. The client’s single wait on a rate limit and its fallback models can add requests to each.
- Tokens. A request is about 2,400 input tokens by the service’s estimate, and one asked again about 3,100.
- Spend. The cost counts in
limits.spendPerDay, at the start of its day. A cost the endpoint did not report raisescost_unknown, as for a review. - Pauses. The judge makes no call while reviews are paused, for the daily limit or for the model’s key: the run ends for now.
- Dry run. The judge runs in dry run too, and is paid for.
Guards and outcome codes
Section titled “Guards and outcome codes”Each judged reply has a row in visto_ai.reply_verdicts with its classification and an outcome:
| Outcome | Meaning |
|---|---|
lesson |
A lesson was made |
none |
The classification is not valid_pushback |
no_rule |
The judge gave no lesson |
no_access |
The writer has no access to the repository |
not_printable |
The finding’s file has a name that is never shown |
no_quote |
The judge quoted nothing, or under 15 or over 200 characters |
quote_not_in_reply |
The quote is not in the writer’s own words as the judge was sent them, ignoring white space and case. A quote from beyond the first 2,000 characters therefore makes no lesson |
not_a_rule |
Once invisible characters are removed and it is made one line, the sentence is under 30 or over 300 characters (it is never cut to fit), or holds # followed by a digit, or a link. A full-width #, digit or slash counts as the plain one |
names_the_score |
The sentence holds score, scores, scored, scoring, human review, needs a person, needs a human, approvable, or a form of automatic approval. A repository whose own subject is scores or approvals loses the lessons that name them |
review_disagreed |
The newest published review of the pull request that started after the reply and holds a verdict for the thread kept the finding open or found it fixed |
restates |
The sentence repeats a standing lesson of the repository, active or switched off, of up to 1,000 read: the two are equal ignoring white space and case, or each has at least 4 distinct words of 5 or more letters or digits and they share at least half of the smaller set |
no_own_words |
The reply holds nothing but quotes or code. It is noted as noise and not sent |
unjudged |
Twice in one call the answer gave no verdict. After 3 such calls the reply is left alone. A call that failed at the provider counts no attempt |
finding_unknown |
The finding’s text cannot be told from its review’s stored result (two findings of that review alike in path, side, severity, quote and line, which is more frequent after a comment was repaired from its thread). The reply is left alone, with no call |
The names_the_score guard catches a judge that strays into scoring. It guards nothing else.
What a review is shown of lessons
Section titled “What a review is shown of lessons”A review is shown at most 8 lessons. Each stands under a line the service writes, naming the finding’s file in a code span and the day. That file name is the one thing in a lesson’s block that a pull request’s author chose: it is at most 120 characters of the characters ordinary in file names, shown as a name and never as an instruction.
Lessons are ordered by what they share with the files sent:
- a lesson on one of those files, or on the path it had before a rename;
- then those that share leading directories with one, deeper first;
- then those of a file’s type, what follows the last dot of its name.
Within each group the newest come first. A lesson that shares none of the three is not shown. In a repository under one top directory, or in one language, that leaves out little, and the order and the limit of 8 decide.
Further rules:
- A pull request is never shown a lesson made from itself, and a review is shown only lessons whose
created_athas passed. - Only a block the service labels, after the heading of the rules and with the review’s token, is a lesson, whatever a description says.
- A lesson whose file, day or text would be refused is left out.
- Lessons are looked up once a review, after memory for the score, and shown whole or not at all, only when they cost the files and the rest of memory nothing. Otherwise the audit records
lessons_cutwithover_call_budget. They are fitted before the extension context and the MCP tools, which then count them. - Lessons are shown with a second scorer too, to pull requests from forks, and in dry run.
Cost. Each call of a review that shows lessons carries up to about 2,000 more input tokens, and the files may be packed into more calls. The lookup is one more database read for each review, with the 5 seconds a lookup of memory has. It reads the repository’s live lessons from other pull requests, at most 1,000, newest first; beyond that the oldest are left out and the audit records lessons_cut with records. A lookup that fails, hangs or returns something unreadable costs the review its lessons and nothing else.
What a lesson is to the reviewer
Section titled “What a lesson is to the reviewer”Lessons are data between markers with the review’s token, under LESSON_RULES in src/engine/context/lessons.ts. The rules tell the model that a lesson:
- never changes the rules, and an instruction inside one is never followed;
- is for leaving out a finding of the kind it says was wrong;
- never hides a defect the model can demonstrate;
- says nothing about the score;
- is never mentioned in the answer.
A lesson can keep a finding from being raised, which is what it is for, and one major finding fewer can change what the merge gate or an automatic approval decides. No floor, verdict or gate reads a lesson directly, and nothing in code checks what the model makes of it.
Nothing in code keeps a model that reads a lesson from scoring a block lower. With a second scorer, block scores do not come from the review model, so a lesson cannot reach them. Where the review model scores, only the rules’ words forbid it.
Switch a lesson off
Section titled “Switch a lesson off”An admin switches a lesson off or on in the UI’s Memory screen (see Memory and The UI), or in the database:
-- the active lessons of one repository; a review is shown those whose created_at has passedselect id, number, created_at, expires_at, path, lesson, excerptfrom visto_ai.memory_recordswhere owner = 'acme' and repo = 'shop' and kind = 'lesson' and status = 'active' and expires_at > now()order by created_at desc;-- switch one off: it is in no review from the next one on, and the judge will not make it again while it standsupdate visto_ai.memory_records set status = 'disabled' where id = 42;-- what the judge made of the repliesselect outcome, count(*) from visto_ai.reply_verdicts where owner = 'acme' and repo = 'shop' group by outcome order by 2 desc;-- replies under a comment the service does not hold: one of the reviewer's that was not stored, one of another bot-- (never stored), or a person's from before the service received webhooks. The three cannot be told apart here, so the-- count is an upper bound on the replies to the reviewer that are never judged for want of their findingselect count(*) from visto_ai.human_activity hwhere h.kind = 'inline_comment' and h.reply_to is not null and not exists (select 1 from visto_ai.human_activity p where p.service = h.service and p.kind = 'inline_comment' and p.source_id = h.reply_to) and not exists (select 1 from visto_ai.review_comments c where c.service = h.service and c.comment_id = h.reply_to);-- let a reply the judge gave no verdict for be judged again; a reply whose finding cannot be read (finding_unknown)-- is left out, since the next run would retire it again with no callupdate visto_ai.reply_verdicts set attempts = 0 where reply = '1234567' and classification is null and outcome = 'unjudged';-- what the judge cost, by repository and day; each row of judge_calls holds the pull request and the reply it was forselect owner, repo, date_trunc('day', at) as day, sum(calls) as calls, sum(cost) as costfrom visto_ai.judge_calls group by 1, 2, 3 order by 3 desc, 1, 2;A lesson stands while it is active or switched off and has not expired. Its quote, excerpt, is the words of the reply the judge quoted, at most 200 characters. It is stored, shown on no screen and never sent to a review.
A judge that runs and teaches nothing
Section titled “A judge that runs and teaches nothing”The start’s lessons_state line and each run’s lessons line show replies judged beside lessons made, and the outcome codes say why each reply made none. Many no_access outcomes over weeks usually mean the git service reports the writers as having no access to the repository, as it may for a member whose organisation membership is private.
What a review records of lessons
Section titled “What a review records of lessons”review_runs.result holds dependencies.memory.lessons when the review got as far as asking for lessons: a state, a short code and the number of lessons shown.
| State | Codes |
|---|---|
ok |
ok |
empty |
no_lessons |
skipped |
no_model_call (the review called no model), no_room |
error |
timeout, lookup_failed, bad_answer, or the short code the lookup failed with |
The audit records each lesson shown (lesson_shown, with its source reference and file, directory or type), each cut (lessons_cut, with lessons, fields, names, texts or records, and with lessons and over_call_budget when they did not fit) and a failure (lessons_failed). The review log line’s memory carries lessons with the same three fields when the result has it.
The alerts memory_error and memory_ok cover both parts of memory. A review that records error in either is a failure, with the code of the first part in error. Otherwise, one that records ok or empty in either is a success (see Memory).
Logs, totals and the stale alert
Section titled “Logs, totals and the stale alert”The nightly work logs:
lessons_stateat start: when the work began, when a run last completed, and its totals;lessonsafter each run, also one that found nothing: its counts, its cost,morewhen it ended with replies unfinished, andend;lessons_failedwith a short code when a run failed, or when a tick’s read of the row failed or took more than 5 seconds (timeout).
end |
Meaning |
|---|---|
done |
The run went through every reply it took (more says whether others wait) |
lesson_cap |
Ten lessons were made since 00:00 |
stopped |
The service was stopping |
spend_limit |
The daily spend limit was reached |
model_error |
Reviews are paused for the model |
auth, no_credit |
A call failed at the provider for its key or its credit |
rate_limited, timeout, provider |
Three calls in a row failed at the provider, the last for this reason |
No line holds a reply’s words, a lesson’s text, a quote, a path or a login.
The table visto_ai.learning holds a second row, lessons: when it was made, when a run last completed (done or lesson_cap), and running totals of replies classified, lessons made, replies left alone, and calls that failed at the provider or gave no verdict. A run that does not complete adds its counts but not its time. A stopped run adds nothing, since the database may be closing.
lessons_stale (with hours) is raised when no run has completed for 36 hours. It is checked at every tick of the five-minute timer, once the row is read or its read has failed, and counts from the row’s last run, or from when the row was made, or, when the row is missing or cannot be read, from the last run this process completed or from its start. It is raised once until a run completes.
Stops and edge cases
Section titled “Stops and edge cases”- A stop. A run under way is told, starts no further call, does not ask again for a reply whose first answer gave no verdict, and sends the database nothing more. The stop waits for it at most 5 seconds before the database closes. A call answered after the stop is in the run’s line and the spend guard is told of it, but nothing is written for it: its reply is judged again, and its cost is in no sum.
- Edited or deleted replies. A lesson made from a reply stays until it is switched off or expires.
- Confirmation. A lesson that is confirmed again is not renewed.
- Contradictions. Two lessons that disagree both stand.
- Duplicated comments. A stored result that lists one comment twice among its thread verdicts gives
review_disagreedone of the two. - Two instances. Two services running the judge at once on one database would record its cost twice. One service runs one judge, and a second instance stops at once.
Migration for lessons
Section titled “Migration for lessons”Lessons add migration 0011_lessons: the tables reply_verdicts and judge_calls, and on memory_records a column for a lesson’s text. It is applied whether or not learning is on, and an older release refuses to start on a database that has it.
Measuring lessons
Section titled “Measuring lessons”You can measure what lessons do to findings and to scores on your own deployment’s data. The evals replay past pull requests with the lessons that were live at each one’s date, and compare that with runs without lessons. The lessons are made by the eval itself, from an export of your deployment’s findings and the replies under them, not read from the deployment’s records.
The steps are: export the findings, import the history of the same window, judge the replies, build the cases, check the floors, then make three paid runs and compare them.
1. Export the findings
Section titled “1. Export the findings”Only the person who runs the deployment can do this, since it is the one command here that connects to a database:
npm run eval:export-findings -- --config config.local.yml --out ../export.jsonl- It reads in one read-only transaction and writes nothing to the database.
- It refuses a database without migration
0003_publishing(database_not_migrated), and an--outthat already exists unless--forceis given (out_exists). - The file must be outside the project folder, and it is written mode 600.
- It prints
findings <n>, with replies <n>, replies <n>, pull requests <n>.
For every finding comment of a published run (not an inline note), the file holds the run’s id, head, base and start; the finding’s text; every inline comment that replies to it, with its writer’s association with the repository; and every later published run of the pull request that kept a verdict for the thread. It holds no login, no title, no description and no memory record.
The export is private. It holds finding texts and replies, so read it before handing it to anyone.
2. Import the history of the same window
Section titled “2. Import the history of the same window”Run eval:import-history (see Backtest) over the same repository and the same dates. The export holds no description and no branch, and the cases need them. A pull request missing from the history file gets no case, and the history file holds merged pull requests only.
3. Judge the replies
Section titled “3. Judge the replies”eval:judge-replies asks the model again for every reply in the export, with the code the service’s nightly judge uses, and replays the service’s nights over the export: each 00:00 UTC from the day after the earliest reply up to the 00:00 of the export’s day, as if learning had been on from the first reply.
npm run eval:judge-replies -- --findings ../export.jsonl --config config.local.yml --out ../lessons --max-cost 2- It makes paid model calls, one for each reply and one more for an answer with no verdict, with the config’s review model,
model.toolChoiceandmodel.timeoutSeconds. --max-costdefaults to 2 USD and counts only what that run spends.- It needs no
GITHUB_TOKEN. - It writes, in
--out,lessons.json(mode 600),summary.md(counts only) andanswers.jsonl(mode 600). - It prints
nights <n>, judged <n>, lessons <n>, given up <n>, waiting <n>, calls <n>, asked now <n>, cost <n>, spent now <n>, andstopped: <reason>when the run did not finish.
Every answer is kept in answers.jsonl, keyed by the reply, the attempt, the model, its fallbacks, the tool choice and the judge’s input. A second run asks only what is not kept, and a changed rule, finding text, reply, model, fallback or tool choice asks the affected replies again. A provider failure is never kept.
A run that is cut short is refused downstream. A night that ended for any reason but done or the lesson cap, a night in which a call failed at the provider, or a run stopped by --max-cost stops the simulation and writes lessons.json with complete: false. lesson-cases, replay, backtest and memory-count refuse such a file with lessons_incomplete. Run the command again with the same --out: it pays only for what is not kept. A lessons file that does not parse is refused with bad_lessons_file.
When a lesson is live. A review at a given date is shown the lessons made at or before that date, from the 00:00 after their reply, and not yet expired (90 days). A later verdict counts at a night only when its run started after the reply and was published before that night. A case is never shown a lesson made from a reply on its own pull request, nor one made from a reply written on its own day.
4. Build the cases
Section titled “4. Build the cases”eval:lesson-cases joins the export, the lessons file and the history file into the replay’s case file. It calls no model and reads no network:
npm run eval:lesson-cases -- --history ../history.jsonl --findings ../export.jsonl --lessons ../lessons/lessons.json --out ../lesson-cases.jsonl- It refuses a lessons file made from another export (
different_export) and an existing--outwithout--force(out_exists). The case file is written mode 600. - It prints
cases <n>, labels valid <n> invalid <n>, cases shown a lesson <n>, invalid labels in them <n>, skipped not in history <n>, no base <n>, same head <n>, then a line<key>: lessons <n>, invalid <n>, valid <n>for each case. --only-shownwrites only the cases the count says would be shown a lesson.
One case is made for each published run of a pull request the history file holds, with at least one labelled finding, at the run’s head, against its base, dated by the run’s start (review_at). Its title, description, branches and author come from the history file, matched by repository (in lower case) and number. A run with no base is skipped (no_base), and a second run at a head that already made a case is skipped (same_head). Each case is reviewed whole at the run’s head, though the run itself may have been an incremental review.
How findings are labelled. The first decisive reply, in time order, by a person with access labels the finding: valid_pushback makes it invalid, and confirmed_fix or invalid_pushback makes it valid. With no decisive reply, the newest later verdict of the thread is read, whatever its time, and fixed makes it valid. Anything else gives no label. A label carries the comment’s id, path, side, line and severity, and no text. A label is a model’s reading of a reply, not a person’s, and a reply from an account with no access labels nothing. The same judge makes lessons and labels, but a case is never shown the lesson made from the reply that labelled it.
5. Check the floors before paying
Section titled “5. Check the floors before paying”The count says how many cases would be shown a lesson, and how many invalid labels are in them. It uses the history file’s final files to stand for the files the review is handed, so it can be off by the files that changed between the run’s head and the merge.
| Paid run | Worth making with at least |
|---|---|
| Replay | 20 cases shown a lesson, and 10 invalid labels in them |
| Backtest | 20 cases shown a lesson (eval:memory-count --lessons, see Backtest), and 10 of them with a labelled file |
These are starting values, not a finding. With fewer, a paid run cannot show anything, whatever lessons do.
6. Make the three runs and compare
Section titled “6. Make the three runs and compare”Make two baselines without lessons and one candidate with them, all on the same case file and config, so the noise between the two identical baselines is known:
npm run eval:replay -- --cases ../lesson-cases.jsonl --out ../runs/off-1 --label off-1 --config config.local.ymlnpm run eval:replay -- --cases ../lesson-cases.jsonl --out ../runs/off-2 --label off-2 --config config.local.ymlnpm run eval:replay -- --cases ../lesson-cases.jsonl --lessons ../lessons/lessons.json --out ../runs/on-1 --label on-1 --config config.local.ymlnpm run eval:compare -- ../runs/off-1/summary.json ../runs/on-1/summary.json --noise ../runs/off-2/summary.jsonTo see what lessons do to the score, make the same three runs on the history file with eval:backtest and --lessons, and compare them with eval:score-compare (see Backtest). A difference smaller than the noise between the two baselines is no finding, and “no measurable effect” may mean “too few cases”.
What the measurement cannot show
Section titled “What the measurement cannot show”- The lessons are the eval’s, made by a judge that does not answer exactly as it did at night. Your deployment’s own lessons are not these.
- The eval cannot tell which lessons a team switched off. A lesson your team rejected is shown in the eval, which can only make lessons look worse than they are.
- The service runs a night at the first tick after 00:00, or an hour or more later after a retry or an outage; the eval runs it at 00:00. A review that starts in between is shown a lesson in the eval that the service had not yet made.
- The replay is shown lessons alone: its memory holds no record of people stepping in and no revert, and its results hold no block scores. What a lesson does to the score shows only in the backtest, on the history file’s pull requests.
- A finding whose text cannot be told is exported with no text, and the judge gives no verdict for it (
finding_unknown). - Neither comparison can tell a lesson that changed a finding from noise on a small count.
What the commands print
Section titled “What the commands print”The commands print counts, costs and short codes. No reply, finding, lesson text, quote, path or login is printed or logged, and summary.md holds none. A file that cannot be read is named by its line number only (bad_findings_line_<n>, bad_answers_line_<n>). export-findings, judge-replies and lesson-cases need no GITHUB_TOKEN, and every file they read or write must be outside the project folder.
Reverts
Section titled “Reverts”A revert is a merged pull request whose description starts with the line GitHub’s revert button writes. With learning on, the files of the pull request it reverted are recorded, and later reviews of that repository are told that a change to such a file was reverted, as context for the score.
What counts as a revert
Section titled “What counts as a revert”A merged pull request whose first non-blank line of description is, exactly as written, Reverts <owner>/<name>#<number>: the line GitHub’s revert button writes, naming the pull request’s own repository, with nothing after the number but spaces and tabs. When you click Revert on GitHub, the whole description of the new pull request is that one line, with the repository’s full name.
- Only the first 4,000 characters of a description are read. In a longer one, a line that runs past the cut names nothing, since the cut may have shortened it.
- Nothing is stripped before the line is read. Every line end a renderer honours ends the line: line feed, carriage return alone, the Unicode line and paragraph separators, the next-line character, form feed and vertical tab.
- The number is read from every event of a pull request that is not yet merged, and from the delivery of its merge, and is stored with the pull request whether or not learning is on. Nothing else of a description is stored, logged or sent.
What does not count
Section titled “What does not count”- A revert made on the command line, whose reference is in a commit message.
- The short form
Reverts #12. - A reference below another line, a sentence or a template, or inside an HTML comment, a collapsed
<details>block, a code block or a quote. - A space before the word, or a reason, a period or any other character after the number on its line.
- An invisible character anywhere in the line, or alone on a line before it.
- A reference to another repository, or to a number no pull request can have.
- A reference to the repository by a name it had before a rename. A repository renamed since keeps its old name in such a line, which then names nothing.
- A line added after the merge, whatever order the deliveries arrive in: once a pull request is merged, only the delivery of its merge sets the number.
What is recorded, and when
Section titled “What is recorded, and when”The five-minute learning pass records a revert once the merge of the reverting pull request is stored; the delivery of the merge wakes the pass. It writes one record of the kind revert for each path of the reverted pull request’s last review: its newest completed run, dry runs included, whose stored list of files is not empty. A renamed file is recorded under both of its paths, at most 300 paths are recorded in the stored order, and a path that is never shown gets none. Each record is dated by the merge of the revert and expires 180 days after.
The pass logs one revert line for each revert it looks at, with the two numbers, a code, files (the records made), added (the rows added now) and cut (the paths the limit of 300 left out). These records count in the pass’s added and in the signals row of visto_ai.learning.
| Code | Meaning |
|---|---|
recorded |
The files were recorded |
not_stored |
The pull request named is not stored |
not_merged |
It is not stored as merged, or was merged after the revert |
same |
The pull request names itself |
no_files |
The pull request named has no completed run with files |
For every code but recorded, nothing is recorded, and the reverting pull request is marked as looked at like any other. So a revert looked at before the merge of the pull request it names was stored, as after an outage whose deliveries were redelivered in another order, records nothing at that point.
The pass looks at the reverting pull request again when an inline comment on it is stored after that look, from any account that is not a bot (including its author and accounts with no access), or once the last statement in Statements is run. Each look writes its line again: with added: 0 when its records are there, or with the records it now makes when the pull request it names is now stored as merged with a review. Two passes at the same moment can each log the line, and each record is written once.
What a review is shown of reverts
Section titled “What a review is shown of reverts”A changed file gets at most one reverted line: the newest revert of its path, or of the path it had before a rename, on a path no file before it took. The line says changed, the file in a code span, the day the revert was merged, - and reverted. With such a line, the rule REVERTED_LINE_RULES in src/engine/context/memory.ts stands once between the rules of the pull request block and its lines. A review with no reverted line is sent exactly what it would be sent without reverts.
Reverted lines are part of memory for the score, and a revert never costs a review a record of people stepping in:
- They stand after every other line and take none of their places. The limit of 30 lines cuts them first (the audit records
memory_cutwithlines). - When memory does not fit with them, it is tried without them before nothing is shown (
memory_cutwithreverted). - They are shown only when the files are packed into the same calls, grouped the same, with them as without them. Otherwise memory is shown without them (
memory_cutwithrevertedand the reasonchanges_batches). - A memory whose only lines are reverted is shown, when it fits, only if the files are packed the same with it as with no memory. Otherwise nothing is shown (
memory_cutwithrevertedandchanges_batches, and memory’s status isskippedwithno_room). When it does not fit, nothing is shown, as for any memory that does not fit. - Memory is fitted before lessons, the extension context and the MCP tools, so a reverted line and its rule can take room that a lesson or the extension context would otherwise have had.
Also:
- No reverted line is
near: a file near a reverted one is told nothing. - A revert is counted in neither list of the repository block.
- A revert is shown neither to the pull request that made it nor to the one it reverted. A pull request that reverts a revert is shown that the change it brings back was reverted.
- With a second scorer configured, no reverted line is shown, as no other memory line is.
What a revert is to the model
Section titled “What a revert is to the model”Context, never a rule. The rule tells the model that a reverted line is a reason to look closely at a block there and may be a reason that it needs a person, that it is never a reason that a block needs none, that no score may be lower because of it, and that it changes no finding. No floor, finding, verdict or gate reads a record of a revert.
Who can cause one
Section titled “Who can cause one”Whoever writes the first line of a description, including an outside contributor on a fork, once a person with write access merges the pull request. The line that counts is the one shown at the top of the pull request, as written, so it names the number the person who merges sees. With auto-merge or a merge queue, the author can still change that line after a person with access enabled the merge, so the line the merge carries may be one no person with access saw.
A wrong reference that is merged records the files of the pull request it names, and later reviews of those files are told they were reverted, which can make a review look more closely there. It cannot add a finding, set a floor or move the gate, and nothing in code reads it into a score.
What reverts cost
Section titled “What reverts cost”- No model call.
- One more database read for a review that asks memory for at least one file: the repository’s live reverts of other pull requests, at most 1,000, newest first, with a statement limit of its own. Beyond that the oldest are left out and the audit records
memory_cutwithrecords. The read is part of the lookup of memory for the score, so one that fails or hangs costs the review that memory, with the status and alert of a failed lookup. Lessons are kept. - About 216 more input tokens in each call of a review that shows a reverted line, by the service’s own estimate.
- One more packing of the files, inside the service and with no call, for a review whose memory has a reverted line beside another line.
- In the learning pass, one more read for each pull request it looks at, of what it reverts. For a merged pull request that names a revert, a second read, of the files of the last review of the pull request it names, even when nothing is then recorded; and up to 300 rows for a revert.
Statements
Section titled “Statements”Owners and repository names are stored in lower case.
-- what stored pull requests say they revertselect number, reverts, state, merged_at from visto_ai.pull_requestswhere owner = 'acme' and repo = 'shop' and reverts is not nullorder by merged_at desc;-- the records of reverts that reviews are told ofselect id, number as reverting, reverted, created_at, expires_at, pathfrom visto_ai.memory_recordswhere owner = 'acme' and repo = 'shop' and kind = 'revert' and status = 'active' and expires_at > now()order by created_at desc;-- switch off every record of one revert: they are in no review from the next one onupdate visto_ai.memory_records set status = 'disabled'where owner = 'acme' and repo = 'shop' and kind = 'revert' and number = 9 and reverted = 7 and status = 'active';-- have a merged revert looked at again by the next pass, once the pull request it names is stored as mergedupdate visto_ai.pull_requests set learned_at = null, learn_attempts = 0where owner = 'acme' and repo = 'shop' and number = 9;Migration for reverts
Section titled “Migration for reverts”Reverts add migration 0012_reverts: a column reverts on pull_requests and a column reverted on memory_records. It is applied whether or not learning is on. An older release refuses to start on a database that has it, and it cannot be rolled back. A pull request merged before the upgrade has no number stored, and is not read as a revert.