Garry's Opinionated OpenClaw/Hermes Agent Brain
Managed sync and persistence stalls (key files cluster)
Bounded write preparation (#6278: budgets, attempt counter, hard ceiling,
preparation_stalled), claim phases and steps and the persistence_write_stall
doctor check (#6176), releasing a source claimed before activation (#6122), the
concurrent_write sync hold (#6194), Git-scoped writer manifests (#6099) and the
shared Git checkout classifier (#6210). The modules they extend (sync-run,
sync-holds, sync-drain, deactivation, source lifecycle) are in
core persistence and
Google and loops (continued).
The managed sync reliability contract (#6317) adds one consumer per host as a
preference (persistence_consumers heartbeat rows, waiter-only consumers,
persistence.single_consumer), a drain_stalled that can fire on a same-host
owner (owner_wedged_here), movement surfaces (data_moving, doctor
managed_sync_not_moving, gbrain sources writer movement) and the
host_identity_mismatch check; its codes are registered in
src/core/error-registry.ts and pinned by test/error-registry-6317-contract.test.ts.
src/core/persistence/claim-phase.ts— #6176 / #6278: the phase and step a running write request's claim is in.startClaimPhase/enterClaimPhasekeep a per-claimClaimPhaseClockin the consumer (single and group routes);claimPhaseStampis the jsonb every claim, renewal and group dispatch mark stores inpersistence_requests.claim_phase(v217): phasepreparingorpublishing, claim start, phase start, the execution token (so a later claim never reads an earlier claim's ages), thestepin flight and when it began,waiting_onand the owning process (owner: command kind, pid, gbrain build; #6650 boot id, start). Preparers (sync-prepare.ts,page-prepare.ts,prepared-maintenance.ts, link resolution) callenterClaimStep(clock, step, signal, waitingOn)at each await boundary: it names the step, records what the await waits on (git,fs,db,pool, elseunknown: set only where observed, never inferred) and throws the preparation's abort reason, so cancellation reaches a preparer between its queries even though the queries take no signal.claimStateOfreads a row back from the current claim's stamp only:preparing/publishing(live renewal),publication_transaction(claim lapsed while running, read on the database clock: a transaction holds the row or the owner is gone; requeued once it ends),file_publication(publication_started; recovery finishes it) orunrecorded, with claim and phase ages,step,step_age_ms,waiting_on,owner,resumes_on_its_ownand awhy.claimStallis thepreparation_overdueverdict (claim.stall) for a preparing claim past its budget.EXPIRED_PREPARING_CHARGE_SQLis the one rule an expired-claim reclaim charges a preparation attempt by: only a claim stampedpreparingunder the token being reclaimed.persistence.max_claim_ms(default 600000, 60000 to 86400000;validateMaxClaimConfigValueisconfig set'sinvalid_paramsrefusal) is doctorpersistence_write_stall's threshold. Consumer and group-publish store the stamp on every renewal, so writer status (diagnostics.ts,claimon each running blocker, never the token) and doctor name a stuck phase and step without an extra statement per write. Tests:test/persistence-write-stall.test.ts,test/persistence-claim-step.test.ts.src/core/persistence/preparation-budget.ts+src/commands/config/preparation-keys.ts— #6278: how long a claimed write may prepare and how many cut-offs it survives.preparationKindsorts a request intoforeground(remember, andput_page/edit_pagewith no internal intent: the consumer's 30 spreparationMs),sync(managed_sync_*kinds:persistence.sync_preparation_ms, default 120000) ormaintenance(every other kind:persistence.maintenance_preparation_ms, default 120000).persistence.preparation_ceiling_ms(default 600000, 60000 to 3600000, floored at the larger budget plus 30 s) is the hard ceiling for a preparation that ignores cancellation andpersistence.max_preparation_attempts(default 2, 1 to 10) the cut-offs before a request finishespreparation_stalled; a missing or out-of-range value keeps its default (resolvePreparationPolicy). These keys andpersistence.max_transient_retries(transient-retry.ts) ride the write-switch snapshot (switches.ts, one statement, 5 s TTL) together with thepreparation_deadlineskill switch, so a claim never reads config on its own.startPreparationruns a preparer under its budget and the budget wins the race even when the preparer ignores its signal (the signal aborts with{ code: 'preparation_deadline' }; a result that lands after the budget on the clock still reads as a deadline; the late result is the caller's to drop);racePreparationis its outcome-only form for the sync's out-of-consumer preparations (sync-waivers.ts).validatePreparationConfigValueisconfig set's structured refusal (each key's range, and the ceiling rule across the sibling keys; usage error exit 2, nothing written), wired in byrefuseInvalidPreparationValue.persistence.max_claim_mskeeps its doctor meaning. Tests:test/persistence-preparation-budget.test.ts.src/core/persistence/bounded-reads.ts— #6278 (plan item 1.4): a preparation read that can wait on a relation lock ends at the budget on the server. Phase 0 (docs/eval/managed-sync-stall-repro.md) showed that through a transaction-mode pooler gbrain'sstatement_timeoutstartup parameter is dropped, so a preparation read outside the publication transaction had no server-side bound; anACCESS EXCLUSIVElock onpagesheld elsewhere pinned the member's origin check and its connection until the lock lifted, and with the budget alone the released member's statement kept running as a zombie that blocked its root until the ceiling.boundedReads(engine, clock)is the engine view every preparer reads through (prepareManagedSyncMutationand its helpers,preparePageMutation,prepareFactFenceAdoption, the sync's out-of-consumer preparations): each unmemoized raw statement runs withexecuteRaw'stimeoutMsset to the clock's remaining budget (ClaimPhaseClock.deadlineAt, set bystartClaimPhase(now, signal, budgetMs)) and the clock's signal, which ends only the wait for a free connection. On PostgrestimeoutMsruns the statement on a reserved connection asBEGIN; SET LOCAL statement_timeout; <statement>; COMMITin one pipelined round trip, so the bound holds through the pooler andSET LOCALends with it; inside a transaction and on PGLite the option is ignored. A statement the server ends (57014, or a 55P03 raised by a shorter sessionlock_timeout) surfaces as the member's ownpreparation_deadline(PreparationDeadlineError, or the signal's reason once it aborted), whichpreparationAbortReasonclassifies as the deadline: the consumer and the group route handle it as the deadline even inside the budget (charged release,preparation_stalledat the limit, the group cut like the timer), never as astorage_errorreceipt or an uncharged release. The memo rule holds:preparationReadsanswers a bounded read once with the member's bound and signal dropped. #6318: withengineReads(managed sync) other calls run underwithReadDeadline(read-deadline.ts), so the engine's own reads (readPageSnapshot, the import pipeline) getstatement_timeoutat the time left. Tests:test/persistence-bounded-reads.test.ts,test/e2e/persistence-preparation-lock-wait-postgres.test.tsand-engine-reads-lock-postgres(a real lock held in another session), the server-ended cases intest/persistence-consumer-scheduling.test.tsandtest/e2e/persistence-group-deadline-postgres.test.ts. GBRA-75 wave 9:withBoundedReadSessiongives a waiver screen (unchangedSyncImport) one reserved ordinary-pool connection (a long-hold permit; none left, or PGLite, runs the screen as before) on which its bounded reads share one transaction:BEGIN; SET LOCAL statement_timeoutonce,COMMITwhen the screen settles. The bound stays per statement on the server: it is set again in the read's pipeline once the bound in force differs from the read's own by more thanBOUNDED_SESSION_SLACK_MS(25 ms). A waiver run (waiveRuninsync-run.ts) opens one session for all its screens, and a screen inside it joins it. Session reads are named prepared statements (ReservedConnection.executeRawprepare, ANDed with the connection option asrunUnsafedoes). A failed read rolls back and the reads it aborted (25P02) run again in a new transaction; a read after the screen settled takes the per-read path. Test:test/persistence-bounded-read-session.test.ts(real lock wait and no remaining statement on Postgres).src/core/persistence/owner-refusal.ts— #6278: theowner_unavailablereasons matrix.checkOwner(binding, incarnation, hostId)names the first failing condition in a fixed order (binding_missing,incarnation_changed,host_mismatch,transfer_in_progressfor adrainingworktree,clone_in_progressforrecovering,local_path_missing,coordination_path_missing) or returns the usableActiveOwnerBinding;ownerRefusalgives each reason its message,why, actor, fix (always the read-onlygbrain sources writer status --source <id> --json, with the same verify;actor: providerso the two in-progress reasons rendernext: waitwith a 30 s delay,host_adminfor the rest) andretryable(host_mismatchfalse at the site, carried byOperationError.retryable);ownerUnavailableErroris the thrown form.syncOwnerBinding(#7956): the managed sync context's owner gate; the conversion checks its root only past it.host_mismatchprints both host ids' first 8 characters and, whenremoteis false, thehost.jsonpath this process read; nothing here claims or transfers ownership. Used bymaintenancePreflight,loadFenceSourceandmanagedRepairRoot; the registry'sowner_unavailable.reasonsand theFENCE_REASONSowner entries carry the same vocabulary. Tests:test/owner-refusal.test.ts(matrix, every preflight condition on a claimed worktree, the HTTP envelope without a local path),test/fence-repair-reasons.test.ts.transfer_in_progressiswaituntil the drain'sprepared_atisTRANSFER_STALE_MINUTES(30) old, thenask_usernaming the accept and the exacttransfer cancelargv (a drain with noprepared_atkeeps the wait).src/core/persistence/repair-busy.ts— #6278: the busy set a repair must not write while a managed sync runs.loadRepairBusySet(engine, sourceId, incarnation)returns the paths and slugs named by queued, running and recovering requests and terminal rows with an open recovery (both rename endpoints included) plus, for every unfinishedmanaged-synccursor of the incarnation, the entries of its frozenmanaged-sync-manifestfrom the cursor's index on (a path with async-holdrecord is left out: the sync retries a held file only when its bytes change); it never throws and fails closed (unknownset, sorepairBusyanswers true for everything) when a query fails or a cursor's manifest is missing.repairBusyMessageis the hold text,repairBusyErrorthesync_in_progressrefusal (reasoncandidate_in_flightorbusy_set_unreadable)submitManagedFileRepairraises at admission. Tests:test/repair-busy.test.ts,test/repair-fences.test.ts,test/repair-fences-during-catchup.test.ts(Postgres:test/e2e/repair-fences-during-catchup-postgres.test.ts).src/core/persistence/consumer.ts— resident canonical-write consumer with retained wake-ups, root-scoped retry backoff and locked-row-skipping expired-claim sweeps. A full tick fans out to every worker; when idle, each tick instead runs one work probe (a single statement, + the 5 s #6650 dead-owner scan, mirroring the claim, recovery, expired-claim, effect, projection (inline rows windowed byprojection-window.ts) and topology predicates, excluding rows those workers would skip, including topology recoveries that failed to finish within the last 30 s) and the poll interval doubles from 250 ms to a 5 s cap (idleMaxMs), resetting on work.wake()runs a full tick immediately;waitForWritecalls it after a same-process admission commits, so cross-process writes wait at most 5 s plus one probe and no LISTEN is used. #5984:awaitWrite(waitForWriteis its row-only form) receives a request this consumer publishes through theonSettledhandoff with no request read, and skips polls whileholds(id)says the consumer has it claimed; otherwise it polls the narrowWRITE_PROGRESS_SQL(first poll after min(200 ms, half the wait), then 50 ms backing off to 250 ms) and reads the full row once when terminal. Its own cancelled reads are not failures; a database read failure ends the wait as a classifiedread_failed(auth/permission failures at once), and a pending head with an interventionblocked_reasonends asblocked. A probe failure is reported once and the next tick runs the full fan-out. On Postgres pools of three or more with no connection checked out, idle probes share one reserved connection from the ordinary pool, never the direct/session route (acquired and queried under the phase deadline; a timed-out lane returns to the pool once its query settles) so the rest of the pool drains through the 20 sidle_timeout(postgres.js reuses idle connections first-in-first-out); root refresh and receipt compaction run every 5 minutes while idle. Root refresh, recovery scan, sweep and capacity-marking SQL use cooperative five-second cancellation; failure never admits work under stale confinement. Cold direct initialization and queued transactions remain observed and awaited through shutdown. Recognized cancellation owned by the consumer's stop reason is not reported as a storage failure; deadline-first cancellation and unrelated storage errors remain visible. The rate-limited stderr line names the phase, the SQLSTATE or write-error code, a redacted one-line message of at most 200 characters, connection-wait evidence (first_conn_ms, orcheckout=not_observed conn_wait_ms, attributed to the phase through AsyncLocalStorage over the engine'sonCheckoutseam) plusloop_lag_ms, a fix command and its docs anchor (docs/ENGINES.md#persistence-consumer-log); the trusted statusphasecarries the same fields. Every claimed write has a preparation budget (preparation-budget.ts):executeraces the preparation against it (startPreparation), so the claim is released withblocked_reasonpreparation_deadlineand one counted attempt at the budget even when the preparer ignores its signal, and a late result never publishes (the execution-token fence). A request already atpersistence.max_preparation_attemptsis finishedfailedwithpreparation_stalledat claim without preparing again, and the release that reaches the limit finishes it there (coordinator.tsfinishPreparationStalled; a waitingawaitWritecaller gets the terminal receipt, foreground writes included); a preparer's rejection on the consumer's own abort (its reason, anAbortErroror a cancelled statement,preparationAbortReason) is a release, never a receipt. The expired-claim sweep (Postgres, and PGLite'sreleaseAbandonedClaims) charges one attempt for a claim stampedpreparing(a process killed mid-preparation);claim_lost,consumer_stoppingandgroup_member_waitingnever charge, and a commit resets the counter. A statement the database ended with 57014 (statement timeout or cancel:coordinator.tswriteInterruption) is charged too, infinishUnpublishedFailureand inpublishMutation's recovery route, and at the limit ends the requestfailedwithwrite_interruptedinstead of adatabase_contentionrelease; contention with other transactions (55P03, 40001, 40P01), a dropped connection or a restarting database is never charged (test/persistence-write-interrupted.test.ts). The #5373 root barrier for an abandoned preparation ends atpersistence.preparation_ceiling_msmeasured from the claim: the root is freed, the counter is pinned at the limit (an overrun proves cancellation is ignored, so the next claim fails the requestpreparation_stalled) and the zombie stays instatus().outlived_ceiling; at the per-process cap (zombieCap, default 1) the consumer claims nothing more andstatus().restart_requiredis true.stop()gives abandoned preparationsABANDONED_STOP_GRACE_MS(5 s) after aborting them instead of waiting forever. The fault pointconsumer:preparingsits inside the budget,status()reportspreparation_policyandabandoned_preparations, and the stderr line carriesphase=preparation reason=deadline_exceeded | preparation_stalled | ceiling_exceeded. With thepreparation_deadlinesswitch off onlyrememberand intent-lessput_page/edit_pagekeep the 30 s budget, the old unbounded wait applies and no attempt is counted. Publication and shutdown retain the token/native-lock/recovery barriers. Trusted status exposes sampled process-local phases and attempts, not durable progress. A tick woken by a completed publication or a local admission claims the next write at once and runs root refresh plus recovery, expiry and topology scans at most once per poll interval; explicit, timer and idle-probe ticks always scan. Effects drain in batches of 20 without waiting for the next tick while full batches keep arriving; within a batch, git effects wait for their asynchronous durability probe (one per worktree root) after the other effects, and a single-file git effect in a repository without the durability hook acquires the worktree lock only to prove its root and records its outcome after releasing it. Each projection-worker invocation (runResidentProjectionInvocation, #5401) rebuilds up to 100 pages and starts no new page once 250 ms have passed since it began; whenhasClaimableWrite(theclaimableWriteSqlpredicateclaimNextWriteclaims with, injournal.ts) finds a claimable write at its start it takes 2 pages, and its selector skips failed rows for 30 s through the samePROJECTION_RETRY_READY_SQLfragment as the idle probe (PGLite, 1,000 pages: ~9.5 ms mean, ~18 ms p99 per page). On PGLite the first full tick releases claims last written before this process started (releaseAbandonedClaimsineffect-journal.ts: running effects and unpublished requests without a recovery record), since the datastore admits one process and those owners have exited; #9227: only while the engine holds the datastore lock (abandonedClaimCutoff), and the idle probe counts such claims as work until released; Postgres keeps lease expiry (requests 30 s, effects 2 minutes); a provably dead owner's claim goes in 5 s (#6650). On PGLite, which has no autovacuum, the maintenance worker also runsvacuumPersistenceQueues(VACUUM ANALYZE of the queue tables) every minute or after 50 + 20% of the request table's rows in publications. Tests:persistence-consumer-scheduling.test.ts,persistence-consumer-idle.test.ts,persistence-consumer-log.test.ts,projection-drain.test.ts(injected clock and per-page cost),persistence-root-refresh.test.ts,test/e2e/persistence-phase-liveness.test.ts,test/e2e/persistence-idle-pool.test.ts. WithrequestsOnly(engine graduation's drain) the effect, projection, topology and maintenance workers never start; claim, recovery, expired-claim and publication run as usual andstop()remains the barrier. Both the single route and the grouped/lane route (executeClaimedGroupingroup-publish.ts) prepare under a claim lease (claim-lease.ts: a renewal everyrenewalIntervalMs, default 10 s, each bounded byphaseMs); the claim is lost the first time a renewal says it is gone, throws or overruns, andwhileHeldstops waiting on the preparation at that moment (the single route also aborts it). The claims still ours are released unpublished withclaim_lost(token-fenced, so a consumer that took one over keeps it); the abandoned preparation is never published and keeps its root or lane slot until it settles or the ceiling passes, while the consumer slot frees at once. Renewals are never awaited on the way out:stop()drains in-flight renewals and gives abandoned preparations their grace before engine close. Tests:test/persistence-claim-lease.test.ts,test/e2e/persistence-consumer-claim-loss.test.ts,test/persistence-preparation-kill-accounting.test.ts,test/e2e/persistence-preparation-deadline.e2e.test.ts. #6355:onLanelends its warm lane's transaction through a wrapper that notes a connection loss (isConnectionLoss); infinallya lost lane is released andidleLaneRetryAtset a minute out, whateverrunreturned or threw (admission turns the loss intowrite_outcome_unknownor succeeds on the pool, so the catch alone never saw it), because the dead reservation answers every later statement with "Connection is no longer owned" (test/persistence-consumer-lane-loss.test.ts). #7106:publishSinglepassesprojectionPending(coordinator.tsPublicationHooks): a committed write that created its page (no page at its slug before the publication, and no additional page key such as a rename's) and whose outcome saysprojection: 'pending'(a new segmented page over SEGMENTED_CREATE_SEAL_MAX_BYTES, quarantined or not:segmentedOutcomein searchable.ts, recorded by the managed import, sync and put_page preparers) settles its waiter at commit, and itsafterCommitprojection goes todetachBuild, which runs at mostDETACHED_PROJECTION_BUILDS(1) at a time, queued builds in order, each tracked inoutlivedso stop() waits for queued and running builds; it holds neither the reply nor the root. An edit (a deferred retirement included) and a publication without the hook await afterCommit as before (test/large-pages/managed-import-projection-pending.test.ts).src/core/persistence/sync-group.ts+group-publish.ts— #5984 bulk publication for draining managed Postgres syncs.sync-group.tsresolves bulk settings (--no-bulk>GBRAIN_SYNC_BULK>sync.bulk> on;sync.bulk_size16,sync.bulk_max_txn_ms15 s; PGLite off), sizes the next group from the last group's admission-to-commit time per member, freezes followers (four at a time, stopping at a rename, company plan, overtaken or waived entry, or #6712 a slug or page id shared with a member in flight or held,dependencyKeys) and admits a group in one transaction (admitWriteGroupInTransaction, which keeps one request row, ID and digest per page and replays priors).sync-run.tskeeps the head inpendingand all members in the cursor'sgroup(members carryintent.group= the head's request ID), waits for the last member and advances over the committed prefix; a terminal failure becomes the pending entry (settled by fault class; later members stay in the window, #6712), a still-pending member returnswriter_pending. Any caller finishes an existing group; only a drain forms one. #6075: when another owner loop already admitted the group's head on the single path with the head's pre-group intent (the intent minus thegroup/lanekeysformGroupadds,groupedIntent/ungroupedIntent),groupStepdrops the group and the single path takes that request, and the never-admitted followers are frozen again; a different intent under the head's request ID still refusesidempotency_conflict. The single path's ENG-A7 admission guard compares the stored pending intent as well as its request ID, so a pass that read the head before a drain grouped it re-reads the cursor instead of admitting the stale intent, and anidempotency_conflictagainst a head the group admitted first re-reads the cursor too (test/managed-sync-stale-group-head.test.ts). The consumer claims a head's directly following queued members (claimGroupFollowers, never past an unfinished non-member) andexecuteClaimedGroupprepares four at a time, thenpublishGrouppublishes them in one transaction: one worktree lock, ownership guard and coordinated write (each member set as the attributed actor withsetMemberAttribution), per-member authorization, preimage read, sync validation (its source-wide part shared per transaction), apply (which reads the postimage the receipt and effects use), effects and receipt;completeGroupthen reads every member's effect bytes, and pipelines the counter lock with oneUPDATE ... FROM unnest(...) RETURNINGthat checks each member's claim and terminal reservation and releases the counters (a shortRETURNINGthrows, so the single path reports each member's own code). #6712: each member keeps its own fate (sync groups keep claim 64, width four, ordered release,syncGroup): a failed preparation settles before the rest publish as a group; a sync member its lane group's transaction refused settles alone, the rest requeue (settleCulprit); other failures roll back and members publish singly. Sync validation accepts a group member through the cursor'sgroup. #6007: the pages of oneput_pagesbatch (intent.page_batch.id; the group key isjournal.tspublicationGroupKey) and the files of one managed import batch (intent.import_batch, keyimport:, grouped on PGLite too;independentGroupnames both) also publish as groups of at mostPAGE_BATCH_GROUP_MAX(8) pages, prepared all at once, files included: one transaction records every member's recovery record (prepareRecoveries) before any file is touched, the publication transaction marks the memberspublication_started, publishes each member's file before its apply and re-arms the batch's mention links once after every member completes (reconcileFinishedBatch), and one transaction clears the records after commit (clearResolvedRecoveries). A single foreground page write publishes here too, as a group of one (core-persistence-continued.md,switches.tsentry). Within that transaction the source's local path, the owner's host binding and config values are read once per group (source membership and the writer registration are already memoized per transaction bytransactionMemo). On failure every file the group published is restored byrecoverPublication, which requeues those claims; the fallback claims them back in order (reclaimReleasedWrite) and publishes the members singly. Each member has its own preparation budget (#6278):executeClaimedGroupmarks a wave durably (markDispatched) and starts each member's clock when the wave dispatches it, so a follower waiting behind four others is never charged; the lease renews the mutable set of members still held (renewGroupClaimsstamps each member's own phase), so releasing one member never reads as a lost group lease. When member k's budget passes, nothing later is dispatched, the in-flight suffix is aborted, k is releasedpreparation_deadline(charged; finishedpreparation_stalledwhen that reaches the limit) and the later membersgroup_member_waiting(not charged), and the contiguous prepared prefix 0..k-1 publishes (singly when shorter than two; under lanes in the original group's key order). Aput_pagesbatch group releases only k,laneFallbackkeeps the expired member's reason, and an abandoned member's preparation goes to the consumer with its clock, so the root waits for it until it settles or the ceiling. A member's signal reaches its preparer through its clock (enterClaimStep), never as a blanket statement signal:preparationReadsandgroupReadsanswer one read for every member (GBRA-75 wave 10:preparationReadsanswersgetConfigfrom onegetAllConfigper group; an import group's members also read their own{ sourceId, includeDeleted: true }snapshot from one batch and coalescefindDuplicatePageinto onefindDuplicatePagesstatement throughimport-reads.ts, and the group's preparation runs insidewithScreeningPaths; publication'svalidate/checkPathsrun after it, unmemoized) and skip their memo for a signalled statement, so a member that must give up on a shared read races its own signal against the shared promise (pinned bytest/persistence-preparation-memo-rule.test.ts). A commit resetspreparation_attempts(completeGroup). Tests:test/managed-sync-bulk.test.ts,test/e2e/put-pages-group-postgres.test.ts,test/e2e/persistence-group-deadline-postgres.test.ts.src/core/persistence/identity.ts— local writer and host identity. GBRA-75 wave 7:localHostId/localHostIdentity/existingLocalHostIdshare one cache of the validatedhost.json, keyed on the path (recomputed frompersistenceHome()on every call, so aGBRAIN_HOMEchange misses) plusstatSync(bigint)dev, ino, mtimeNs, ctimeNs and size. ENOENT is a miss (existingLocalHostIdnever mints); any other stat error reads uncached, sowriter_identity_invalidstill throws on every call; an invalid document is never cached; a file modified under 2 s ago is read but not cached (same-size rewrites inside one timestamp tick).scripts/persistence/harness.tsselectFixtureHost(rename over the path) stays correct. Tests:test/persistence-host-identity-cache.test.ts.src/core/persistence/housekeeping-turn.ts— GBRA-156: a one-shot CLI consumer (markOneShotCommand) runs upkeep only after its write and only in the host's turn, one perGBRAIN_ONESHOT_HOUSEKEEPING_INTERVAL_MS(default 5 min); see the module doc. Tests:test/write-roundtrips-gbra156.test.ts.src/core/persistence/consumer-heartbeat.ts— #6317 (B1a, B3): the probe and heartbeat behind one full consumer per host.consumerIdentity()is this process's{pid, nonce, pid_ns}(a random per-process nonce, the/proc/self/ns/pidinode where readable), so a reused pid after a container restart is a new row; everyowner_pid === process.pidcheck compares the nonce too.startConsumerHeartbeat(engine, row, opts)renews this process'spersistence_consumersrow every 10 s on its own single-flight timer throughexecuteRawDirect(independent of claim renewal: an idleserveholds no claim), carrying kind (claimOwner().kind), mode (probing|full|waiter_only|promoted),restart_required, the age of the oldest abandoned root barrier, the pool gauge{checked_out, max, waiters},host_json_path,persistence_home,minted_underand the build; each renewal deletes rows not renewed for 90 s in the same CTE, and a failed write is logged once and never stops the consumer. #6650: rows carryboot_id,process_start(v243); the probe andelectOwnerskip rowsconsumerRowProvablyDeadproves dead (Linux: same boot and pid ns, pid gone/reused).probeLiveFullConsumer(engine, hostId, self)is the database-only probe (never a socket: the persistence IPC socket exists only on PGLite): a row of a resident kind (serve,sync,jobs,autopilot,mcp), modefull, not this process, renewed within 30 s, notrestart_requiredand not wedged (no root barrier older thanpersistence.preparation_ceiling_ms), on anactivebinding.listHostConsumers(engine, hostId)feedswriter status --jsonhost.consumersand doctor. The consumer mode machine inconsumer.ts(probing→fullorwaiter_only→promoted→ back towaiter_onlyafter three healthy owner ticks) consumes the probe on every tick;startPersistenceConsumerinservice.tsstays synchronous and returns the waiter-only seam (WaiterOnlyConsumerbehindPersistenceConsumerLike:wake()no-op, settlement listeners kept,holds()false,status()waiter_onlywith the owner pid) when the probe finds an owner andpersistence.single_consumeris on. Aservealways starts full; short-lived kinds (put,import,dream,cycle,sources,cli) keep their own consumer; PGLite is inert.src/core/schema-migrations/v222-persistence-consumers.ts— #6317 (T-01): thepersistence_consumerstable, primary key(host_id, pid, nonce), columnspid_ns,kind,mode,started_at,renewed_at,restart_required,root_barrier_age_ms,pooljsonb,host_json_path,persistence_home,minted_underjsonb,version; plus the partial indexpersistence_requests (worktree_id, completed_at DESC) WHERE state = 'committed'that the movement watermark reads (the baseline indexes cover pending, recovery and principal reads only). Both objects are also insrc/schema.sqlfor fresh installs (PGLite and Postgres parity, goldens). The number is taken at the merge slot bybun run release:restamp.src/core/persistence/journal.ts— the request journal SQL: admission, claims, renewals, releases and completion. #6278: the claim statements stamp apreparingphase of their own token at claim time and return the previous claim's stamp with the row (previous_claim_phase), so a stalled receipt names the last recorded step; a follower's stamp has only its token and owner (#6650) until its wave dispatches it (markDispatched), so a kill charges exactly the members that were preparing;renewGroupClaimsstamps each member's own phase;releaseUnpublishedClaimcharges onepreparation_attemptsonly forpreparation_deadline(claim_lost,consumer_stoppingandgroup_member_waitingnever do);chargePreparationAttemptcharges a claim this owner still holds before it is finishedpreparation_stalled;floorPreparationAttemptspins the counter at the limit after a ceiling overrun; completing a request as committed resets the counter (completeWrite,completeGroup). An older owner ignores the counter and its renewals overwrite the stamp with the old shape (writer status shows each owner's version); every statement keepsPERSISTENCE_PROTOCOL_PREDICATE. Tests:test/persistence-preparation-kill-accounting.test.ts,test/e2e/persistence-preparation-attempts-postgres.test.ts.src/core/persistence/diagnostics.ts— trusted administrator counts for owners/epochs, queued bytes/age, outbox recovery, configured quota usage and actionable capacity warnings; bigint values are transport-safe strings and diagnostics exclude intent, credentials and private paths. Writer status's blockers also carry each request'soperation,intent_kindandpreparation_attempts; a running blocker'sclaimadds the preparationstep,step_age_ms,waiting_on, the owner process (kind, pid, gbrain build, from the live claim's stamp),budget_msand, past the budget,stall: { reason: 'preparation_overdue', step, step_age_ms, waiting_on, budget_ms }(claimStall;WRITE_HEALTH_REASONS, the wire enum, is unchanged). #9227: a claim whose owner provably exited (PGLite cutoff, or a dead same-boot pid on a worktree this host owns) readsowner_exited: true,owner_live: false,claim.next.code: claim_owner_exited.WRITER_NEXT_ACTIONShas entries forpreparation_deadline(keep the request id: the owner will claim it again) andpreparation_stalled(do not resubmit under the same id; retry-held after the fix), and the result carriespreparation_policy(the budgets, ceiling, attempt limit and switch in effect). Doctorpersistence_write_stallprints the same fields. Tests:test/persistence-writer-status-stall.test.ts. #7777/#7780: a guard failure of known cause getsguardRefusalHint.src/core/persistence/pre-activation-release.ts— #6122:preActivationClaimslists the source bindings of a never-activated brain with their roots;releasePreActivationClaims(called bydeactivatePersistenceon a disabled brain oncedeactivationBlockersis empty) takes the local worktree locks withidentity: 'reservation'(#5914: it publishes nothing, so a recreated directory whose reservation names the worktree and whose stamp carries the same token releases; a token mismatch refuses), then in one transaction checks the admin state, the admin lock and that the brain is still disabled, re-runs the blockers, retires the claimed worktrees, deletes the source and host bindings and records a committedwriter_deactivatechange withoutcome.pre_activation: true, socleanupRetiredManagedMarkersclears this host's claim markers. It ensures the CLI writer registration first (a never-activated brain may have none).sync-authority.tsresolveSyncPersistenceModerefuses such a claimed source with an agent-firstwriter_coordinator_required: both choices in the suggestion,fixthe state-bound release (consent: ['destructive'], soask_user, with the dry run aspreview_argv). Indeactivation.ts: on a brain whose managed persistence was never activated,--dry-runreports the realsource_bindingsand each claim aspre_activation_claims(andapply_commandwhen clean), and the state-bound run releases them throughpre-activation-release.ts; with no claims a rerun still only cleans retired markers. Tests:test/persistence-preactivation-claim.test.ts. Inunbound-source.ts: on a brain whose managed persistence is not activated, the hint offers editing the page's file plusgbrain sync --source <id>(andpersistence.unbound_write=database_onlywhere it applies) instead of the claim, and says a claim alone would block classic sync until activation orgbrain sources writer deactivate.src/core/persistence/sync-concurrent-write.ts— #6194 (D4):concurrentWriteProofdecides whether a managed sync import'srevision_conflictreceipt came from a concurrent database-only write. The proof is revision-linked: the page's live revision differs from the import's frozenexpected_revision, andpages.revision_write_request_idnames a committed non-sync request for the same source incarnation and page id (a delete or recreate of that page included; admission order is never used).concurrentWriteHoldbuilds theconcurrent_writehold (competing request id, operation and revision inmeta; identifiers only).sync-run.tsholdFailedFenceRequest(the receipt branch) holds such a file exactly as it holds a prepare-time fence refusal; imports only (a held deletion would be re-screened at once), and without proof the failure still blocks.sync-holds.tsroutes it (gitHoldFix:gbrain sources reconcile <source> <slug> --preview, thensources retry-held;HoldRepairRoute.concurrentfrom the summary'sconcurrentcounter, read byheld-reads.ts, doctorgit_held_files,sources retry-heldand the remote host-operator fix). Tests:test/managed-sync-concurrent-write-hold.test.ts.src/core/persistence/sync-page-fault.ts— #6340: a page that moved under a managed catch-up holds the page, not the run.headCommittedBytesreturns the working-tree bytes of a path when their blob id equalsHEAD:<path>(sha1 or sha256 by HEAD's id length), sofreezeEntryimports bytes committed past the pinned target as HEAD has them (the later pin..HEAD diff re-imports them as a no-op; idea and first test from PR #6323, which this supersedes) andprepareManagedSyncMutation'snewerWorkingTreescreen never sees them.pageChangeProofis #6194's revision-linked proof usable at freeze time;pageChangedHoldbuilds theconcurrent_writehold for a database page that was edited, deleted or re-bound after enumeration (with the competing request when proven, elsepage_revision+expected_revision),worktreeDirtyHoldthe newworktree_dirtyhold (pinnedblob_oid,working_hash) for uncommitted bytes that match neither the pin nor the page,pinnedWorktreeConflictrecognizes that receipt andpageMovedSinceAdmissionarevision_conflictreceipt whose page really moved (a run-level conflict with the page where it was still blocks). Insync-run.ts:freezeEntryresolves the three freeze-time throws (page_identity_changed,revision_conflict, the renamed-source conflict) into holds when holds are on (a page that still holds exactly what the import carries is re-bound to its new revision and passed by the waiver screen;sync.holds=failand company-brain cursors keep the refusals),holdFailedFenceRequestconverts the two receipts (imports and deletes) throughreceiptPageFaultHold, re-freezes an entry once under a fresh request when its file changed between admission and publication (fileChangedAfterAdmission, theraw_file_changedreceipt: committed bytes then import as HEAD has them, a second change under the re-frozen request is heldworktree_dirty;holdUnderGatetakesrefrozenin place ofholdand records the conversion asrefrozen),convertBlockedCursorconverts a cursor an older release left blocked (re-freezing a dirty file that is committed now),originFaultHoldholds an entry whose recorded origin no longer identifies the enumerated page (assertSyncPageOriginat freeze), every page-fault hold marks the cursorovertaken(#5522: another cursor may have checkpointed this target), and the--retry-failedstart tries that conversion before rediscovering, so the frozen manifest survives.writeGitHoldcountsmeta.attemptsper re-hold with the same code;HOLD_ATTEMPTS_NEEDS_HUMAN(3) turns a page hold intoneeds_human. The run's catch skips the failure ledger forisRetryableConnError/ statement timeouts. Tests:test/managed-sync-page-fault-holds.test.ts(freeze-time DB edit → hold, same content → re-bind, dirty →worktree_dirty→ commit → import, committed past pin → HEAD bytes, old blocked cursor → in-place conversion with attempts, connection death → no ledger row, same run on relaunch, one extra pass), the updated expectations intest/persistence-managed-sync.test.tsandtest/managed-sync-concurrent-write-hold.test.ts.src/core/persistence/sync-fault-class.ts+sync-status.ts+src/commands/sync/operator.ts— #6340: the operator contract.SYNC_FAULT_TABLE/classifySyncFaultturn a code (plus a receiptdetail, a hold'sattempts, an error message) into{ class: page | connection | systemic, safe_actions, needs_human, human_reason };docs/guides/sync-unblock-runbook.mdrenders the table betweensync-fault-tablemarkers andtest/sync-runbook-table.test.tspins the two.readSyncStatusjoins the cursor header (index/total, pinned target, last advance, rate; #6518: the newest cursor recorded under the source's current incarnation, the only one a current sync can select),committed_last_10m(committed managed page requests of the source), every hold (withgitHoldFix) and the last ledger failure (never the read view'ssync_incomplete) intoSyncStatuswith onenextaction (a human's fix withuser_message, elsegbrain sync unblock --apply, else the resume command,--retry-failedwhen a ledger row exists). When no current-incarnation cursor or failure exists but an unfinished cursor stands under an older incarnation, the status iscursor: nullwithlast_error.code: cursor_incarnation_retired(table row: systemic,repair, no human) andnextis thegbrain repair managed-sync-orphans --source <id>preview, never a sync that selects nothing. #6712 PR 2 (L5):state/reason(SYNC_STATUS_REASONS), the boundedoldest_blocker(the drain's head probe) andrecoveryprobes;readSyncStatus(…, { detail })skips the terminal summary, blocker list and cursor join when false (the plain CLI), each with a<field>_readnot_readsibling;syncStatusHeadlineis the text headline.unblockSync(engine, sourceId, { apply, noRepair?, noLlm?, maxLlmUsd?, registry? })schedules a re-screen (requestGitHoldRetry) for aworktree_dirtyhold whose file is committed at HEAD now and for apreparation_stalledhold; for a repair-class hold whose codeCONTENT_REPAIR_HOLD_KINDSmaps to a content-repair lane kind (#6377;invalid_fence→fences) it runs that kind on exactly those paths throughrunContentLaneas one bounded apply (UNBLOCK_REPAIR_BUDGET_MS= 120 s, thefences.repaircaps,noLlmfor the free tiers), re-reads the holds, and reports each path asapplied[].action: 'repair'withrepair: { kind, outcome: repaired | held | needs_human | skipped, reason?, tier?, llm_usd?, receipt? (the write's location-only detail), next }(a path the kind kept out of its plan takes the reason the kind recorded on the hold); repaired paths join the re-screen. It refusesstill_dirty,concurrent_write, exhausted holds, repair-class holds no lane kind clears yet (or all of them undernoRepair), and holds whose stored repair state says a person decides (contentHoldDisposition: a manual or paid fence state, a recommended merge; these are listed, never retried) by name with their fix; previews without--apply(repair holds listed asskipped/preview); and is idempotent.holdVerdictmakesreadSyncStatusreport such a holdneeds_humanwith the paragraph (the fault table's when it names the lane's codes, else a sentence naming the state), andnextsays when unblock would write hash-bound repairs with a receipt per file. The CLI subcommandsgbrain sync status --source <id> [--json]andgbrain sync unblock --source <id> [--apply] [--no-llm] [--no-repair] [--json](routed insync/run.tslikesync trigger;cli.tsskips the sync watchdog and the serve delegations for them;syncOperatorVerbmakessync --statusthe status read) print the envelope withnext(and each repair outcome'snext) rendered throughrenderAction, plus a receipt line per repaired file;--jsonwrites the envelope throughwriteJsonDocument, so under the D2 guard it is the one stdout document. Tests:test/sync-status-unblock.test.ts,test/cli-json-guard.test.ts. #6402:cancelled(a knock-on window cancel) is apage/retryrow, not needs_human, sosync statushands the loop the same retry sync's ownNext:prints (sync-cancelled-knock-on.test.ts).src/core/persistence/sync-drain.ts(#6340 additions) —isConnectionDrop(a retryable connection error that is not #6329'sCONNECTION_DESTROYED/CONNECTION_CLOSEDsettle discard;retry-matcher.tsnow matchesECONNABORTED,ETIMEDOUTandEPIPEbesideECONNRESET);runDrainreconnects (DrainInput.reconnect,engine.reconnectfromdrainManagedSync) and retries a dropped pass onCONNECTION_RETRY_MS(5/15/45 s), resets the count on every committed page, and afterCONNECTION_STRIKESdrops with no commit between them endsblocked/connection_lostwithdrain.connection { drops, last_error }(URLs stripped) and the resume command as a loopablenext(sync_drain_connection_lostin the catalogue,connection_lostin the registry).drainManagedSynctakes exactly one extra pass (drain.extra_pass { from, to }, counts merged bymergeExtraPass) when HEAD moved past the pinned target during asyncedrun, so a live checkout ends at HEAD without looping. Tests:test/sync-drain-connection.test.ts. In-pass governor:src/core/persistence/drain-step.ts—runDrainraces every pass against a governor that runs with or withoutannounce: the pass gets its ownAbortController, the governor's head read is bounded (GOVERN_PROBE_MS, or the window when shorter), and on a stop the pass signal is aborted withDrainPassAbandoned(the pass'sassertActive/stampDrainStepboundaries throw it, so it admits and writes nothing more;stampDrainStepdoes not throw the caller's own cancel, which still banks admitted work) and its late result or rejection is dropped. A head claim live inpublishingpastpersistence.publication_ceiling_ms(default 300000, 60000 to 3600000;PUBLICATION_CEILING_DEFAULT_MS) stopsblocked/drain_stalled/publication_overduewithstall.in_passand anextthat says restart (never a promised reclaim); a pass with no commit and nothing changing forIN_PASS_NO_PROGRESS_MS(5 min) stopsno_progress/owner_missing(#6712 PR 2 retiredno_admission); a live preparation is left to its own budget and ceiling. The pass returns at the checkpoint commit (managed_sync.finishcounts as a commit); its tail runs after the lease is released (sync-tail.ts).drain-step.tsholds the process-local step (freeze,waiver_run,admission,await_receipt, stamped insync-run.ts) and the last statement label (noteDrainSql, fromwaiveNoopRun).enterClaimPhase(clock, 'publishing')stampswaiting_on: 'publication'.sync-waivers.tswaiveNoopRunpipelines at mostWAIVER_PIPELINE_MAX(64) calls per round trip and sends the next chunk only while the prefix holds.commands/sync-delegate.tsreports a delegated stop as it is. Tests:test/sync-drain-inpass-stall.test.ts,test/sync-drain-no-admission.test.ts,test/sync-drain-finish-tail.test.ts,test/sync-waivers-chunk.test.ts.src/core/persistence/worktree-manifest.ts+src/core/hardened-git.ts— #6099 (re-exported byownership.ts): a directory that is the top of its own Git work tree is hashed ingitscope overgit ls-files -z --cached --stage(working-tree bytes; a tracked file missing on disk counts as deleted; gitlinks, tracked symlinks and paths resolving through a symlink refusewriter_manifest_unsafe; untracked non-ignored files counted asuntracked_count, never named), so gitignored files are never opened and a clean clone verifies; anything else keeps thetreescope (every file but.git,.gbrain-managedand physical-root metadata, digest unchanged). W4.4: whengit rev-parsefails for a directory that holds a.gitentry (damaged HEAD, dubious ownership, timeout, Git missing),detectManifestScoperefuseswriter_manifest_unsafewith agit -C <dir> statusfix instead of falling back totree(which read ignored files); only a directory thatgit-checkout.tsclassifyGitCheckoutreads asnot_git(no.gitentry at or above it, noGIT_DIR) keepstreescope. Stored manifests carryscope: 'git'(absent = tree, every older stored manifest), and each verifier recomputes in the stored scope: transfer accept and its dry run, rebind (the new directory in the current checkout's scope; a mismatch names the first differing paths viamanifestDifferences), clone/reclone (hashScopeon the recovery record;topology-recovery.tshashes legacy records in tree scope). A tree-scope transfer whose Git successor does not match refuseswriter_manifest_rescope_required(re-prepare on the owner host) instead of asking for ignored files; transfer prepare reportsuntracked_fileswith a warning. Migration v218 drops legacyfilesmaps frompersistence_worktrees.manifestand clone recovery records. Git runs throughsrc/core/hardened-git.ts(shared withcompany-brain/revision.ts); W4.3:assertHardenedGitArgsallows only filter-free plumbing (rev-parse,ls-files,ls-tree,cat-filewithout--filters/--textconv,hash-object --no-filters,check-attr,diff-index --cached) in both wrappers, andhardenedPathDirtyis thegit status -- <path>equivalent (untracked, staged incl. unborn HEAD, worktree vs index;nullfor conversion attributes, CRLF bytes, symlinks/gitlinks and exec-bit-only changes). #6510:trackedByteschecks for symlinks withlstaton every directory component between the canonical root and the leaf, then the leaf, on every read (no cache across files: a parent swapped to a symlink after the first file would otherwise let a later leaf read outside the root), reading through the Git spelling; the formerrealpath(path) === pathproxy refused a checkout whose volume spells a name differently (APFS NFC/NFD, case-insensitive volumes) with no symlink anywhere. Tests:test/persistence-manifest-git-scope.test.ts,test/worktree-manifest-unicode.test.ts(synthetic realpath-spelling spy on Linux, parent-swap, case-spelling where the tmpdir is case-insensitive),test/hardened-git-filters.test.ts.src/core/git-checkout.ts— #6210 (fix wave 12):classifyGitCheckout(dir, env = process.env): 'git' | 'not_git' | 'unknown'decides from the filesystem alone whether a directory is inside a Git checkout:not_gitonly when the directory exists and no.gitentry (directory or gitdir file) is at or above it andGIT_DIRis unset;unknownfor a missing directory or any lookup error other than absence. Git's own exit 128 is locale-dependent and also means a damaged HEAD, a bad gitdir or dubious ownership, so callers that soften "not a checkout" use this instead.isDurabilityHardenedAsync(brain-repo-durability.ts) returns false only fornot_gitor an absent hook; every other failure (a git probe run withLC_ALL=Cfailing, a timeout, an unreadable hook) rejectsgit_unavailable, andrunPersistenceEffects(persistence/effects.ts) settles each cached per-root probe to{durable}|{error}and records the error on every coalesced effect, so the effects stay queued (and park after repeated failures) instead of completing asdurability_not_enabled. Tests:test/git-checkout.test.ts,test/persistence-git-durability-probe-6210.slow.test.ts(Postgres viatest/e2e/persistence-git-durability-probe-6210-postgres.test.ts; fix wave 16 split it out of the 5530 coalescing file, whose fixture both share throughtest/helpers/git-coalescing-fixture.ts).src/core/persistence/consumer-election.ts— #6317 (B1b): the consumer mode machine (probing→full|waiter_only→promoted) andWaiterOnlyConsumer, thePersistenceConsumerLikesurface for a resident process (sync,jobs,autopilot,mcp) that found a live full consumer of this host and claims nothing:wake()is a no-op, settlement listeners still fire throughsettledWaiters,status()reportswaiter_onlywith the owner's identity.electOwnerre-probes every tick and promotes on the owner's progress (lapsed 60 s, wedged, not full, gone); a promoted consumer drains back after three healthy ticks of afullowner only, so promotion storms converge.forceOwnConsumer(reason)is--no-delegate's process flag.src/core/persistence/consumer-lane.ts— #6317 (reporter ask 2):consumerStatementEngine, the Proxy that routes the consumer's own tick statements (idle probe, switch read, recovery and expired-claim scans, capacity, releases, floor) toexecuteRawDirectwhile the dual pool is active (GBRAIN_DIRECT_DATABASE_URLor the Supabase-derived direct URL), so the owner's round-trips avoid a transaction-mode pooler;status().connection = { lane, pooler_mode, direct_host? }says which lane is in use, and one[persistence] phase=start reason=transaction_poolerline prints when only aprepare=falseURL exists.src/core/persistence/consumer-diagnostics.ts— #6317 (B3, I1):hostConsumersReport(thehost.consumersblock ofwriter status --json),consumerOverlap(two resident-kind full rows alive over 30 s),ownersWithoutHeartbeat(claim owners on running claims with no row) andhostIdentityMismatches(this process'shost.jsonid differs from a binding owner's while the owner's checkout resolves on this filesystem or the machine id matches), read-only and shared by doctor and writer status.src/core/persistence/publication-deadline.ts(#6288 part 1, #6352; UC2) — what bounds a publish that neither resolves nor rejects. On Postgres the publish transaction is the real bound:declareDurablePersistencealready sets a transaction-localstatement_timeout(5 s) andlock_timeout, anddeclarePublication(#6712 L6: the opening statement ofpublishMutation's andpublishGroup's transactions, the sameSELECTasdeclareDurablePersistence, so no extra round trip even where a transaction-mode pooler turns pipelining off) adds a transaction-localidle_in_transaction_session_timeoutofpersistence.publication_ceiling_ms(default 300000, 60000 to 3600000, read per engine; never above the pool's ownGBRAIN_IDLE_TX_TIMEOUT), so a publisher stuck between statements is ended by the server and commits nothing; both survive a transaction pooler that drops startup parameters. Never set on PGLite: it would enforce the bound, and a transaction it ends wedges the engine's only connection.boundPublication(the consumer's single path andexecuteClaimedGroup's group publish and per-member fallback) settles only with the publish's own outcome, so nothing releases or reports a request or group while its transaction can still commit; at the ceiling the claim stamp readswaiting_on: publication_deadline, afterPUBLICATION_GRACE_MS(30 s) it aborts the publication's signal (passed toengine.transaction(fn, { signal })throughpublicationTransaction: on Postgres the connection is discarded and nothing commits; the rejection waits for the transaction body to settle, then surfaces with the driver'sCONNECTION_CLOSEDcode, so the claim is requeued for a retry; PGLite checks the signal only before BEGIN), and afterPUBLICATION_SETTLE_MS(5 s) more the consumer lists it instuck_publicationsand reportsrestart_required(its root stays held: restarting the owner is the recovery, never a promised reclaim). The lease keeps renewing, so a reclaim never races a publisher that may still write files. The wave 9 yield between groups is outside any one bound.PublicationBound.lateris the scheduler seam (default a real unref'd timer); the unit test drives the three phases through a manual clock so a stalled runner cannot fire a phase early (the consumer'sclockseam is separate). Tests:test/persistence-publication-deadline.test.ts(barriers after the token lock, after the file rename and before commit; the server-side idle end on Postgres; the wiring probe).src/core/persistence/transient-retry.ts— the retry budget for a managed write's transient interruptions: a statement the database ended with 57014 (statement_cancel), a stale cached plan (0A000,stale_plan) or a publicationboundPublicationcancelled at the ceiling (publication_ceiling, read from its signal bypublicationDeadlinePassed).chargeTransientInterruptioncounts it inpersistence_requests.transient_interruptions(v261, neverpreparation_attempts) and setsnext_attempt_atto 1 s, 2 s, 4 s, 8 s, then 15 s (under the drain's 30 s no-progress window);BACKOFF_ELAPSEDkeeps every claim (claimableWriteSql, lane heads, group followers) off the row until then, so no claim is held while it waits, andreadHeadBlockersnames ittransient_backoff. Pastpersistence.max_transient_retries(default 5, 0 to 20, a preparation-budget key) coordinator.ts ends the requestwrite_interrupted; the charge commits with the claim's release. Off withpreparation_deadlines. Tests:test/pathological/lp-b-transient-retry-budget.test.ts,test/pathological/lp-c-publication-ceiling-retry.test.ts(_setPublicationTimingForTest),test/persistence-write-interrupted.test.ts.src/core/persistence/sync-discovery.ts(#6349 staged catch-up) — when an incremental delta (not--full, not company) exceeds the cursor bound (100,000 entries, 16 MiB;_setCursorBoundForTestlowers it),stagedSyncTargetgallops forward overgit rev-list --first-parent last..HEAD, verifying every candidate's delta from the last synced commit against the bound (a net delta is not monotone, so no binary search), and discovery reruns pinned at the furthest fitting commit with no working-tree entries, recordingstagedHead; the cursor carries it andSyncResult.staged { target, head, stages }reports it. One commit alone above the bound refusesrequest_too_largenaming the commit.commands/sync/perform.tsloops a drain stage by stage to HEAD (the drain's one extra HEAD-moved pass is skipped for a staged result). Tests:test/sync-staged-catchup.test.ts.