Repository navigation
Keep App Server keepalive pongs readable behind a notification backlog - #5413
Merged
Merged
Conversation
The hosted follower folds each App Server notification before receiving the next, so a burst waits in the websockets receive queue. At its default bound of 16 frames the library pauses socket reads, so pongs queued behind the burst go unread and the keepalive closes the connection with "1011 keepalive ping timeout" though the App Server answered. Lift the bound on the connection `app_server_connect` opens; the server is local and trusted. The new test fails on the old default (the ping is never acknowledged before the application drains the queue) and passes with the bound lifted. Refs #3895
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_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lifts the websockets receive-queue bound on the App Server connection (
app_server_connectinsrc/leaf/codex.py), the candidate repair for the hosted1011 keepalive ping timeoutfailures in #3895, shipped on the maintainer's decision there to judge it by the next two days of publish runs.The follower folds each notification before receiving the next, so a burst of them waits in the client's receive queue. At websockets' default
max_queueof 16 frames the library pauses socket reads once the queue fills, so the pongs behind the burst go unread and the ping timeout closes a connection whose server did answer. Withmax_queue=Nonereads never pause, and the backlog is held in memory instead. The App Server is a local, trusted process, so unbounded buffering costs nothing a user relies on. This removes one way the keepalive can fail; it does not explain the 33–85 second delayed observations recorded on the issue, which stay open there until the publish lane shows whether they stop.The new test
test_a_backlog_of_notifications_leaves_keepalive_pongs_readablesends 64 notifications before the client reads any, then pings. It failed on the old default (the ping went unacknowledged for 30 s) and passes with the change. The rest oftests/model/test_codex_app_server.pyandtests/process/website_server/test_turn_follower.pypass, apart from four Unix-socket tests that fail the same way without this change: this sandbox can't createAF_UNIXsockets.Refs #3895