Skip to content

fix: check the diff refresh test's gutter pairing on the drawn rows, not the widget's private file entries - #5374

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-5166
Nov 4, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-5166

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

#4873 moved each diff file entry's drawn lines from entry.lines to entry.rendered.lines (FileEntry in packages/diff/widgets/lf-diff.js), but the gutter probe in test_a_diff_refresh_keeps_a_selection_in_unchanged_lines still read entry.lines. Its page.evaluate therefore threw TypeError: Cannot read properties of undefined (reading 'map') before checking any row, as in push run 41576718956.

The probe no longer reads the widget's private fileEntries records, so a reshaping of them can't break it again. It reads each drawn .lf-diff-line row of the diff and asserts there is at least one, and that each row holds exactly one numbered control, followed by a source line whose data-lf-datum names the number the control shows (the new number for a context line), with the row's line type matching the line's. The selection-refresh journey is unchanged, and the widget is unchanged.

On current main the test fails with the reported TypeError; with this change it passes locally (uv run pytest tests/browser/widgets/test_diffs.py::test_a_diff_refresh_keeps_a_selection_in_unchanged_lines), and fails when the expected number is taken from the wrong datum field.

Closes #5166 — automated triage

…ion refresh test

#4873 moved each file entry's drawn lines from `entry.lines` to
`entry.rendered.lines`, but the gutter probe in
test_a_diff_refresh_keeps_a_selection_in_unchanged_lines still read the old
field, so its `page.evaluate` threw "Cannot read properties of undefined
(reading 'map')" before checking any row. The probe now reads the current
field; the behavior it protects (a selection and each row's gutter pairing
surviving a refresh of another hunk) is unchanged.

Closes #5166
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The new field exists and clears the TypeError, but the test still depends on the private FileEntry shape that caused this failure. The base tests/AGENTS.md rule for a test broken only by the shape it reads asks us to simplify to the user behavior, move to a lower boundary, or delete it. Please keep the selection-refresh journey and inspect the rendered diff rows and their gutter labels/pairing directly, asserting that the observed rows are nonempty, instead of reading widget.fileEntries and renderer line records.

This was written by Codex on behalf of max-sixty

The probe no longer reads the widget's private FileEntry records, whose
reshaping (#4873) broke it. It checks each drawn .lf-diff-line directly:
one numbered control, followed by a source line whose datum names the
number the control shows, with the row's line type matching.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Done in a5a8ca7: the probe now reads the drawn .lf-diff-line rows through a locator instead of widget.fileEntries. It asserts at least one row, and per row exactly one .lf-diff-line-comment followed by the source line, the label equal to the number in that line's data-lf-datum, and matching line types. The test passes locally, and fails if the expected number is read from the wrong datum field. The PR description is updated to match.

@leaf-agent leaf-agent changed the title fix: read a diff file's drawn lines from entry.rendered in the selection refresh test fix: check the diff refresh test's gutter pairing on the drawn rows, not the widget's private file entries Nov 4, 2026
@leaf-agent
leaf-agent merged commit 0da1f29 into main Nov 4, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5166 branch November 4, 2026 15:51
max-sixty added a commit to max-sixty/tend that referenced this pull request Nov 5, 2026
…other bots' heads for landing (#1652)

Leaf, the only consumer that sets `workflows.review.await_ci: false`,
has landed reviewed heads a median 2.4 minutes after their CI settles
over tend-land's first 20 days (p95 6.5 min, n=533). The shortfalls were
in the sessions around tend-land. This PR fixes four of them, building
on #1648's **Which heads to poll** rule.

## Every session is told the wait is off

Only the review, triage and land prompts carried the sentence "The
review's CI wait is off". Mention, notifications, nightly, weekly and
review-runs sessions never saw it, so they kept owning a bot PR's CI as
`run-tend` says. On Leaf's first 50 hours on Claude, 16 of 60 mention
sessions polled, 13 of them on bot PRs. 31 of 115 repair sessions found
that the pushing session, still polling, had already fixed the red.

The generator now passes the fact to each agent step as an `await_ci`
action input. `_prompt.render` states it once in the shared system
prompt, beside the merge mode, and the appended prompt sentences go.
`nightly`'s hard-coded poll now defers to `monitor-ci`. A focused eval
states the fact per situation, so `evals/prepare.py` renders it empty
there.

## A push to a human's PR stays with the session that made it

Once told, sessions read `run-tend`'s handoff as covering any push and
stopped polling on a maintainer's PR, where tend-land repairs nothing.
`run-tend` now says tend-land repairs only a PR with no human author,
and that a push to a human's PR stays with the session to poll, except a
review's own fix, which **Without the CI wait** in `approving.md`
already hands to the review queued behind it.

Replays of real Leaf mention sessions on Opus 5.5, each cut just after
its push and resumed with `gh` and `tend` stubbed offline, three runs
per session. Runs that polled CI afterwards:

| | Bot PRs (max-sixty/leaf#5374, max-sixty/leaf#5413) | Human PR
(max-sixty/leaf#5370) |
|---|---|---|
| #1648's rule, no sentence | 5 of 6 | 3 of 3 |
| The rule and the sentence | 0 of 6 | 0 of 3 |
| Both, with the `run-tend` clause | 0 of 6 | 2 of 3 |

The run that still stopped on the human PR took recording the push to
mean tend-land owned it. A red head there still reaches its author.
Three runs show a difference, not a rate.

## A head on another bot's PR can be recorded for landing

`land-pr intend` required this bot's push record, which a Dependabot or
Renovate head never carries. When CI outlasted the review, nothing
landed the PR until the daily sweep or a maintainer: 4 of 13 Dependabot
PRs on Leaf waited between 2 and 58 hours. `intend` now accepts a head
on a PR GitHub marks as authored by a bot. A waiting review already
merged these heads once green, so this changes when they land, not
whether. A head a person pushed to this bot's own PR, and a PR from an
automation account GitHub types as a user, still stay with a maintainer.

`review-without-ci-wait` gains a Dependabot session. On Claude, main
records nothing in 0 of 3 runs, each reasoning that the head has no push
record. This branch records it in 3 of 3, passing the case's other
sessions in the same runs.

## The landing session's reads

`merge-pr` told a landing session to leave the PR open "if the base has
changed since". The record holds a branch name, but 23 of 462 Codex land
sessions took it to mean the commit and refused because `main` had
advanced. Nothing wakes tend-land again for that head, so those PRs
waited for something else to merge them. The skill now says the record
names a branch, and that commits landing on it don't count.

max-sixty/leaf#5336 merged past a maintainer's comment: the session read
the thread, met GitHub 502s, and retried for 11 minutes on that read.
The skill now says a 5xx is no verdict, and to re-read the PR before
trying again. Neither wording change has an eval.

## Validation

- `uv run pytest` (all but the two network-bound tests) and `pre-commit`
pass.
- The replays and eval above, on Claude only. Nothing has run live on
Leaf.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diff selection refresh probe maps an undefined value

2 participants