Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Publish commits a managed checkout already holds instead of reporting nothing to commit
garrytan84e8192245c5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4e8b05d8ec..ba39898cb3 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,17 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [Unreleased]++**`gbrain git commit-push` on a managed checkout now publishes commits the remote lacks, instead of answering "nothing to commit".** On a managed canonical worktree, commit-push only committed the named paths and left publishing to the owner. When the commit already existed (a script's bare commit, or one an earlier call made), it printed `nothing to commit`, exited 0 and logged `[push] ok-already-on-remote`, which `put_page`'s `lastPushStatus` and doctor read as a push that landed. Meanwhile, with a sibling clone pushing the same branch, the checkout stayed diverged until something else published it. After committing, it now publishes every commit the upstream lacks the way `--push-only --keep-checkout` does: remote commits are merged in memory (never a rebase or force), a conflicting file refuses `integrate_conflict` with nothing pushed and the local commit named, and the checkout never moves. A checkout its upstream already holds is still a no-op.++### Itemized changes++- `src/commands/git.ts`: after the managed commit step, when `upstreamLacksHead` (the branch's upstream, as last fetched, does not contain HEAD), runs the keep-checkout publish and reports `pushed` with the commit it made (or `committed: null`) and `checkout: unchanged`. A failed publish keeps its error code and exit, and its message starts with the local commit's sha. `committed_local` now means only that the branch has no upstream.+- `src/core/git/commit-push.ts`: `commitManagedPaths` marks its result `managed: true`; new `upstreamLacksHead`. In-process callers on a managed root (derived write-through, access rules) still only commit, so no push runs on the owner's event loop.+- Docs: `docs/guides/shared-checkout-git.md` (managed worktree paragraph, the `nothing_to_commit` and `committed_local` rows, scripts rule 1), `docs/architecture/topologies.md` (files that are not pages).+- Tests: `test/git-commit-push-managed-publish.test.ts` (the real CLI against a bare remote, a sibling clone and a managed-root registry: an existing bare commit published merged with a moved remote, a fresh commit published and a repeat call that pushes nothing, a conflict that pushes nothing and names the local commit); `test/git-commit-push-not-a-source-8662.test.ts` expects `pushed` for an admitted managed subdirectory with an upstream.+## [0.60.616.0] - 2026-11-08**Opt-in local-edit adoption (`persistence.adopt_local_edits`, off by default) no longer leaves an adoption commit unrecorded when the write it was made for ends early, names that commit on a failed adoption's receipt, and refuses during a bisect or an uncommitted squash merge.** An adoption whose `gbrain: adopt local edit` commit landed before its publication failed used to end `write_claim_lost` (or be cancelled) once its caller's claim ended, so the commit was never recorded and later writes to the page refused `file_database_drift` until a sync. It is now published on its replay with its receipt naming the landed commit. An adoption that ends without committing after its commit landed names that commit too (`outcome.persistence.git_commit`, `landed_before_row: true`), so `gbrain write-request` and `gbrain sources writer failures` tie the commit to the adoption. Adoption now also keeps its refusal while a `git bisect` or an uncommitted `git merge --squash` is in progress, and when Git names the checkout's git dir with anything but one absolute, existing directory in valid UTF-8.diff --git a/docs/architecture/topologies.md b/docs/architecture/topologies.mdindex 3bbf18fbad..7eb248a6db 100644--- a/docs/architecture/topologies.md+++ b/docs/architecture/topologies.md@@ -834,10 +834,11 @@ Git effect commits only the page paths it wrote (`git commit --only`) and thenpushes HEAD. Everything else in the checkout (`MEMORY.md`, daily notes,`AGENTS.md`, scripts) is the operator's: commit it with`gbrain git commit-push -m "<msg>" -- <paths>`, which commits only those paths-under the checkout's commit lock (`committed_local`) and never fetches, pushes-or moves the checkout. Those commits reach the remote on the owner's next-push, because the owner pushes HEAD, or sooner with-`gbrain git commit-push --push-only --keep-checkout` from the checkout; `gbrain sources push` refuses on a managed root and its secret scan+under the checkout's commit lock, then publishes HEAD merged with the upstream+the way `gbrain git commit-push --push-only --keep-checkout` does, never moving+the checkout (`pushed`). Commits that are already there, such as a script's+bare commit, go out on the same call, or on the owner's next push, because the+owner pushes HEAD; `gbrain sources push` refuses on a managed root and its secret scandoes not run on a hand push. A hand push and the owner's push race only byordinary Git semantics (both push the same HEAD; a push the remote rejects isretried by the owner and, after repeated failures, parked, whichdiff --git a/docs/guides/shared-checkout-git.md b/docs/guides/shared-checkout-git.mdindex 6f3eef4ec4..99d57ec414 100644--- a/docs/guides/shared-checkout-git.md+++ b/docs/guides/shared-checkout-git.md@@ -127,12 +127,16 @@ persistence owner is the only Git publisher. Save pages with `put_page`,`edit_page`, `remember` or `capture`. For files written there outside gbrain(see [files that are not pages](../architecture/topologies.md#files-that-are-not-pages)),`gbrain git commit-push -m "<msg>" -- <paths>` commits only the named paths-under the checkout's commit lock and reports `committed_local`: it never-fetches, merges, pushes or moves the checkout, and refuses `--pending`,-`--branch`, `--resolve` and `--allow-outside-source-root` there-(`commit_paths_invalid`). The commit reaches the remote on the owner's next Git-publish. `--push-only` without `--keep-checkout` is still refused with-`writer_coordinator_required`.+under the checkout's commit lock, then publishes every commit the upstream+lacks the way `--push-only --keep-checkout` does: remote commits are merged in+memory, a conflicting file refuses `integrate_conflict` with nothing pushed, and+the checkout never moves. It reports `pushed` with `checkout: unchanged`, or+`nothing_to_commit` when the paths had no change and the upstream (as last+fetched) already holds HEAD; a commit an earlier call or a script made is+published either way. It reports `committed_local` only when the branch has no+upstream. It refuses `--pending`, `--branch`, `--resolve` and+`--allow-outside-source-root` there (`commit_paths_invalid`). `--push-only`+without `--keep-checkout` is still refused with `writer_coordinator_required`.A checkout with no Git remote at all (`git remote` prints nothing and thebranch names none) has nothing to publish to: `gbrain git commit-push -m "<msg>" -- <paths>`@@ -169,8 +173,8 @@ Follow the error's `fix.next` as the| --- | --- | --- || `pushed` | 0 | Done. Report the commit; a hosted link to the file works now. || `push_deferred` | 0 | Only with `--require-clean` (the post-commit hook): another push was running in this checkout and was asked to publish HEAD too when it finishes. Nothing to do. |-| `nothing_to_commit` | 0 | The paths had no change. Any earlier local commit on the branch was still pushed, so nothing is waiting (with `no_remote: true`, nothing is pushed). |-| `committed_local` | 0 | A managed canonical worktree, or a checkout with no Git remote (`no_remote: true`): the paths were committed locally and nothing was pushed. Report the commit; it reaches a remote on the owner's next publish, or after a remote is added and `--push-only` runs. |+| `nothing_to_commit` | 0 | The paths had no change. Any earlier local commit on the branch was still pushed (on a managed worktree, published with the checkout kept), so nothing is waiting (with `no_remote: true`, nothing is pushed). |+| `committed_local` | 0 | A checkout with no Git remote (`no_remote: true`), or a managed canonical worktree whose branch has no upstream: the paths were committed locally and nothing was pushed. Report the commit; it reaches a remote after a remote is added and `--push-only` runs. || `pushed_checkout_lagging` | 0 | The push landed but this checkout was not advanced; a `[gbrain notice]` names the files that blocked it. Change nothing: the next commit-push or `--pull` catches the checkout up. Never stash or reset to "fix" it. || `commit_lock_busy` | 1 | Another writer held the lock for the whole wait; nothing was committed. Retry once. If it is still busy, tell the user which checkout and lock path the message names and stop. || <a id="checkout_not_a_source"></a>`checkout_not_a_source` | 1 | The checkout commit-push resolved from the working directory (no `--path`) is not one of the brain's source checkouts on this host, typically a wrapper that changed into another repository; nothing was staged. The message lists the brain's checkouts. Tell the user to make the script pass `--path` with the absolute brain checkout. A repository that only encloses a source checkout (a brain cloned inside another repository) is not one; a source registered at a subdirectory its checkout tracks is. A host whose brain records no source checkout, or a checkout with `gbrain.sourceRoot` set, is never refused this way. |@@ -271,8 +275,8 @@ commits come in. Four rules keep that checkout able to move:changes nothing. Commit the files a script wrote with`gbrain git commit-push --path <absolute checkout> -m "<msg>" -- <paths>`(run from another repository without `--path`, it refuses `checkout_not_a_source`): on a managed worktree it- commits only those paths under the commit lock (`committed_local`) and the- owner publishes them on its next Git publish. Pages can also go through+ commits only those paths under the commit lock and publishes them merged+ with the upstream without moving the checkout (`pushed`). Pages can also go through`put_page`, `edit_page`, `remember` or `capture`. CLI calls go throughthe [one wrapper](cron-schedule.md#calling-gbrain-unattended).2. **Refresh on a schedule.** `gbrain sources refresh <id>` drains queueddiff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 99245e61a3..9bb4d97fb8 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -47,4 +47,4 @@ src/commands/doctor/checks/extraction-sync.ts 1500 ratchet +7 GBRA-130 A-1: linksrc/core/search/evidence-delivery.ts 1759 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); new row: crossed the 1500 unlisted cap at the #6367 merge (master 1479, its explicit-budget cap) by the C1 date header threaded through every block path, cap included; pagePlanHits (search/page-plan-hits.ts) and the header loader (evidence-date.ts blockDateHeaders) were peeled first; peel candidate: allocateCapped; +8 at the #6396 merge: page evidence text cut through the fence-chunk trust overlay and the caller minTrust floor (re-summed: our 1504 + master +8); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136); +39 Wave B PR 2 lane 2b: planSegmentedBlock joins the windows search/segmented-evidence.ts reads around a segmented page's hits into one run-marked document (needs the private Doc/Piece/buildDoc/locateAnchor internals), planBlock's unit cut split into blockFromDoc for both, sections bounded by their run, selectionCost counts a gap between runs, and the fetch skips the whole-body fence overlay for a segmented page; +4 segmented pages read at once before planning (segmentedReads; the read is search/segmented-evidence.ts, the statements page-body/read-range.ts); +17 GBRA-156: tail trim plan flag, DeliverOptions.query, DeliveryMeta.tail_trim, the trim call and the frozen-hit score/query library fields (logic in search/evidence-tail-trim.ts; interface fields cannot move); +7 GBRA-205: EvidencePlan.titleHeader and DeliveryMeta.title_header (interface fields cannot move) and the titles option on the header loader (logic in search/evidence-date.ts; the query budget key lives in search/evidence-packing.ts); +11 #7600: assemble_evidence quotes conversation rows and capEvidenceToBudget counts the quote fence (logic in search/transcript-quote.ts); +2 GBRA-156 /ship review: the cut-path admission and title room count the quote fence; +2 GBRA-156 /ship review pass 2: capEvidenceToBudget counts the fence only for the paths that fence (quote flag; recall counts the text as returned); +4 GST-687: page evidence and the extractive fallback quote below-owner-tier text for untrusted readers (untrusted flag; logic in search/transcript-quote.ts)src/commands/config.ts 1526 ratchet +1 GBRA-216: recall.* config set value refusal (facts/recall-config.ts); +1 GBRA-216: config set refuses a dream.claim_conflicts.mode other than propose|off (refusal in facts/claim-conflicts.ts); new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 wave 16 G5.1 (#6495): set-time refusal hook for search.keyword_statement_timeout_ms (check lives in commands/config/keyword-timeout-value.ts); +1 wave 18b lane 5 (#5012 item 6): search.contextual_retrieval prints the existing-pages hint after the write (text lives in commands/config/contextual-mode-hint.ts); +1 #6712 PR 2: retired/rollback sync key dispatch line (logic in core/sync-config-keys.ts handleSyncKeyConfig); +1 #6865: sync.slug_conflicts.auto_remove boolean validation at set time (refusal text in repair/slug-autoheal.ts); +1 #6948: sync.origin_twins.auto_resolve boolean validation at set time (refusal text in repair/origin-twins-heal.ts); +2 #6795: config set chat_model/expansion_model help line and the model-pin import (shadow report and file-pin unset live in commands/config/model-pin-shadow.ts); +1 #6712 PR 4b: sync.admission set-time hook (value logic in commands/config/sync-admission-value.ts); +4 #7130: set-time refusal hook for sync.max_deletes / sync.max_delete_ratio (and .source.<id>) / purge.retention_hours (check lives in core/sync-reconcile.ts deleteSafetyConfigRefusal); +1 GBRA-150: sync.metafile_pages set-time route (body in config/sync-metafile-pages-value.ts); re-summed at the v0.60.330.0 merge (1520 measured); +2 #7242 minions.terminal_hook file-plane key and its set branch (logic in minions/terminal-hook.ts); +1 GBRA-161: generations.* set-time route (refusal in commands/config/generations-values.ts); +1 GBRA-207 #7630: sync.repo_path set-time refusal hook (refusal in core/sync-config-keys.ts syncRepoPathRefusal)src/commands/mcp-expose.ts 1519 ratchet hosted_option: Session carries the gbrain.io coaching notice on the first-receipt run and Tailscale/service friction exits (copy, refs and gating live in core/onboard/hosted-option.ts); +7 GBRA-199: --surface help lines, surfaceChosen option field and the advertise pass-through (registrationAdvertise in core/mcp-registration.ts)-src/core/behavior-change-notice.ts 1683 ratchet +4 train R: #7491/#7492 keyword_identifier_probe and keyword_slug_handles rows and their comment, #7175 keyword phrase row; the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1); +3 GBRA-200 comment, write-grant refusal and degraded-stamp rows (re-summed at the 0.60.562.0 merge: 1615 + 3); +2 GBRA-280 get_page selector-precedence row and comment (re-summed at the 0.60.569.0 merge: 1619 + 2); the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured; +2 GBRA-283 Wave A (#8460): engine_keyed_caches_gbra283 row and its comment (rows are data and cannot move); +2 GBRA-287: segmented_freeze_hold_gbra287 and segmented_reexport_gbra287 rows (rows are data and cannot move); +1 GST-1209: segmented_tiling_gst1209 row (rows are data and cannot move); +1 GST-1251: skillopt_loop_deprecated_gst1251 row (rows are data and cannot move); +1 GST-1209 follow-up: untiled_hold_repair_gst1209 row (rows are data and cannot move); +1 GBRA-283 B3a: embedded_scope_required_gbra283 row (rows are data and cannot move); re-summed at the train R merge with v0.60.574.0: 1623 + 4; +2 GST-1387: refresh_fence_refusal_gst1387 row and its comment (rows are data and cannot move); re-summed at the memory train #8481 merge with v0.60.578.0 (1643 measured); +3 GBRA-253 #8109 rows (frontmatter_drift_write_8109, contacts_activity_advance_8109, contact_rows_dedupe_8109; rows are data and cannot move), re-summed at the master v0.60.581.0 merge: 1643 + 3 = 1646 measured; +3 #8123 part C rows: sync_write_through_off_writeback_7084, managed_sync_dry_run_counts_7087, frontmatter_missing_source_dir_7889 (since TBD until the merge slot; re-summed at the 0.60.583.0 merge: 1646 + 3); +4 PR B commit_ledger_prb, doctor_foreign_writers_prb and sources_guard_prb rows and their comment (rows are data and cannot move; since TBD until the merge slot); +1 PR B #8615: file_drift_held_needs_prefer_8615 row; +1 PR B #8617: refresh_source_changed_retry_8617 row; +1 PR B #8662: commit_push_checkout_not_a_source_8662 row (since TBD until the merge slot; rows are data and cannot move); +2 PR B refresh_barrier_prb and commit_push_base_prb rows (re-summed: 1658 measured); +3 convergence PR A: the wave comment and two rows (conversion_content_evidence_pr_a, git_gap_live_pages_pr_a; since TBD until the merge slot; rows are data and cannot move); re-summed at the gate-ahead on master v0.60.592.0 plus #8711: 1658 + 3 = 1661 measured; +4 GST-1094/GST-900 rows (memory_recall scope-read, member-bound acting_user, recall max_chars, unknown_param _meta-only) and +1 qm_scope_writes_gst1113 and +1 recall_question_terms_gst1304 rows (rows are data and cannot move), re-summed at the 0.60.595.0 slot merge: 1661 + 6; +1 GST-1582 refresh_barrier_import_gst1582 row (since TBD until the merge slot; rows are data and cannot move); +2 GST-1601 source_changed_origin_gst1601 and adopt_local_edits_gst1601 rows (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.596.0 merge: 1668 + 2; +1 GST-1623 refresh_barrier_capacity_gst1623 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.599.0 merge: 1670 + 1; +2 GBRA-224 W1 release_channel_stable_default row and its comment; +1 GST-1623 refresh_barrier_later_write_gst1623 row (#8765; rows are data and cannot move); +5 #8766 GST-1623 items 4/6-9 and #8755: the wave comment and four rows (doctor_foreign_writers_partial_gst1623, commit_push_enclosing_repo_gst1623, owner_guard_fail_closed_gst1623, adopt_local_edits_hardening_8755) and +1 managed_sync_kind_reserved_8765 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on master v0.60.608.0 plus #8798: 1674 + 6; +1 GST-1853 refresh_barrier_aborted_refresh_sync_gst1853 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.613.0 merge: 1680 + 1; +1 GST-1674 refresh_refused_merge_recovery_gst1674 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.614.0 merge: 1681 + 1; +1 #8824/#8826/#8767: adopt_local_edits_replay_markers_8824 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8837: 1682 + 1+src/core/behavior-change-notice.ts 1684 ratchet +4 train R: #7491/#7492 keyword_identifier_probe and keyword_slug_handles rows and their comment, #7175 keyword phrase row; the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1); +3 GBRA-200 comment, write-grant refusal and degraded-stamp rows (re-summed at the 0.60.562.0 merge: 1615 + 3); +2 GBRA-280 get_page selector-precedence row and comment (re-summed at the 0.60.569.0 merge: 1619 + 2); the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured; +2 GBRA-283 Wave A (#8460): engine_keyed_caches_gbra283 row and its comment (rows are data and cannot move); +2 GBRA-287: segmented_freeze_hold_gbra287 and segmented_reexport_gbra287 rows (rows are data and cannot move); +1 GST-1209: segmented_tiling_gst1209 row (rows are data and cannot move); +1 GST-1251: skillopt_loop_deprecated_gst1251 row (rows are data and cannot move); +1 GST-1209 follow-up: untiled_hold_repair_gst1209 row (rows are data and cannot move); +1 GBRA-283 B3a: embedded_scope_required_gbra283 row (rows are data and cannot move); re-summed at the train R merge with v0.60.574.0: 1623 + 4; +2 GST-1387: refresh_fence_refusal_gst1387 row and its comment (rows are data and cannot move); re-summed at the memory train #8481 merge with v0.60.578.0 (1643 measured); +3 GBRA-253 #8109 rows (frontmatter_drift_write_8109, contacts_activity_advance_8109, contact_rows_dedupe_8109; rows are data and cannot move), re-summed at the master v0.60.581.0 merge: 1643 + 3 = 1646 measured; +3 #8123 part C rows: sync_write_through_off_writeback_7084, managed_sync_dry_run_counts_7087, frontmatter_missing_source_dir_7889 (since TBD until the merge slot; re-summed at the 0.60.583.0 merge: 1646 + 3); +4 PR B commit_ledger_prb, doctor_foreign_writers_prb and sources_guard_prb rows and their comment (rows are data and cannot move; since TBD until the merge slot); +1 PR B #8615: file_drift_held_needs_prefer_8615 row; +1 PR B #8617: refresh_source_changed_retry_8617 row; +1 PR B #8662: commit_push_checkout_not_a_source_8662 row (since TBD until the merge slot; rows are data and cannot move); +2 PR B refresh_barrier_prb and commit_push_base_prb rows (re-summed: 1658 measured); +3 convergence PR A: the wave comment and two rows (conversion_content_evidence_pr_a, git_gap_live_pages_pr_a; since TBD until the merge slot; rows are data and cannot move); re-summed at the gate-ahead on master v0.60.592.0 plus #8711: 1658 + 3 = 1661 measured; +4 GST-1094/GST-900 rows (memory_recall scope-read, member-bound acting_user, recall max_chars, unknown_param _meta-only) and +1 qm_scope_writes_gst1113 and +1 recall_question_terms_gst1304 rows (rows are data and cannot move), re-summed at the 0.60.595.0 slot merge: 1661 + 6; +1 GST-1582 refresh_barrier_import_gst1582 row (since TBD until the merge slot; rows are data and cannot move); +2 GST-1601 source_changed_origin_gst1601 and adopt_local_edits_gst1601 rows (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.596.0 merge: 1668 + 2; +1 GST-1623 refresh_barrier_capacity_gst1623 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.599.0 merge: 1670 + 1; +2 GBRA-224 W1 release_channel_stable_default row and its comment; +1 GST-1623 refresh_barrier_later_write_gst1623 row (#8765; rows are data and cannot move); +5 #8766 GST-1623 items 4/6-9 and #8755: the wave comment and four rows (doctor_foreign_writers_partial_gst1623, commit_push_enclosing_repo_gst1623, owner_guard_fail_closed_gst1623, adopt_local_edits_hardening_8755) and +1 managed_sync_kind_reserved_8765 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on master v0.60.608.0 plus #8798: 1674 + 6; +1 GST-1853 refresh_barrier_aborted_refresh_sync_gst1853 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.613.0 merge: 1680 + 1; +1 GST-1674 refresh_refused_merge_recovery_gst1674 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.614.0 merge: 1681 + 1; +1 #8824/#8826/#8767: adopt_local_edits_replay_markers_8824 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8837: 1682 + 1; +1 GST-1923 managed_commit_push_publishes_gst1923 row (since TBD until the merge slot; rows are data and cannot move)diff --git a/src/commands/git.ts b/src/commands/git.tsindex 21a58cd48f..b43b312d14 100644--- a/src/commands/git.ts+++ b/src/commands/git.ts@@ -13,7 +13,7 @@*/import { existsSync, realpathSync } from 'node:fs';import { isAbsolute, join, relative, sep } from 'node:path';-import { commitAndPush, checkoutRoot, pullShared, scopePaths, COMMIT_LOCK_NAME, SOURCE_ROOT_CONFIG, type Resolution } from '../core/git/commit-push.ts';+import { commitAndPush, checkoutRoot, pullShared, scopePaths, upstreamLacksHead, COMMIT_LOCK_NAME, SOURCE_ROOT_CONFIG, type Resolution } from '../core/git/commit-push.ts';import { guardStatus, installGuard, uninstallGuard } from '../core/git/commit-guard.ts';import { appendPushLog } from '../core/brain-repo-durability.ts';import { opError } from '../core/ops/contract.ts';@@ -35,9 +35,11 @@ const HELP = `Usage: gbrain git commit-push [--path <dir>] -m <msg> [--json] [--Commit only the named paths and push them, safely, in a checkout other agentsshare: a short commit lock and a separate push lock per checkout, norebase/stash/reset of the working tree, remote commits merged in memory, and the-checkout advanced fast-forward only. In a managed canonical worktree it only-commits the named paths (committed_local): no fetch, merge, push or checkout-move; the owner's next Git publish, or --push-only --keep-checkout, pushes it.+checkout advanced fast-forward only. In a managed canonical worktree it commits+the named paths, then publishes any commits the upstream lacks the way+--push-only --keep-checkout does (remote commits merged in memory, a conflict+refused, the checkout never moved); committed_local only when the branch has+no upstream.In a checkout with no Git remote it also only commits the named paths(committed_local, no_remote); the publishing modes are refused there.@@ -222,7 +224,7 @@ export async function runGit(args: string[]): Promise<number> {return 0;}- const result = commitAndPush({+ let result = commitAndPush({repo, cwd, paths: p.paths, pushOnly: p.pushOnly, advanceOnlyWhenClean: p.requireClean,message: p.pending ? p.message ?? 'gbrain: commit pending write-through files' : p.message,...(p.pending ? { pending: true } : {}),@@ -233,6 +235,15 @@ export async function runGit(args: string[]): Promise<number> {...(p.expectRemote ? { expectRemote: p.expectRemote } : {}),...(bases.size ? { bases } : {}),});+ if (result.managed && upstreamLacksHead(repo)) {+ const local = result;+ try {+ result = { ...commitAndPush({ repo, cwd, pushOnly: true, keepCheckout: true }), committed: local.committed, paths: local.paths, managed: true };+ } catch (e) {+ if (local.committed && e instanceof Error) e.message = `Committed ${local.committed.slice(0, 7)} locally; publishing it did not finish. ${e.message}`;+ throw e;+ }+ }if (result.outcome === 'push_deferred') {emit(json, { ...result, repo }, `push deferred: another push is running in ${repo} and will publish HEAD too`);return 0;@@ -243,7 +254,7 @@ export async function runGit(args: string[]): Promise<number> {return 0;}if (result.outcome === 'committed_local') {- emit(json, { ...result, repo }, `committed ${result.sha!.slice(0, 7)} on ${result.branch}; not pushed: this is a managed checkout, so the owner's next Git publish pushes it (or gbrain git commit-push --push-only --keep-checkout)`);+ emit(json, { ...result, repo }, `committed ${result.sha!.slice(0, 7)} on ${result.branch}; not pushed: ${result.branch} has no upstream branch to publish to`);return 0;}appendPushLog(result.outcome === 'nothing_to_commit' || result.confirmed === 'remote' ? 'nothing' : result.integrated ? 'ok-after-merge' : 'ok',diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex bca4cd210e..42d61ec097 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -1485,6 +1485,7 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;{ since: '0.60.611.0', id: 'managed_sync_kind_reserved_8765', text: 'A page write that passes a `kind` starting with `managed_sync_` (for example `capture` with `kind: managed_sync_import`) is now refused `invalid_params` and writes nothing: that prefix is reserved for managed sync, and with `persistence.refresh_barrier` on a waiting write now tells sync\'s own imports apart from later writes by the operation that wrote them, not by the kind. Use another kind, or drop `kind`.' },{ since: '0.60.614.0', id: 'refresh_barrier_aborted_refresh_sync_gst1853', text: 'While a checkout\'s last `gbrain sources refresh` ended without completing (aborted, abandoned, or rolled back after its process died), every refresh run on the owner host, including one refused `refresh_diverged`, now ends by running the managed `--no-pull` sync of each source behind the checkout HEAD, listed in its `synced` (a refusal\'s message names them). With `persistence.refresh_barrier` on, a write held behind that refresh for a commit sync had not imported is therefore decided in that run instead of waiting for a later refresh: a `put_page` with `expected_revision` ends `revision_conflict`, a blind one lands and names what it replaced in `supersedes`, and a `remember` or `add_timeline_entry` applies on top.' },{ since: '0.60.608.0', id: 'refresh_barrier_later_write_gst1623', text: 'With `persistence.refresh_barrier` on, a write that waited behind a refresh or an import (other than a `remember` or `add_timeline_entry`, which still applies on top) now ends `revision_conflict` instead of applying when a later write to the same page committed first, which a consumer from an older release can cause; read the page again and resubmit with a new `request_id`. A write held again and again behind imports now expires once it has waited four wait limits (at least 4 hours) since its admission, even when each hold is shorter than one wait limit. With the barrier on or off, a plain-git commit that lands on the start commit right before a refresh merges makes git refuse the fast-forward, and the refresh now ends `refresh_source_changed` with the fence lifted and the commit kept, instead of leaving the checkout `recovery_required`; one that lands right after the merge is recorded and synced.' },+ { since: '0.60.617.0', id: 'managed_commit_push_publishes_gst1923', text: 'On a managed checkout, `gbrain git commit-push -m <msg> -- <paths>` now publishes every commit the upstream lacks after committing, the way `--push-only --keep-checkout` does: remote commits are merged in memory, a conflicting file refuses `integrate_conflict` with nothing pushed, and the checkout never moves. It reports `pushed` (with `checkout: unchanged`) where it used to report `committed_local`, and a commit that already existed is published instead of answered `nothing to commit`. `committed_local` now means only that the branch has no upstream.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --git a/src/core/git/commit-push.ts b/src/core/git/commit-push.tsindex d8ecead6a5..ce4326b79f 100644--- a/src/core/git/commit-push.ts+++ b/src/core/git/commit-push.ts@@ -80,6 +80,8 @@ export interface CommitPushResult {no_remote?: true;/** Conflicted files where the remote held a version this checkout had already replaced: this checkout's version was published. */superseded_remote_paths?: string[];+ /** A managed canonical worktree: only the named paths were committed; `upstreamLacksHead` says whether HEAD still needs the keep-checkout publish. */+ managed?: true;}export interface PullResult {@@ -1086,8 +1088,8 @@ function defaultPublishWaitMs(): number {/*** Q1: on a managed canonical worktree commit-push commits only the paths the caller names (pages written outside gbrain,* which would otherwise land as bare commits), under the commit lock, and nothing more: no fetch, merge, push or checkout- * move, so the owner stays the only publisher. The commit reaches the remote on the owner's next Git publish, or with- * `gbrain git commit-push --push-only --keep-checkout`.+ * move, so the owner stays the only process that moves the checkout. The CLI then publishes HEAD with the keep-checkout+ * merge when `upstreamLacksHead` (GST-1923); in-process callers leave it to the owner's next Git publish.*/function commitManagedPaths(root: string, opts: CommitPushOptions, managed: ManagedFilesystemRoot): CommitPushResult {const where = `${root} is the managed canonical worktree${managed.sourceId ? ` of source ${managed.sourceId}` : ''}`;@@ -1095,7 +1097,14 @@ function commitManagedPaths(root: string, opts: CommitPushOptions, managed: Manathrow opError('commit_paths_invalid', `${where}: commit-push there only commits the paths you name.`,`Run gbrain git commit-push with only -m and the page paths after --; gbrain sources refresh${managed.sourceId ? ` ${managed.sourceId}` : ''} brings remote commits in.`);}- return commitPathsOnly(root, opts, where, configuredSourceRoots(root), 'Leave the checkout to its owner; gbrain sources writer status names its state.');+ return { ...commitPathsOnly(root, opts, where, configuredSourceRoots(root), 'Leave the checkout to its owner; gbrain sources writer status names its state.'), managed: true };+}++/** True when the branch has an upstream (as last fetched) that does not contain HEAD: local commits are waiting to be published. */+export function upstreamLacksHead(repo: string): boolean {+ const root = checkoutRoot(repo);+ const upstream = git(root, ['rev-parse', '--verify', '--quiet', '@{upstream}']).stdout.trim();+ return !!upstream && !isAncestor(root, 'HEAD', upstream);}/** A checkout with no Git remote at all: no remote is configured and the branch names none (a named but missing remote is refused by resolveCtx). A git command that fails is not proof of "no remote". */diff --git a/test/git-commit-push-managed-publish.test.ts b/test/git-commit-push-managed-publish.test.tsnew file mode 100644index 0000000000..963b1c7f2c--- /dev/null+++ b/test/git-commit-push-managed-publish.test.ts@@ -0,0 +1,105 @@+/**+ * GST-1923: on a managed canonical worktree, `gbrain git commit-push` committed the named paths and stopped. A commit that+ * already existed (a script's bare commit, or one an earlier call made) answered "nothing to commit", exit 0, pushed+ * nothing and logged `ok-already-on-remote`, while a sibling clone kept pushing the same branch, so the checkout sat+ * diverged until something else published it. It now publishes the commits the upstream lacks the way+ * `--push-only --keep-checkout` does: the remote is merged in memory (never a rebase or force), a conflict refuses, and+ * the checkout never moves. A checkout already on its upstream stays a no-op.+ * Seams: none; the real CLI against temp repositories, a bare remote, a sibling clone and a managed-root registry under+ * a temp GBRAIN_HOME.+ */+import { afterAll, expect, test } from 'bun:test';+import { execFileSync } from 'node:child_process';+import { mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { recordManagedRoots } from '../src/core/persistence/root-registry.ts';+import { runCli } from './helpers/cli-spawn.ts';+import { withEnv } from './helpers/with-env.ts';++const dir = realpathSync(mkdtempSync(join(tmpdir(), 'gbrain-gst1923-')));+afterAll(() => rmSync(dir, { recursive: true, force: true }));+const identity = { GIT_AUTHOR_NAME: 'Example', GIT_AUTHOR_EMAIL: '[email protected]', GIT_COMMITTER_NAME: 'Example', GIT_COMMITTER_EMAIL: '[email protected]' };+const git = (root: string, ...args: string[]) => execFileSync('git', ['-C', root, '-c', 'user.name=Example', '-c', '[email protected]',+ '-c', 'commit.gpgsign=false', ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();+const page = (title: string, body: string) => `---\ntitle: ${title}\n---\n${body}\n`;++interface Fixture { home: string; remote: string; brain: string; sibling: string }++/** A bare remote, the managed brain checkout (registered for source-a) and a sibling clone that pushes the same branch. */+function fixture(name: string): Fixture {+ const remote = join(dir, `${name}.git`), brain = join(dir, `${name}-brain`), sibling = join(dir, `${name}-sibling`), home = join(dir, `${name}-home`);+ execFileSync('git', ['init', '-q', '--bare', '-b', 'main', remote]);+ execFileSync('git', ['clone', '-q', remote, brain], { stdio: 'ignore' });+ git(brain, 'checkout', '-q', '-b', 'main');+ mkdirSync(join(brain, 'people'));+ writeFileSync(join(brain, 'people', 'alice-example.md'), page('Alice', 'First version.'));+ git(brain, 'add', '.'); git(brain, 'commit', '-qm', 'init'); git(brain, 'push', '-q', '-u', 'origin', 'main');+ execFileSync('git', ['clone', '-q', '-b', 'main', remote, sibling], { stdio: 'ignore' });+ withEnv({ GBRAIN_HOME: home }, () => { recordManagedRoots('00000000-0000-4000-8000-000000001923', [{ local_path: brain, source_id: 'source-a' }]); });+ return { home, remote, brain, sibling };+}++const remoteTip = (f: Fixture) => execFileSync('git', ['-C', f.remote, 'rev-parse', 'refs/heads/main'], { encoding: 'utf8' }).trim();+const onRemote = (f: Fixture, sha: string) => { try { execFileSync('git', ['-C', f.remote, 'merge-base', '--is-ancestor', sha, 'refs/heads/main']); return true; } catch { return false; } };+const siblingPush = (f: Fixture, file: string, body: string) => {+ mkdirSync(join(f.sibling, 'notes'), { recursive: true });+ writeFileSync(join(f.sibling, file), body);+ git(f.sibling, 'add', file); git(f.sibling, 'commit', '-qm', `sibling: ${file}`); git(f.sibling, 'pull', '-q', '--no-rebase', 'origin', 'main'); git(f.sibling, 'push', '-q', 'origin', 'main');+ return git(f.sibling, 'rev-parse', 'HEAD');+};+const commitPush = (f: Fixture, ...rest: string[]) => runCli(['git', 'commit-push', '--json', '--path', f.brain, '-m', 'add page', ...rest], { cwd: dir, home: f.home, env: identity });+const pushLog = (f: Fixture) => { try { return readFileSync(join(f.home, '.gbrain', 'brain-push.log'), 'utf8'); } catch { return ''; } };++test('a commit that already exists is published merged with a moved remote, not reported as nothing to commit', async () => {+ const f = fixture('stranded');+ const before = remoteTip(f);+ const theirs = siblingPush(f, 'notes/sibling.md', 'From the sibling clone.\n');+ mkdirSync(join(f.brain, 'companies'));+ writeFileSync(join(f.brain, 'companies', 'acme-example.md'), page('Acme', 'Ingested.'));+ writeFileSync(join(f.brain, 'people', 'bob-example.md'), page('Bob', 'Ingested.'));+ git(f.brain, 'add', 'companies/acme-example.md', 'people/bob-example.md'); git(f.brain, 'commit', '-qm', 'ingest: two pages');+ const ours = git(f.brain, 'rev-parse', 'HEAD');+ const result = await commitPush(f, '--', 'companies/acme-example.md');+ expect(result.exitCode).toBe(0);+ expect(JSON.parse(result.stdout)).toMatchObject({ outcome: 'pushed', committed: null, integrated: 1, checkout: 'unchanged', paths: ['companies/acme-example.md'] });+ expect(onRemote(f, ours)).toBe(true);+ expect(onRemote(f, theirs)).toBe(true);+ expect(onRemote(f, before)).toBe(true);+ expect(git(f.remote, 'rev-list', '--parents', '-n', '1', 'refs/heads/main').split(' ')).toHaveLength(3);+ expect(git(f.brain, 'rev-parse', 'HEAD')).toBe(ours);+ expect(git(f.brain, 'status', '--porcelain')).toBe('');+ expect(pushLog(f)).toContain('[push] ok-after-merge main');+ expect(pushLog(f)).not.toContain('ok-already-on-remote');+}, 60_000);++test('a new commit is published at once, and a repeat call on a checkout its upstream already holds pushes nothing', async () => {+ const f = fixture('fresh');+ writeFileSync(join(f.brain, 'people', 'carol-example.md'), page('Carol', 'New page.'));+ const first = await commitPush(f, '--', 'people/carol-example.md');+ expect(first.exitCode).toBe(0);+ const published = JSON.parse(first.stdout) as { outcome: string; committed: string };+ expect(published).toMatchObject({ outcome: 'pushed', integrated: 0, checkout: 'unchanged', paths: ['people/carol-example.md'] });+ expect(published.committed).toBe(git(f.brain, 'rev-parse', 'HEAD'));+ expect(remoteTip(f)).toBe(published.committed);+ const again = await commitPush(f, '--', 'people/carol-example.md');+ expect(again.exitCode).toBe(0);+ expect(JSON.parse(again.stdout)).toMatchObject({ outcome: 'nothing_to_commit', committed: null });+ expect(remoteTip(f)).toBe(published.committed);+}, 60_000);++test('a file both sides changed refuses integrate_conflict, naming the local commit; nothing is pushed or moved', async () => {+ const f = fixture('conflict');+ siblingPush(f, 'people/alice-example.md', page('Alice', 'The sibling version.'));+ const before = remoteTip(f);+ writeFileSync(join(f.brain, 'people', 'alice-example.md'), page('Alice', 'This machine\'s version.'));+ const result = await commitPush(f, '--', 'people/alice-example.md');+ expect(result.exitCode).toBe(1);+ const envelope = JSON.parse(result.stdout) as { code: string; message: string };+ const local = git(f.brain, 'rev-parse', 'HEAD');+ expect(envelope.code).toBe('integrate_conflict');+ expect(envelope.message).toStartWith(`Committed ${local.slice(0, 7)} locally; publishing it did not finish.`);+ expect(git(f.brain, 'log', '-1', '--format=%s')).toBe('add page');+ expect(remoteTip(f)).toBe(before);+ expect(pushLog(f)).toContain('[push] CONFLICT, NEEDS ATTENTION: main');+}, 60_000);diff --git a/test/git-commit-push-not-a-source-8662.test.ts b/test/git-commit-push-not-a-source-8662.test.tsindex 05ce52e064..096f257d10 100644--- a/test/git-commit-push-not-a-source-8662.test.ts+++ b/test/git-commit-push-not-a-source-8662.test.ts@@ -124,7 +124,7 @@ test('GST-1623: a repository that only encloses a registered checkout is refusedwriteFileSync(join(tracked, 'notes', 'a.md'), 'an edited page\n');const admitted = await commitPush(tracked, subHome, '--', 'notes/a.md');expect(admitted.exitCode).toBe(0);- expect(JSON.parse(admitted.stdout)).toMatchObject({ outcome: 'committed_local', paths: ['notes/a.md'] });+ expect(JSON.parse(admitted.stdout)).toMatchObject({ outcome: 'pushed', managed: true, checkout: 'unchanged', paths: ['notes/a.md'] });}, 60_000);test('GST-1623: a stale gbrain-managed.json an older gbrain left in the enclosing repository does not admit it', async () => {