Skip to content

v0.60.673.0

Choose a tag to compare

@github-actions github-actions released this 11 Nov 14:15
7c35d0a

Source checkouts now stay level with their remotes without help. A held page that changed only in Git imports on the next sync, and every way out of an interrupted refresh works.

Every source checkout now converges on its remote by itself: gbrain sources git-reconcile, run by autopilot each tick. One idempotent call brings every source checkout on the host level with its upstream. A checkout that is only behind fast-forwards. A checkout gbrain cloned for the source (gbrain sources add --url, with the source folder at the repository root) publishes its local commits merged with the upstream in memory: the same secret scan and rewritten-upstream refusal as refresh, bound to the upstream it checked so a force-push in between refuses, never a rebase or force-push. Any other checkout, such as a source folder inside a repository gbrain did not clone, reports its local commits unpublished unless sources.refresh_publish_diverged is true. A managed checkout goes through gbrain sources refresh and its Git durability rule. Sources with sync turned off are skipped unless named. A level checkout costs one fetch and reports in_sync, and callers on the same checkout take turns, so any agent, cron or hook can call it as often and as concurrently as it likes. Autopilot runs it each tick on every engine, its pulls and publishes in bounded child processes, so a slow push never stalls the daemon; autopilot.git_pull false skips it, and sources.refresh_publish_diverged false leaves local commits unpublished while checkouts behind still fast-forward. Exit 0 means level, 1 that a checkout needs the user, 4 that a retry can fix it.

  • src/core/git/reconcile.ts (new): one checkout under its own reconcile lock (outermost; no other path takes it, so it cannot deadlock a publish); fetch with the tracking ref's move logged, then a gbrain git commit-push --pull child, a --push-only --scan-secrets --expect-remote <checked upstream> child (a remote that moved in between is fetched and checked for a rewrite again), or upstream_rewritten; a fetch that loses the tracking-ref race to a concurrent fetch retries.
  • src/core/git/upstream-history.ts (new): the rewritten-upstream check, moved out of src/core/persistence/worktree-refresh.ts so refresh and reconcile share it.
  • src/commands/sources-git-reconcile.ts (new), src/commands/sources.ts: the command, grouping sources by checkout; a managed checkout waits out a running refresh up to --wait. A checkout that fails with an unexpected error (an unwritable .git, say) is reported for that checkout alone and the others still reconcile; only a failure of the whole run (the database, the disk) stops it. Its fetch carries the transport hardening every other remote git call has (no redirects, no external helpers, no submodules, never a credential prompt). On a managed brain a source with no checkout bound to this host is left alone, and a checkout with a recorded remote that gbrain did not clone keeps its local commits.
  • src/commands/autopilot-git-reconcile.ts (new), src/commands/autopilot-daemon.ts: the per-tick reconcile in the daemon, logged.
  • Docs and skills: docs/guides/live-sync.md, docs/guides/shared-checkout-git.md, docs/guides/cron-schedule.md (allow minutes for fetch and push calls), skills/cron-scheduler/SKILL.md (the managed cron line runs sources git-reconcile).
  • Tests: test/sources-git-reconcile.test.ts (level, stranded, behind, diverged, conflict, secret, rewritten upstream, a force-push between the check and the push, eight concurrent callers while another clone pushes, managed with durability on and off and publishing off, no checkout, publishing off, a checkout gbrain did not clone, sync off, a missing folder), test/autopilot-git-reconcile.test.ts (the daemon's event loop keeps ticking during a publish child; a refusal is reported with no value printed; a hung child is killed).

Held pages that only changed in Git import on the next sync. A Git edit to a page with no import record is held file_drift unless sync can show only the file moved. An earlier release could show that only by comparing the page with its file at the last synced commit; a later one also compares the path's earlier committed versions, but did not screen the holds the first rule had already written. Those holds are now screened once more. A page that still holds an earlier committed version of its file imports the Git edit and its hold clears; a page the database also changed stays held, and is not screened again.

  • src/core/persistence/sync-holds.ts: FILE_DRIFT_VERSION 2, so an unknown-side file_drift hold stamped 1 is re-screened once with the earlier committed versions.
  • Tests: test/sync-unknown-drift-history-rescreen.test.ts (a hold stamped 1 whose page holds an older committed version imports the Git edit; one whose page the database changed stays held at 2 and is not screened again); the existing rescreen and #7931 tests name the current screen version instead of the literal 1.

gbrain sources refresh --abandon no longer leaves the database ahead of the checkout, and every way out an interrupted refresh names now finishes it. A refresh stopped mid-sync with the checkout reset to its start commit could still be abandoned when a member's sync had imported part of the upstream commit but stopped (on its budget) before recording it: the imported pages stayed live with no file at HEAD. Abandoning while a sync pass that read the upstream commit was still running could also let that pass record the upstream commit after the fence lifted. Both now refuse and change nothing. The first names the fast-forward and --resume, and the second names sync_drain_lease_held until the pass ends. The other ways out are fixed too: --abandon at a HEAD past the upstream commit names --resume (which finishes in one run) instead of a reset; members synced to diverged lines get a refusal naming each commit and a merge of them instead of a fast-forward --resume would refuse again; a member commit git cannot place gets its own refusal and a fetch; writer status read off the owner host says the check needs the owner host; and the refusals name the revert route for an operator who rolled back on purpose (fast-forward, git revert on top, --resume). --abandon is never loosened and has no override.

  • src/core/persistence/worktree-refresh.ts: membersPastStart also counts a member with a managed-sync import or delete admitted after the row's barrier_sequence, and reads git merge-base --is-ancestor as exit 0, exit 1 or "cannot place". --abandon of a recovery_required row checks the members and aborts under the topology locks and every member's drain lease (underMemberLeases); a live holder refuses sync_drain_lease_held and an expired lease is taken over. keepPagesWayOut replaces keepPagesHead: a fast-forward to the newest member commit on the target's line, a merge of diverged member lines (ask_user), or a fetch when a member commit cannot be placed; --resume recomputes that refusal at any readable HEAD instead of repeating the stored text. adoptsHead is the one recovery-adopts-this-HEAD check, and --abandon reads it to name --resume at a HEAD past the target. refreshHolderReport names writer status on the owner host (actor: host_admin) when it has no checkout for a recovery_required row. The fast-forward refusal's suggestion and user_message name the revert route.
  • Docs: docs/guides/write-refusals.md (refresh_recovery_required, sync_drain_lease_held), docs/architecture/key-files/core-persistence-git.md.
  • Tests: test/refresh-recovery-followups-gst1465.test.ts (new, PGLite and Postgres through test/e2e/worktree-refresh-postgres.test.ts): a sliced pass's partial import refuses --abandon and the fast-forward then --resume finishes with every page at HEAD; a pass paused after its level read refuses --abandon sync_drain_lease_held; a fenced and a merged orphan past the target finish on one --resume and --abandon names it; diverged members refuse naming both commits and the named merge then --resume finishes; an unplaceable member commit refuses with the fetch at the start commit and at the target, and once fetched the fast-forward finishes; writer status off the owner host names the owner host; the revert route completes and the next sync removes the reverted page.