← Back to Pull requests

redline: past two request-changes rounds a head is read only with an approving local review on record #266

Merged
askalf merged 8 files (650 lines) on Nov 30, 2026 23:45 UTC
View on GitHub
askalf askalf commented on Nov 30, 2026 04:03 UTC
Author

Where a host sets REDLINE_LOCAL_READS to a directory, the review holds a first-party pull
request after two request-changes rounds: a new head is read only when an approving local review
of that very commit is on record in the directory. With the setting unset there is no hold.

With the setting unset nothing else changes: the round count, verdict.json and the cap notice
are as they are on main.

WHY

Of 54 reviews here that asked for changes on 19 merged pull requests of this organisation in five
days, 30 were on three pull requests. local.mjs read runs the same review, on the same models
and prompt, before a push, and its rounds cost no round in CI. Nothing made a push wait for it.

WHAT CHANGES

  • review.mjs

  • - holdApplies: the hold is asked of a head when a directory is set, the pull request's
    author_association is OWNER, MEMBER or COLLABORATOR, it has had HOLD_AFTER_ROUNDS (2)
    rounds or more, and the round cap has not been reached.
    - approvedLocally: the record is <directory>/<full sha>.json, a regular file of at most
    4,096 bytes holding {"version":1,"head_sha":"<this sha>","verdict":"APPROVE",...}. It is
    opened with a link refused at open (O_NOFOLLOW) and without blocking, and what was opened is
    what is measured and read. A system with no such flag takes no record at all: every head
    past two rounds is held there, and the log says why. A file that is there and is not a
    record is not taken; the log names the file and why, never its content. No file is no
    record and logs nothing.
    - Rounds are counted as for the round cap (roundsAsked, unchanged): the larger of the heads
    the history shows and the count a notice there states. Its limits come with it, and the
    README lists them: (1) after enough held pushes for a pull request's first requests to
    leave the 40 verdicts a run reads, the count the round cap is compared with can come out
    lower than the rounds there were (the notices still state two or more, so a pushed head is
    still held without a record); (2) a run's verdict stands at the time its run was made, and
    a run GitHub runs again keeps that time; (3) a dispatch with reread reads a head whatever is
    on record.
    - A verdict standing at a head the branch moved back to is reused, and the run writes it to
    its own verdict.json with standing_since, the time it was first given (verdictRecord,
    checked by verdictProblem); verdictAsReview reads it back at that time (standsFrom).
    Dated by its own run, a reused approval cleared the requests made since it was given (the
    next head was read without a record), and a reused notice carried its count past an
    approval given since (the next head was held with no round asked).
    - A held head gets the round cap's notice at two rounds with no model call. renderCapBody
    adds one sentence to the notice's first paragraph: what the cap is without a record and
    with one, and that the next commit should be reviewed before its push. The paragraph still
    opens as every cap notice does and the rule line is rule:round-cap, so what reads a cap
    notice (isCapNotice, capNoticeRounds, capNoticeQuote here, and a caller's own readers)
    reads this one as one. The result carries held: true and the run's last line says "the hold
    for a local review".
    - A dispatch with reread reads a held head. At the round cap the cap's own notice is given,
    with or without a record. A round cap of 2 or less is the cap, not the hold. A round cap of
    0 turns the cap off and not the hold: a first-party head with no record is still held after
    two rounds, and the notice says there is no cap for a head with a record.
    - withModelsFile takes REDLINE_LOCAL_READS from the models file over the env file's, as
    written. Each reader judges the value left after that (localReadsDir): when it is set and
    is not an absolute path, main ends a review in CI, and local.mjs review goes on and
    leaves the approval off the record.
  • local.mjs

  • - review (the host side) puts an approval on record: recordLocalApprove writes the record
    under another name, gives it to the directory's group and sets mode 0640 past the umask, both
    on the open file and never by its name, and moves it into place. The move, and the removal
    after a failed step, are by name. A request for changes writes
    nothing. A directory that is missing or cannot be written, a group the writer may not give
    a file to, or a setting that is not an absolute path, leaves the review and its exit status
    as they are; stderr says the approval is not on record. stdout stays the review alone.

    UNTRUSTED INPUT AND WHERE IT GOES

  • author_association: GitHub computes it; a pull request's author cannot set it. A value that

  • is not one of the three, or missing, means no hold (the round cap still applies).
  • The head sha in the gate: from the workflow's input, already checked against the pull

  • request's head; approvedLocally takes only 40 lowercase hex characters, so the file name
    cannot leave the directory.
  • The directory: the host's. Who can write it is the host's operator, through local.mjs review

  • or by hand. Its content is read as JSON of at most 4,096 bytes and compared field by field;
    nothing in it is run, printed or sent to the model. A false record buys one thing: the head is
    read, by the same review as any head. A record that cannot be read fails closed: the head is
    held, and a dispatch with reread reads it.
  • The head sha in local.mjs review: the pack's own word, checked to be a full sha

  • (checkChange). The host does not compare the packed tree with it. Whoever can run the review
    on the host can therefore put any sha on record, which is the same power as writing the
    directory.
  • The setting itself: from the host's env file or models file. It reaches a log line (the

  • directory's path) and the file names read and written.
  • Not covered: a pull request author who is first-party and cannot reach the host (a session

  • with no access to it) is held after two rounds until someone with the host reviews a commit
    or dispatches a reread. That is the rule's intent, and it is why the hold is off until a host
    turns it on.

    TESTS

    Counts are from the last run on Linux; on a Windows checkout review.test.mjs has the same 2
    failures as main and the Linux-only checks (links, modes, groups) are skipped.

  • review.test.mjs: the hold at two and three rounds with and without a record; each

  • association; no directory; one round; a re-read (read, and the record not opened); dry run;
    no reviewer token; at the round cap with and without a record; a round cap of 2 and of 0;
    the notice compared whole up to the quoted request and read back by isCapNotice,
    capNoticeRounds, capNoticeQuote and the two patterns a caller reads a cap notice by;
    approvedLocally one file at a time (another verdict, sha, version, null, a list, not JSON,
    empty, one byte past the size, exactly the size, a directory, a link, the flags it opens
    with, a system without the flag: nothing taken and nothing opened); a hold notice counted as
    a cap notice is; a window of hold notices with two heads read after it (the stated limit); a
    window of nothing but copies of one notice; a notice standing at its head reused and written
    with the time it was first given; the branch moved back to an approved head after two
    requests and to a held head after an approval, each with and without that time; standsFrom,
    verdictRecord and verdictProblem; the models
    file and the env file settings, and a run ended by a relative path in either. On a system
    without the flag the tests give it as one that asks for nothing, so the rest run there.
    post.test.mjs and fix.test.mjs pass unchanged.
  • local.test.mjs: recordLocalApprove and its round trip through approvedLocally; mode 0640

  • under a umask of 077; the record given to the directory's group; a refused group change
    (injected) leaves nothing; a name another writer holds is left alone; a link put under the
    other name between the write and the group and mode changes does not reach its target; the
    review command against a stub model: request changes writes nothing, an approval is recorded
    where the env file, the models file or the environment says, and a missing directory or a
    relative path leaves the review standing.
  • Each of 40 mutations of review.mjs and local.mjs fails a named check with its suite running

  • to its end (run on Linux): the count the hold starts at, who is first-party, each condition
    of the hold, each field and limit of a record, the flags it is opened with, a system without
    the flag, a re-read (read, and the record not opened), the notice's sentence, the time a
    reused verdict stands at, the settings from each source, and each step of writing a record
    (the group and the mode on the open file, the move into place, the cleanup).

    AFTER THE GATE'S FIRST TWO REVIEWS

  • The record's group and mode were changed by the other name after the file was closed, so

  • another writer of the directory could put a link there and have a root writer change a file
    of its choosing. Both are now changed on the open file. The test puts a link under the name
    between the write and the changes and checks that its target keeps its group and mode.
  • The round count: the reviews found cases where a count taken from the order of verdicts in

  • time went wrong (a run made early and run again later; a verdict reused at its head and
    written into a later run). Each fix drew another case of the same ordering, which main has
    as well. By the operator's choice the count is now main's, unchanged, and the window limit
    above is stated instead. The cap notice is as on main. One piece of the earlier version came
    back after a read before the push: a verdict reused at a head the branch moved back to keeps
    the time it was first given (standing_since), so a reused approval or notice keeps its
    place; with the count as on main nothing else reads that time.
  • The README now says the value of REDLINE_LOCAL_READS judged is the one left after the models

  • file is laid over the env file.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: None requested Review duration: 1181m
    All Vouch review confidence checks passed
    Residual risk 0.38 = Change Risk (0.64) × (1 − Review Confidence (0.40)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.64 · 650 lines diff across 8 files
    0.64
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 10%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    No Reviewer Assigned no_reviewer_assigned
    0.120
    Real PR Conversation Timeline
    1 comments
    "Review active on #266"
    general weight: 0.35
    Reviewers
    None requested
    Assignees
    askalf askalf
    Labels
    risk: medium confidence: 40.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 64% (MEDIUM) · Higher = larger blast radius
    64%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.5% · Lower = rushed or shallow review
    40.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 38.1% · Moderate risk
    38.1%
    Repository