Skip to content

fix(code-index): keep the reader charge on both publication tails - #1873

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
fix/code-index-worker-isolation
Sep 20, 2026
Merged

ScriptedAlchemy merged 1 commit into
masterfrom
fix/code-index-worker-isolation

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Ports the reservation shrink from #1840 onto master, on both publication tails, and leaves the rest of that PR out.

Both publication tails in serving.rs released the build's resident-memory charge and then asked the ledger for a fresh reader charge. ProcessResidentMemoryV1::reserve refuses any request above the 8 MiB pressure floor while the over-budget latch is set, and releasing a ledger charge does not lower measured RSS, so the release could not clear the latch the new reservation needed. A finalized artifact then had owners that could never be installed. The ledger now has transfer_component, which re-keys retained bytes from the build component to the reader component without a fresh admission, and both tails use it. begin_clone_successor charges the larger of the successor and reader budgets so the second tail has enough to hand over; its working set is unchanged.

transfer_keeps_retained_bytes_when_a_new_admission_cannot asserts both sides against one ledger state: a fresh reserve of the same bytes is refused with ReservationCeiling and the transfer succeeds. The seated-owners assertion in the code-index serving tests now requires the reader charge to equal the reader budget exactly, which catches a shrink applied to one tail or one that keeps the build key.

No in-process test reproduces the refusal at the call sites, because reserve_resident_memory_up_to re-samples real process RSS on every reservation and overwrites synthetic pressure; the mechanism is argued from the code and pinned at the ledger.

Left out from #1840: the dedicated worker runtime. It is compiled under cfg(not(test)), so no test can fail without it; its own commit message says it hit the 360 s deadline when many registries shared few threads, which is the daemon's shape; and the worker already offloads heavy work through spawn_blocking, so starving it needs some other component to block the shared runtime, which moving one victim does not address.

🤖 Generated with Claude Code

Both text-artifact publication tails released the charge they already
held and asked the process authority for the reader again. `reserve`
re-samples measured RSS and refuses every admission above the 8 MiB
pressure floor while the over-budget latch is set, and the reader
budget is 256 MiB. Releasing a ledger charge does not lower measured
RSS, so the release cannot clear that latch: an overlapping graph
replay sitting on the watermark turns a finalized artifact into a
generation that can never seat its owners.

`ResidentMemoryReservationV1::transfer_component` renames a held
charge and shrinks it under one lock, which asks for no admission.
Both tails hand their charge to the reader that way. The clone
successor now holds at least the reader budget so its tail has
something to hand over; its working set is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a4318a6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-20T03:20:50.283226Z a4318a6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ScriptedAlchemy
ScriptedAlchemy merged commit 09ef75e into master Sep 20, 2026
25 checks passed
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.

1 participant