fix(wiki): split the reap loop's delete and probe budgets [poller, docs, tests] - #199
Merged
Conversation
… [poller, docs, tests] Split the reap loop's per-run budget in two: deletes stay on MAX_WIKI_DELETIONS_PER_REPO_PER_RUN (5), probes move to the new MAX_WIKI_REAP_PROBES_PER_REPO_PER_RUN (15). The loop now walks the whole orphan candidate list and breaks on whichever budget runs out first, and orphansDeferred reports the candidates it never reached instead of the overflow past the delete cap. 孤児リストは安定ソートされているため、列挙が短いままだと同じ保留候補が毎 run 削除枠を埋め、その後ろに並ぶ「本当に削除された page」が列挙の回復まで到達すら されなかった。枠を分けたことで保留は probe 枠だけを消費する。probe 上限 15 = 最大 30 subrequest で、walk の fetch 予算とは別枠のまま。 Closes #197
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
github-rag-mcp | 9cd72cb | Aug 02 2026, 07:19 AM |
…ld-reap-candidate-consumes-a-delete-slot-and-can-starve-real-deletions # Conflicts: # docs/installation.ja.md # docs/installation.md
liplus-lin-lay
commented
Aug 2, 2026
liplus-lin-lay
left a comment
Member
Author
There was a problem hiding this comment.
Self-review (auto mode, parent agent)
受け入れ条件
- 保留候補が先頭を占めた状態で、後ろの実削除が同一 run で行われる — 満たす。追加テスト 1 本目が live 5 件を
z-really-deletedの前に並べ、removed: 1/orphansWithheld: 5/orphansDeferred: 0を固定。旧実装ではこの構成が毎 runremoved: 0を返していた - per-run の probe 回数に上限があり、テストで固定されている — 満たす。2 本目が live 20 件に対し wire 上の probe request をちょうど 15 に固定
orphansWithheldとログの内容が従来どおり — 保留 1 件ごとの warn(alive / inconclusive の出し分け)は無変更。サマリ側の warn は文面が変わっているが、これはorphansDeferredの意味変更に追随した必然の変更で、旧文面のままだと「deferred」の語がログと実態でずれる。受け入れ条件 4 と両立させる唯一の形なので逸脱とは見なさないorphansDeferredが「この run で到達しなかった候補数」を表す — 満たす。orphans.length - probes。probes++はprobeWikiPageAlive呼び出しの直前に無条件で置かれているので、到達した候補は必ず probe を 1 消費する = probe 数が到達数に一致する
制約
gone以外は削除しない(#187) — 判定部は無変更- probe の per-run 上限 —
MAX_WIKI_REAP_PROBES_PER_REPO_PER_RUN = 15。probe は 1 候補あたり最大 2 subrequest なので上限 30、削除の fan-out が最大 5 × 約 4 = 20。walk の fetch 予算とは別枠で、invocation あたり 1000 に対して十分内側 - 保留の可視性 —
orphansWithheldと per-candidate ログは維持
実装の確認
ループ全体を走査して removed >= deleteBudget || probes >= probeBudget で break する形になっており、保留が削除枠を消費しない。候補リストを全部消化した場合は probes === orphans.length なので orphansDeferred は 0 に落ちる。
既知の境界(欠陥ではない)
probeBudget は WikiPollOptions に露出していない。現状 deleteBudget を上書きする呼び出し元が無いため実害は無いが、将来 deleteBudget > 15 を渡す呼び出しが出た場合、probe 枠が実効上限になる。その時点で option 化を判断すればよく、本 PR で先回りする必要はない。
scope からの逸脱
なし。PR #198 が同じ 6 ファイルを触った状態で main に入ったため origin/main を branch へ merge して解消しているが、衝突は installation docs の隣接する箇条書き 2 本のみで、両方を残す形で解決されている。src/poller.ts は自動マージ。
次のステップ
auto mode につき human gate なし。self-review pass → merge。
liplus-lin-lay
deleted the
197-specwiki-a-withheld-reap-candidate-consumes-a-delete-slot-and-can-starve-real-deletions
branch
August 2, 2026 07:20
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.
Closes #197
孤児削除で保留(withheld)になった候補が削除枠を消費していたため、安定ソートされた候補リストの先頭を保留が占め続ける間、その後ろに並ぶ「本当に削除された page」が列挙の回復まで到達すらされなかった。削除枠と probe 枠を分け、保留は probe 枠だけを消費するようにした。
MAX_WIKI_REAP_PROBES_PER_REPO_PER_RUN(15 = 削除枠 5 の 3 倍)を新設orphans.slice(0, deleteBudget)をやめて候補リスト全体を走査し、removed >= deleteBudget || probes >= probeBudgetで breakorphansDeferredを「この run で到達しなかった候補数」に合わせた(到達した上での保留は従来どおりorphansWithheld)