Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

commit-push works on very large checkouts and refuses files with merge conflicts; OpenClaw setup check no longer fails on a busy machine (#9506)

Garry Tan006e37ae7da7
diff --git a/behavior-changes.d/commit_paths_unmerged.md b/behavior-changes.d/commit_paths_unmerged.md
new file mode 100644
index 0000000000..62d4db5743
--- /dev/null
+++ b/behavior-changes.d/commit_paths_unmerged.md
@@ -0,0 +1,4 @@
+---
+kind: fix
+---
+gbrain git commit-push now refuses, before staging anything, when a file you name still has unresolved merge conflicts in the index, for example after a merge, rebase or stash pop that stopped on a conflict. It used to stage the file and commit it with its conflict markers as if it were resolved, and on an ordinary checkout push it. The refusal is commit_paths_unmerged (exit 1): nothing is staged or committed, the file stays unmerged, and the message names each file. Resolve each one (edit out the markers, or keep one side with git checkout --ours or --theirs -- <file>), mark it resolved with git add -- <file>, then rerun the commit. The same check covers every gbrain write that commits named files, such as lint --fix and connector writes.
diff --git a/behavior-changes.d/git_large_index_listing.md b/behavior-changes.d/git_large_index_listing.md
new file mode 100644
index 0000000000..e61a8bbde3
--- /dev/null
+++ b/behavior-changes.d/git_large_index_listing.md
@@ -0,0 +1,4 @@
+---
+kind: fix
+---
+gbrain git commit-push no longer fails on a large checkout with git_unavailable "git ls-files -v failed: exit -1". Its git calls were limited to 1 MiB of output, so naming a folder whose index listing passed that (a few thousand tracked files with long names, more on a checkout of hundreds of thousands) killed git; they now read git's whole output. A git command that is stopped before it finishes (its time limit, or a signal such as the out-of-memory killer) now reports git_command_stopped with its reason (timeout or signal) instead of git_unavailable, still exit 1, and gbrain never uses its partial output as the answer. A push, fetch or remote listing stopped after the local commit still reports push_unconfirmed (exit 4).
diff --git a/changelog.d/capy-openclaw-plugin-flake.md b/changelog.d/capy-openclaw-plugin-flake.md
new file mode 100644
index 0000000000..04e03bd8c3
--- /dev/null
+++ b/changelog.d/capy-openclaw-plugin-flake.md
@@ -0,0 +1,9 @@
+**`gbrain git commit-push` works on a checkout with a very large index, no longer commits a file that still has merge conflicts, and OpenClaw skill setup no longer fails on a busy machine.**
+
+### Fixed
+- `gbrain git commit-push` read each git command's output with Node's default 1 MiB limit, so on a large checkout (one report had about 385,000 tracked files) naming a folder killed git and the run failed with `git_unavailable` "git ls-files -v failed: exit -1". It now reads git's whole output, so the commit goes through. A git command stopped before it finishes (its time limit, or a signal such as the out-of-memory killer) now fails with `git_command_stopped` and its reason, still exit 1, instead of `git_unavailable`, and its partial output is never used, so a cut-off listing can no longer pick the wrong files to stage or restore. A push, fetch or remote listing stopped after the local commit still reports `push_unconfirmed` (exit 4), and a write-through file whose commit was stopped stays in the pending ledger for the next retry.
+- `gbrain git commit-push` refuses a named file that still has unresolved merge conflicts in the index (for example after a merge, rebase or stash pop that stopped on a conflict) with `commit_paths_unmerged`, before it stages anything. It used to commit the file, conflict markers included, as if it were resolved. Nothing is staged or committed, and the message says how to resolve the file first. Every gbrain write that commits named files goes through the same check.
+- `gbrain setup openclaw` checked its installed skill plugin by resolving one turn against the live per-turn deadline of 50 ms, so on a loaded or slow machine the check timed out and setup failed with `skill_resolver_selftest_failed`. The check now gives that one turn 10 seconds, because it tests that a turn resolves, not how fast. Live turns keep the 50 ms deadline.
+
+<!-- behavior-change: commit_paths_unmerged -->
+<!-- behavior-change: git_large_index_listing -->
diff --git a/docs/contracts/public-surface.json b/docs/contracts/public-surface.json
index fce55c2112..519e645855 100644
--- a/docs/contracts/public-surface.json
+++ b/docs/contracts/public-surface.json
@@ -2493,6 +2493,7 @@
"commit_outside_source_root": 1,
"commit_paths_invalid": 1,
"commit_paths_skipped": 1,
+ "commit_paths_unmerged": 1,
"commit_prestaged_paths": 1,
"concurrent_write": 1,
"config_error": 1,
@@ -2624,6 +2625,7 @@
"ghost_storage_unknown": 1,
"git_branch_unborn": 1,
"git_checkout_required": 1,
+ "git_command_stopped": 1,
"git_conversion_blocked": 1,
"git_conversion_delta": 1,
"git_conversion_incomplete": 1,
diff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.md
index f2560407b5..3bc49a2772 100644
--- a/docs/guides/error-codes.md
+++ b/docs/guides/error-codes.md
@@ -1004,6 +1004,16 @@ Reasons: `assume_unchanged`, `skip_worktree`, `not_staged`.
More: [docs/guides/shared-checkout-git.md#outcomes](../../docs/guides/shared-checkout-git.md#outcomes)
+### commit_paths_unmerged
+
+<a id="commit_paths_unmerged"></a>
+
+| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |
+|---|---|---|---|---|---|---|
+| The commit was refused before staging: a named file still has unresolved merge conflicts in the index, so committing it would publish its conflict markers. | Git keeps the two sides of a conflicted file (after a merge, rebase or stash pop that stopped on a conflict) as unmerged index entries until someone resolves it; staging it would record the file with its markers as resolved. | Resolve each file (edit out the markers, or git checkout --ours/--theirs -- <file>), mark it resolved with git add -- <file>, then rerun the commit. | user | `repeat the read that failed` | 1 | no |
+
+More: [docs/guides/shared-checkout-git.md#outcomes](../../docs/guides/shared-checkout-git.md#outcomes)
+
### commit_prestaged_paths
<a id="commit_prestaged_paths"></a>
@@ -2236,6 +2246,18 @@ More: [docs/guides/repair.md#ghost-pages](../../docs/guides/repair.md#ghost-page
|---|---|---|---|---|---|---|
| The canonical root is not inside a Git checkout, so its Git effects have nothing to commit to. | Only the operator of the brain host can change what blocks this. | Initialize the root as a Git repository with a first commit and a remote on the brain host, then rerun; a database-only source needs no Git durability. | host_admin | `gbrain doctor --json` | 1 | no |
+### git_command_stopped
+
+<a id="git_command_stopped"></a>
+
+| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |
+|---|---|---|---|---|---|---|
+| A git command was stopped before it finished (its time limit, an output limit, or a signal from outside gbrain), so gbrain did not use its partial output. | Git itself works; the child ended without exiting on its own, and a cut-off listing read as the answer would stage, restore or report the wrong files. | Rerun the same command once. For a signal, check the machine first (the out-of-memory killer or a supervisor); if a time limit stops it again, tell the user which command and checkout. | agent | `repeat the read that failed` | 1 | yes |
+
+Reasons: `timeout`, `output_limit`, `signal`.
+
+More: [docs/guides/shared-checkout-git.md#outcomes](../../docs/guides/shared-checkout-git.md#outcomes)
+
### git_conversion_blocked
<a id="git_conversion_blocked"></a>
diff --git a/docs/guides/shared-checkout-git.md b/docs/guides/shared-checkout-git.md
index bd73fa4d65..7ac15a004c 100644
--- a/docs/guides/shared-checkout-git.md
+++ b/docs/guides/shared-checkout-git.md
@@ -218,6 +218,7 @@ Follow the error's `fix.next` as the
| <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. |
| `commit_paths_invalid` | 1 | No paths, a path outside the checkout, the checkout root itself, or a path git would not stage (one outside a sparse-checkout definition included). Name the explicit files you wrote and rerun. |
| <a id="commit_paths_skipped"></a>`commit_paths_skipped` | 1 | Git left a named path out of the commit: a modified file flagged assume-unchanged or skip-worktree (`reason` `assume_unchanged`, `skip_worktree`) a file inside a nested Git repository (`not_staged`), or, under a named folder, a tracked file the index holds as staged for removal while it is still on disk, as after `git rm --cached` (`staged_for_removal`; nothing is committed, and the refusal names both ways out: `gbrain git commit-push --untrack` to stop tracking it, `git restore --staged` to keep it tracked). The other named paths were committed (and, on a classic checkout, pushed); `detail` lists each skipped path with its `reason` and a plain `why` (for example "it sits inside the nested Git repository brain/imports"), the commit and the pushed head, or the push failure (`publish`) when the push failed too; the push log gets one `[push] SKIPPED, NEEDS ATTENTION` line with the same reasons. `--dry-run` runs the same check and reports the same paths and reasons, without writing the push log. An empty or broken `.git` folder, a `.git` file pointing at a repository that no longer exists, or a `.git` link to the repository's own `.git`, is not a nested repository: Git commits the files under it, and so does commit-push. A path spelled through a symlinked folder (a source path that links into the repository) names the file at its real place in the checkout. Check the flags with `git ls-files -v -- <path>`; clear them only after the user agrees, one flag per call (`git update-index --no-assume-unchanged -- <path>`, `git update-index --no-skip-worktree -- <path>`; given both, git clears only the first), and remember skip-worktree is often set on purpose to keep local edits out of commits, or move the file out of the nested repository, then rerun. A skip-worktree file absent from disk (a sparse checkout), a flagged gitlink and ignored files under a named directory are not reported. |
+| `commit_paths_unmerged` | 1 | A named file still has unresolved merge conflicts in the index (after a merge, rebase or stash pop that stopped on a conflict), so committing it would publish its conflict markers; nothing was staged or committed, and the file stays unmerged. `detail` lists the files. Show the user `git diff -- <file>`, resolve each one with them (edit out the markers, or keep one side with `git checkout --ours` or `--theirs -- <file>`), mark it resolved with `git add -- <file>`, then rerun. `git ls-files -u -- <file>` prints nothing once it is resolved. |
| `commit_prestaged_paths` | 1 | Another writer staged files under a directory you named; nothing was staged or committed. Name your own files explicitly. Unstage the others (`git restore --staged -- <file>`, which keeps their bytes) only after the user agrees. |
| `commit_outside_source_root` | 1 | The commit, or a local commit about to be published, changes files outside the brain's [source root](#source-roots); nothing was pushed. Show the user `git show --stat <sha>`; rerun with `--allow-outside-source-root` only if they want it published. |
| `git_index_locked` | 1 | A git command that does not take the writer lock held `index.lock`. Retry once after a few seconds. |
@@ -230,6 +231,7 @@ Follow the error's `fix.next` as the
| `push_unconfirmed` | 4 | The commit is durable locally but no push destination confirmed it (network, credentials, branch protection, a remote that kept moving, or another push that held the push lock for the whole wait). Fix what the message names, then run `gbrain git commit-push --push-only`. Never force-push. |
| `writer_coordinator_required` | 1 | This is a managed worktree. Stop using git for pages; save them through `put_page` and the other gbrain write tools. `scripts/brain-commit-push.sh` refuses this way on a checkout marked managed and commits nothing; `gbrain git commit-push` refuses this way when git left a named page out of its commit (the same causes as `commit_paths_skipped`), after committing the other named paths locally. Ask the user before re-saving such a page through `put_page` with the managed source (`gbrain put --source-id <source> <slug>`, or `source_id` over MCP; without it the write goes to the default source): it replaces the stored page with the file's content. |
| `git_unavailable` | 1 | A git command failed, often a missing `user.name`/`user.email` or a refusing pre-commit hook. Read the message, fix that, rerun. When the branch names a remote that does not exist (a typo or a broken clone), the run stops before committing: fix the name or add the remote, then rerun. A checkout with no remote at all commits locally instead (`committed_local`). |
+| `git_command_stopped` | 1 | A git command did not finish on its own: it ran past its time limit (`reason` `timeout`) or something outside gbrain killed it (`reason` `signal`, often the out-of-memory killer). Git itself works, and gbrain did not use the partial output. Rerun once; for a signal check the machine first, and if a time limit stops it again, tell the user which command and checkout the message names. The size of a listing is never a reason: gbrain reads git's whole output, so naming a folder that holds most of a large checkout works. |
`--pull` reports `up_to_date`, `advanced`, `ahead` (local commits not yet
pushed; run `--push-only`), `skipped_dirty` (only with `--require-clean`) or
diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsv
index e13bca3ed1..7fddaac9a5 100644
--- a/scripts/module-size-limits.tsv
+++ b/scripts/module-size-limits.tsv
@@ -50,7 +50,7 @@ src/core/search/evidence-delivery.ts 1759 ratchet +5 W5: EvidencePlan.rankCut re
src/commands/config.ts 1546 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); +4 GBRA-377 PR B: skills.resolver.* file-plane routing (doc line, the one-line router and its two dispatch lines; logic in core/setup/skill-resolver-config.ts); +8 train C: #8921 #7346 nested credential redaction on top of master's config growth; +1 train C: #9145 config.ts edit on top of #8921 #7346; +7 #8920: plural, acronym and credential secret words with the count-word exception (isSensitiveConfigKey) and URL userinfo masking (redactConfigValue)
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 1774 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 url_source_origin row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8834: 1683 + 1; +1 #8828: the refresh_replan_own_commits_8828 row (1684 + 1 at the 0.60.618.0 slot); +1 the managed commit-push unpublished-count row; +1 the refresh publish-diverged default row; +1 GST-2051 ungranted_member_writes_gst2051 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-731 think_window_trajectory_gst731 row and +1 GST-1602 purge_cancels_deferred_write_gst1602 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the gate-ahead on #8915 v0.60.621.0: 1688 + 2; +1 GST-2059: owner_reads_private row; +1 #8888: the record-origin checkout lock-down row (re-summed at the Q6 stack on #8934 v0.60.625.0: 1691 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 E1/F3/F4 rows (since TBD until the merge slot), re-summed at the master merge; +1 GBRA-284 personal_sources_gbra284 row (since TBD until the merge slot) (re-summed at the QM wave merge onto master v0.60.626.0: 1692 + 3); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 GST-1158 v3: the qm_personal_structured_gst1158 row (since TBD until the merge slot); +1 #8477 GST-1158 F2 personal-tools row at the QM wave merge (1695 + 1); +1 GST-1158 F9: the attest_direct_page_writes_deferred_gst1158 row (since TBD until the merge slot); +1 #8483 memory_propose row at the QM wave merge (1696 + 1); +1 GST-1094 gap 4: the qm_admin_http_gst1094 row (since TBD until the merge slot); +1 GST-1158: the member_email_link_gst1158 row (since TBD until the merge slot); +2 #8479 member-email rows at the QM wave merge (1697 + 2); +1 GST-2112: ingest_keeps_readers_gst2112 row (re-summed at the Q7 v0.60.627.0 merge: 1692 + 1); +1 #8982 federated_member_writes_8982 row (since TBD until the merge slot; rows are data and cannot move); +1 GST-2116 commit_push_skipped_paths_gst2116 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q10 slot on #9009 ee0f4a78: 1694 + 1; +1 GST-2118 pending_ledger_flagged_gst2118 row (since TBD until the merge slot; rows are data and cannot move), re-summed at the Q12 slot on #9016 afb49de5: 1695 + 1; +1 GBRA-431: read_scope_params_gbra431 row (rows are data and cannot move), re-summed at the #9032 stack merge: 1697 measured; +2 GST-2201 sync_restored_file_gst2201 and purge_keeps_committed_file_gst2201 rows (since is the current VERSION until the merge slot; +1 GST-2243 remember_share_gst2243 row (re-summed at the #9098 stack merge: 1699 + 1); +1 GST-2312 #9024 sync_filter_owned_hold_9024 row (re-summed at the #9064 stack merge: 1700 + 1; rows are data and cannot move); +2 access-privacy wave (0.60.649.0): the owner_private_facts_gst2089 and private_labels_write_ahead_gst2092 rows; +1 GBRA-443 private_labels_batch_exit_gbra443 row (rows are data and cannot move), re-summed at the 0.60.650.0 slot on #9038: 1703 + 1; +1 postgres_tls_default row (since TBD until the merge slot; rows are data and cannot move), re-summed at the master v0.60.651.0 merge: 1704 + 1; +1 GST-2331 sync_reads_fetch_nothing_gst2331 row (rows are data and cannot move), re-summed at the 0.60.654.0 stack on #9045 6ff5540d: 1705 + 1; +7 QM wave (#9037) rows: attest_scope_read_ops_gst1158, attest_direct_page_writes_deferred_gst1158, personal_sources_gbra284, qm_personal_structured_gst1158, memory_propose_held_writes_gst1158, member_email_link_gst1158, qm_admin_http_gst1094 (re-summed at the 0.60.655.0 stack on #9110 f9b2072e: 1706 + 7); +1 GST-2228 recreated_takes_section_keeps_stored_takes_gst2228 row (since TBD; re-summed at the keep-takes-and-link-dates train merge: 1713 + 1); +1 GST-2228 links_rows_keep_own_dates_gst2228 row (since TBD; re-summed at the same train merge: 1714 + 1); +2 the W1 + memory proposals train (#9133): attest_every_page_write_deferred_gst2249 and memory_proposals_owner_http_gst2407 rows (rows are data and cannot move), re-summed at the #9138 v0.60.661.0 stack merge: 1715 + 2 = 1717 measured; +1 #8903 effect_git_secret_gate_gst1923 row (rows are data and cannot move), re-summed at the 0.60.664.0 stack on #9142 3931adb4: 1717 + 1; +1 GST-2407 PR 3: qm_recall_own_page_contract_v4 row (rows are data and cannot move), re-summed at the 0.60.666.0 stack on #9148 69c12917: 1718 + 1; +2 GST-363 PR 1 and PR 3 (#9135): the serves_several_labels_gst363 and stdio_member_per_harness_gst363 rows; +3 #9134 train rows member_forget_names_host_9101, refresh_fence_retry_id_gst2353 and recorded_read_view_args_gst2214 (rows are data and cannot move), re-summed at the #9134 slot merge onto #8829 dfc24954: 1721 + 3; +3 source-checkouts wave rows (autopilot_git_reconcile_gbra386, unknown_drift_history_rescreen, refresh_abandon_members_gst1465), re-summed at the #9137 stack merge: 1724 + 3; persistence train 13 at 0.60.676.0: its five rows on top of 0.60.675.0; +1 GST-2250 reconcile_publish_opt_out_gst2250 row (since TBD until the merge slot; rows are data and cannot move); +1 #8902 unmanaged_push_history_scan_8902 row (re-summed at the 0.60.678.0 stack on 501742d9: 1733 + 1); +1 GST-2246 maintain_safe_free_phases_gst2246 row (since TBD until the merge slot; rows are data and cannot move), re-summed on the doctor/dream/enrich train at the 0.60.679.0 slot merge onto #9170 82932eda: 1734 + 1; +2 GST-2462 privacy_label_ignored_gst2462 and access_page_rules_gst2462 rows (rows are data and cannot move), re-summed at the #9173 slot merge onto 49a922ef: 1735 + 2; +1 GST-2107 follow-up write_capacity_low_not_refusal_gst2107 row (rows are data and cannot move), re-summed at the 0.60.681.0 slot merge onto #9173 c08d0c8b: 1737 + 1; +1 GST-2490: owner_reads_derived_gst2490 row (rows are data and cannot move); +1 GST-2468: the label_only_operator_repairs_gst2468 row (a BEHAVIOR_CHANGES row cannot move); +1 GST-2446 remember_pageless_reply_gst2446, +1 GST-2492 strict_held_facts_gst2492 and +1 GST-2346 D1 owner_facts_shared_gst2346 rows (rows are data and cannot move), re-summed at the 0.60.685.0 train merge onto #9181 405ea4cf: 1740 + 3; +1 GST-2476: the readers_label_setter_gst2476 row (rows are data and cannot move), re-summed at the #9184 slot merge onto the #9179 train 361d57c6: 1743 + 1; +1 GST-2487: the fence_fact_private_in_place_gst2487 row (rows are data and cannot move), at the same slot merge of #9188 0075f09a: 1744 + 1; +1 GST-2515: the sync_status_commits_waiting_gst2515 row (rows are data and cannot move), at the 0.60.688.0 slot merge onto 599b1234: 1745 + 1; +3 GST-2519: commit_push_untrack_gst2519, db_only_labels_kept_gst2519 and git_ignored_label_repair_gst2519 rows (rows are data and cannot move), re-summed at the 0.60.691.0 slot merge onto #9167 ad4f0aef: 1746 + 3; +3 GST-2492 PR 2: the remember_pageless_ask, strict_fact_writers_held and sync_strict_requires_managed rows (rows are data and cannot move), re-summed at the master v0.60.691.0 merge: 1749 + 3; +3 GST-2346 rows owner_forget_private, owner_forget_readers_page and member_save_withdrawn_scope (rows are data and cannot move), re-summed at the 0.60.693.0 slot merge onto #9202 840858e9: 1752 + 3; +2 GST-2518 page_label_widening_held_gst2518 and GST-2521 owner_labels_guarded_gst2521 rows and +1 GST-2511 fence_fact_widening_held_gst2511 row (rows are data and cannot move), re-summed at the 0.60.694.0 slot merge onto master 2c8320d7: 1755 + 3; +3 the GST-2515/GST-2520 notifier_retry_unwatched_gst2515 and strict_skip_mode_refusal_gst2520 rows and the GST-2456 unmanaged_push_every_site_gst2456 row, re-summed at the 0.60.698.0 slot merge onto #9217 887398f0: 1758 + 3; +2 GST-2407: context_pack scope read and attestRead over the owner route; +9 releases per batch: the generated-table import, the releasedIn helper and its comment, the spread of RELEASED_BEHAVIOR_CHANGES; new rows now live in behavior-changes.d/ and stop growing this file (re-summed at the master v0.60.704.0 merge: 1763 + 9 = 1772 measured); +2 #7646 (GBRA-404 salvage): the disclosure lists releases oldest first whatever the table order
-src/core/git/commit-push.ts 1614 ratchet GST-2519: --untrack (#7753 port: untrackTargets, untrackPaths; untrackAdmitted, the managed-worktree storage.db_only admission; previewUntrack) and the staged-removal hint in skippedPathsError grow the commit door past the 1500 default (master 1487 + 140); GST-2456 (#9174): crossed the 1500 unlisted cap at the GST-2456 merge of master v0.60.678.0: pushBase (the scan base and lease read live from every push URL, #5138) and the scan budget and progress options; Ctx and publish internals keep it in this file (1487 + 31), re-summed at the master 0c577834 merge into #9198: 1627 + 31; +47 #8928 salvage rebuild (GBRA-404) #7752: previewPaths (the dry run asks git against a copied index), admitPaths/flaggedEntries/previewRoots split out of commitPaths and shared with it, settlePending exported (re-summed on master v0.60.699.0: 1658 + 47); +1 GBRA-404 /ship round 2: the dry run stages into its temporary index copy for real (staged-rename partner refusal); GST-2767: the git runner (git-run.ts) and the skipped-path checks with their reasons (skipped-paths.ts) moved out, 1600; +14 GST-2767 staged_for_removal refusal and dry-run skipped-path parity
+src/core/git/commit-push.ts 1615 ratchet GST-2519: --untrack (#7753 port: untrackTargets, untrackPaths; untrackAdmitted, the managed-worktree storage.db_only admission; previewUntrack) and the staged-removal hint in skippedPathsError grow the commit door past the 1500 default (master 1487 + 140); GST-2456 (#9174): crossed the 1500 unlisted cap at the GST-2456 merge of master v0.60.678.0: pushBase (the scan base and lease read live from every push URL, #5138) and the scan budget and progress options; Ctx and publish internals keep it in this file (1487 + 31), re-summed at the master 0c577834 merge into #9198: 1627 + 31; +47 #8928 salvage rebuild (GBRA-404) #7752: previewPaths (the dry run asks git against a copied index), admitPaths/flaggedEntries/previewRoots split out of commitPaths and shared with it, settlePending exported (re-summed on master v0.60.699.0: 1658 + 47); +1 GBRA-404 /ship round 2: the dry run stages into its temporary index copy for real (staged-rename partner refusal); GST-2767: the git runner (git-run.ts) and the skipped-path checks with their reasons (skipped-paths.ts) moved out, 1600; +14 GST-2767 staged_for_removal refusal and dry-run skipped-path parity; +1 commit_paths_unmerged: admitPaths calls assertNoUnmergedPaths (skipped-paths.ts)
src/commands/auth.ts 1512 ratchet new row: crossed the 1500 unlisted cap at the v0.60.595.0 merge: GST-1113 --attest-sources help lines plus GST-1158 F3 --attest-read help lines (3); CLI help lines cannot move; re-measured at the Train A merge onto master v0.60.708.0: 1503 + 2 (the #8930 shared-token notice) = 1505; re-measured at the Train C merge onto Train B (#9246 onto #9223): 1505 -> 1509, both sides' growth; +3 Wakeshift PR 2 (#8709), one line each: revoke (by name) calls forgetWakePrincipal for every token row its UPDATE returned (RETURNING 1 became RETURNING id, so no line added there), revokeById calls it for the revoked token id, and revokeClient calls it for the revoked OAuth client id; each call ends that principal's open watches and queues its Wakeshift forget (logic in core/wakeshift/forget.ts) after the command's own UPDATE/DELETE; master 1509 + 3 = 1512
src/core/markdown.ts 1501 ratchet new row: crossed the 1500 unlisted cap at the train C merge: #8921 #7052 tag_too_long hold (tagLengthHold import; the limit lives in core/tag-limit.ts) on top of master's 1500
src/mcp/dispatch.ts 1502 ratchet new row: crossed the 1500 unlisted cap with GBRA-504 guest notes (+4): the guest attribution option threaded into dispatch (parsing and checks live in core/guests/admission.ts); next growth should peel the response-cap block into a sibling module
diff --git a/src/core/cli-flag-registry.generated.ts b/src/core/cli-flag-registry.generated.ts
index d33235b8ed..ae2a911ebf 100644
--- a/src/core/cli-flag-registry.generated.ts
+++ b/src/core/cli-flag-registry.generated.ts
@@ -82,7 +82,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'init': ['--abandon', '--absolute-git-dir', '--accept-all', '--accept-capabilities', '--access', '--access-policy', '--acknowledge-managed', '--admin-intent', '--adopt', '--advertise', '--after', '--aliases', '--all', '--all-drifted', '--allow-create-db', '--allow-docker', '--allow-outside-source-root', '--allow-without-owner', '--anchor', '--applied', '--apply', '--approval-out', '--approved', '--as', '--assign-corpus', '--attest-actor', '--attest-ops', '--attest-read', '--attest-sources', '--audit', '--auto', '--auto-additive', '--background', '--base', '--batch', '--bound-slug-prefixes', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--cached', '--catch-up', '--channel', '--chat-model', '--check', '--check-downgrade', '--class', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--code', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--content-root', '--continue', '--conversation', '--cursor', '--db-only', '--deadline', '--decisions', '--dest', '--detach', '--detail', '--dim', '--disable', '--drain', '--email', '--embedding-dimensions', '--embedding-model', '--enable', '--entity', '--exclude', '--expand', '--expansion-model', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--expected-state', '--explain', '--facts', '--fast', '--federated', '--file', '--filter', '--first-parent', '--fix', '--force', '--force-retry', '--force-schema', '--format', '--fresh-token', '--from', '--from-meetings', '--from-pages', '--full', '--git', '--grammar', '--grant-types', '--group-by', '--harness', '--held', '--help', '--hold-state', '--holds', '--http', '--id', '--images', '--include-ambiguous', '--include-covered', '--include-cross-entity', '--include-failures', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--infer-dates', '--input', '--install', '--instructions-only', '--issuer-url', '--job-isolation', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--label-lowerings', '--lanes', '--legacy-lock', '--limit', '--link', '--list', '--list-out', '--local', '--local-postgres', '--markdown', '--max-cost-usd', '--max-facts', '--max-requests', '--max-rss', '--max-usd', '--may-act-for', '--mcp-only', '--mcp-url', '--member', '--members', '--members-file', '--migrate-only', '--migration', '--min-n', '--mode', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-git', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-stdio-member', '--no-verify', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--of', '--older-than', '--once', '--only', '--operation', '--output', '--oversized', '--page', '--params', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--pending', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--prefix', '--preview', '--private-pages', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--qm', '--query', '--question', '--quiet', '--readers', '--reason', '--rebase', '--rebuild', '--redact-paths', '--reference-date', '--remediate', '--remote', '--remove', '--repair', '--repair-unknown-markers', '--repo', '--request', '--request-id', '--require-clean', '--reset', '--resolve', '--restart-only', '--resume', '--retire', '--retry-failed', '--retry-parked', '--runtime', '--safe', '--save', '--scan-secrets', '--scan-timeout', '--schedule', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--segmented', '--self-transfer', '--semantic', '--serves', '--session', '--session-id', '--shared-skills', '--show-toplevel', '--side', '--since', '--since-last-run', '--skip', '--skip-embed-check', '--skip-failed', '--slug', '--slugs', '--slugs-file', '--source', '--source-id', '--sources', '--squash', '--src-subpath', '--stale', '--state', '--status', '--stdin', '--stdio-member', '--stop-mcp', '--strategy', '--supabase', '--surface', '--swap-only', '--take', '--tier', '--timeout', '--to', '--token', '--touchpoint', '--type', '--types', '--uninstall', '--unsettle', '--untrack', '--url', '--url-env', '--user', '--vacuum', '--verbose', '--version', '--wait', '--warn-only', '--watch', '--working-tree', '--workspace', '--yes'],
'integrations': ['--auto', '--brain', '--dry-run', '--help', '--json', '--overwrite', '--refresh', '--source', '--target'],
'integrity': ['--accept-pending', '--as', '--auto', '--backend', '--background', '--body', '--brain', '--check', '--confidence', '--cost', '--dry-run', '--explain', '--follow', '--fresh', '--help', '--json', '--limit', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--review-lower', '--room', '--skip-bare-tweet', '--skip-urls', '--source', '--timeout', '--timings', '--type', '--wait'],
- 'jobs': ['--abbrev-ref', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt-slug-path', '--agent', '--alert', '--aliases', '--all', '--all-sources', '--allow-empty', '--allow-shell-jobs', '--allowed-operations', '--apply', '--approval-out', '--approved', '--as', '--asof', '--assign-corpus', '--attest-actor', '--attest-ops', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--base', '--batch-size', '--body', '--bound-slug-prefixes', '--brain', '--break-lock', '--budget-ms', '--bundled', '--by-mention', '--cached', '--calls', '--card', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--clear', '--cli-path', '--client', '--close', '--cluster-errors', '--code', '--concurrency', '--confidence', '--confirm-destructive', '--confirm-relocated-root', '--cost-estimate', '--cursor', '--date', '--dated-since', '--days', '--decisions', '--delay', '--detach', '--detail', '--diff-filter', '--dir', '--drain', '--drain-timeout', '--drop-field', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--enable', '--entities', '--exclude', '--exclude-standard', '--expect', '--expect-catalog', '--expect-local', '--expect-upstream', '--expected-revision', '--expected-state', '--explain', '--facts', '--federated-read', '--ff-only', '--file', '--filter', '--filters', '--finalize', '--finished-since', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--force-schema', '--format', '--fresh', '--from-index', '--from-json', '--from-meetings', '--full', '--full-history', '--fuzzy', '--git', '--grammar', '--grammar-diagnostics', '--group', '--group-by', '--hard-deadline', '--health-interval', '--held', '--help', '--hold-state', '--http', '--id', '--idempotency-key', '--ids', '--images', '--include', '--include-ambiguous', '--include-content', '--include-deleted', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-null-signature', '--infer-dates', '--inject-bootstrap', '--inline', '--input', '--input-json', '--install', '--interval', '--is-ancestor', '--is-shallow-repository', '--job-id', '--job-isolation', '--json', '--keep', '--kind', '--lanes', '--legacy-lock', '--limit', '--list', '--local', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--max-cost', '--max-cost-usd', '--max-crashes', '--max-rss', '--max-sources', '--max-stalled', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--migrate-only', '--migration', '--min-context', '--missing-path', '--mode', '--model', '--multimodal', '--name', '--name-only', '--ner', '--nice', '--no-assume-unchanged', '--no-auto-embed', '--no-autopilot-install', '--no-bulk', '--no-confirm', '--no-delegate', '--no-embed', '--no-embedding', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-lanes', '--no-llm', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-skip-worktree', '--no-verify', '--no-worker', '--non-interactive', '--now', '--of', '--older-than', '--once', '--only', '--order', '--others', '--out', '--output', '--override-disabled', '--oversized', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--parked-code', '--pat-file', '--patch', '--path', '--pause', '--pglite', '--phase', '--pid-file', '--plan', '--port', '--prefer', '--prefix', '--preview', '--priority', '--privacy-url', '--probe', '--propose', '--prune-orphans', '--pull', '--purge', '--qm', '--question', '--queue', '--queue-only', '--quiet', '--rate', '--readers', '--reads-unscoped', '--reason', '--reason-scan-limit', '--rebuild', '--recent', '--record', '--redact-paths', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--refresh-operations', '--remediate', '--repo', '--request-id', '--reset-checkpoint', '--restart-only', '--resume', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--review-lower', '--routing', '--row', '--save', '--schedule', '--scope', '--scopes', '--section', '--segment-limit', '--segmented', '--select', '--self-transfer', '--serial', '--serves', '--session', '--show-toplevel', '--side', '--sigkill-rescue', '--since', '--skill-loading', '--skills-index-only', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-guard', '--source-id', '--sources', '--src-subpath', '--staged', '--stale', '--state', '--statement-timeout', '--status', '--stdio-member', '--stop-mcp', '--strategy', '--suites', '--surface', '--swap-only', '--synopsis', '--target', '--terms-url', '--text', '--thin', '--thin-threshold', '--tier', '--timeout', '--timeout-ms', '--to', '--token', '--token-env', '--trust', '--type', '--types', '--unattended', '--uninstall', '--unschedule', '--unshallow', '--untrack', '--updated-after', '--url', '--user', '--vectors', '--verbose', '--verify', '--version', '--wakeshift', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],
+ 'jobs': ['--abbrev-ref', '--access', '--access-policy', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt-slug-path', '--agent', '--alert', '--aliases', '--all', '--all-sources', '--allow-empty', '--allow-shell-jobs', '--allowed-operations', '--apply', '--approval-out', '--approved', '--as', '--asof', '--assign-corpus', '--attest-actor', '--attest-ops', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--base', '--batch-size', '--body', '--bound-slug-prefixes', '--brain', '--break-lock', '--budget-ms', '--bundled', '--by-mention', '--cached', '--calls', '--card', '--catalog', '--catch-up', '--channel', '--check', '--check-downgrade', '--check-only', '--clear', '--cli-path', '--client', '--close', '--cluster-errors', '--code', '--concurrency', '--confidence', '--confirm-destructive', '--confirm-relocated-root', '--cost-estimate', '--cursor', '--date', '--dated-since', '--days', '--decisions', '--delay', '--detach', '--detail', '--diff-filter', '--dir', '--drain', '--drain-timeout', '--drop-field', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--enable', '--entities', '--exclude', '--exclude-standard', '--expect', '--expect-catalog', '--expect-local', '--expect-upstream', '--expected-revision', '--expected-state', '--explain', '--facts', '--federated-read', '--ff-only', '--file', '--filter', '--filters', '--finalize', '--finished-since', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--force-schema', '--format', '--fresh', '--from-index', '--from-json', '--from-meetings', '--full', '--full-history', '--fuzzy', '--git', '--grammar', '--grammar-diagnostics', '--group', '--group-by', '--hard-deadline', '--health-interval', '--held', '--help', '--hold-state', '--http', '--id', '--idempotency-key', '--ids', '--images', '--include', '--include-ambiguous', '--include-content', '--include-deleted', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-null-signature', '--infer-dates', '--inject-bootstrap', '--inline', '--input', '--input-json', '--install', '--interval', '--is-ancestor', '--is-shallow-repository', '--job-id', '--job-isolation', '--json', '--keep', '--kind', '--lanes', '--legacy-lock', '--limit', '--list', '--local', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--max-cost', '--max-cost-usd', '--max-crashes', '--max-rss', '--max-sources', '--max-stalled', '--max-usd', '--max-waiting', '--may-act-for', '--mcp-only', '--member', '--members', '--members-file', '--migrate-only', '--migration', '--min-context', '--missing-path', '--mode', '--model', '--multimodal', '--name', '--name-only', '--ner', '--nice', '--no-assume-unchanged', '--no-auto-embed', '--no-autopilot-install', '--no-bulk', '--no-confirm', '--no-delegate', '--no-embed', '--no-embedding', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-lanes', '--no-llm', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-skip-worktree', '--no-verify', '--no-worker', '--non-interactive', '--now', '--of', '--older-than', '--once', '--only', '--order', '--others', '--ours', '--out', '--output', '--override-disabled', '--oversized', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--parked-code', '--pat-file', '--patch', '--path', '--pause', '--pglite', '--phase', '--pid-file', '--plan', '--port', '--prefer', '--prefix', '--preview', '--priority', '--privacy-url', '--probe', '--propose', '--prune-orphans', '--pull', '--purge', '--qm', '--question', '--queue', '--queue-only', '--quiet', '--rate', '--readers', '--reads-unscoped', '--reason', '--reason-scan-limit', '--rebuild', '--recent', '--record', '--redact-paths', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--refresh-operations', '--remediate', '--repo', '--request-id', '--reset-checkpoint', '--restart-only', '--resume', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--review-lower', '--routing', '--row', '--save', '--schedule', '--scope', '--scopes', '--section', '--segment-limit', '--segmented', '--select', '--self-transfer', '--serial', '--serves', '--session', '--show-toplevel', '--side', '--sigkill-rescue', '--since', '--skill-loading', '--skills-index-only', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-guard', '--source-id', '--sources', '--src-subpath', '--staged', '--stale', '--state', '--statement-timeout', '--status', '--stdio-member', '--stop-mcp', '--strategy', '--suites', '--surface', '--swap-only', '--synopsis', '--target', '--terms-url', '--text', '--theirs', '--thin', '--thin-threshold', '--tier', '--timeout', '--timeout-ms', '--to', '--token', '--token-env', '--trust', '--type', '--types', '--unattended', '--uninstall', '--unschedule', '--unshallow', '--untrack', '--updated-after', '--url', '--user', '--vectors', '--verbose', '--verify', '--version', '--wakeshift', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],
'lint': ['--abbrev-ref', '--accept-pending', '--add', '--admin-intent', '--adopt-slug-path', '--as', '--audit', '--autostash', '--background', '--brain', '--branch', '--cached', '--client', '--confirm-relocated-root', '--conflicts', '--dry-run', '--enable', '--error-unmatch', '--exclude', '--expect-remote', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--ff-only', '--file', '--fix', '--follow', '--force', '--get', '--get-all', '--git-dir', '--git-path', '--grammar-diagnostics', '--hard', '--help', '--id', '--infer-entity', '--is-inside-work-tree', '--json', '--keep', '--keep-checkout', '--local', '--local-env-vars', '--manifest', '--max-cost-usd', '--no-accept-pending', '--no-assume-unchanged', '--no-autostash', '--no-cron', '--no-pull', '--no-renames', '--no-skip-worktree', '--no-tags', '--no-verify', '--older-than', '--only', '--pat-file', '--path', '--porcelain', '--prefer', '--preview', '--probe', '--progress-interval', '--progress-json', '--provenance', '--pull', '--purge', '--push-only', '--quiet', '--readers', '--rebase', '--require-clean', '--resolve', '--room', '--scan-secrets', '--scan-timeout', '--scopes', '--self-transfer', '--short', '--show-toplevel', '--slug', '--slugs', '--source', '--source-id', '--stdin', '--timeout', '--timings', '--unset-all', '--untracked-files', '--verify', '--wait', '--yes'],
'loops': ['--all', '--as-of', '--brain', '--dry-run', '--fail-fast', '--help', '--json', '--note', '--source', '--stale-ok', '--status', '--tools-json', '--top', '--type'],
'lsd': ['--brain', '--force-resume', '--help', '--json', '--judge-model', '--limit', '--list-runs', '--max-cost', '--max-far-set', '--max-ideas-per-judge-call', '--max-usd', '--no-save', '--resume', '--save', '--source', '--strict-budget', '--yes'],
diff --git a/src/core/error-registry.ts b/src/core/error-registry.ts
index 9df90d126b..3632436c7b 100644
--- a/src/core/error-registry.ts
+++ b/src/core/error-registry.ts
@@ -192,6 +192,7 @@ export const CODES = {
command_failed: { class: 'server', summary: "The command failed before it wrote its JSON result." },
commit_lock_busy: { class: 'retryable', summary: "Another writer held the checkout's commit lock for the whole wait, so nothing was committed.", docs: 'docs/guides/shared-checkout-git.md#outcomes' },
commit_base_moved: { class: 'caller', summary: "A file named with --base changed at HEAD since the writer read it, so nothing was staged or committed.", why: "--base <path>=<blob> binds a commit to the bytes the writer read; another writer committed that file since, and committing now would overwrite its change.", docs: 'docs/guides/shared-checkout-git.md#base-check', suggestion: 'Read the file at HEAD again, redo the change on it, and rerun with the new --base the message names.' },
+ commit_paths_unmerged: { class: 'caller', actor: 'user', summary: "The commit was refused before staging: a named file still has unresolved merge conflicts in the index, so committing it would publish its conflict markers.", why: "Git keeps the two sides of a conflicted file (after a merge, rebase or stash pop that stopped on a conflict) as unmerged index entries until someone resolves it; staging it would record the file with its markers as resolved.", docs: 'docs/guides/shared-checkout-git.md#outcomes', suggestion: 'Resolve each file (edit out the markers, or git checkout --ours/--theirs -- <file>), mark it resolved with git add -- <file>, then rerun the commit.' },
commit_paths_invalid: { class: 'caller', summary: "The commit was refused before staging: no paths, a path outside the checkout, the whole checkout, or a path git would not stage.", docs: 'docs/guides/shared-checkout-git.md#outcomes' },
commit_paths_skipped: { class: 'caller', reasons: ['assume_unchanged', 'skip_worktree', 'not_staged'], summary: "gbrain git commit-push (or the brain's committed commit-push helper) committed the other named paths but git left the listed ones out: a modified file flagged assume-unchanged or skip-worktree, or a file inside a nested Git repository.", why: 'git add stages nothing for those and still exits 0 (or, for a named skip-worktree file, refuses every path), so reporting success would leave the write uncommitted with nothing in any log.', docs: 'docs/guides/shared-checkout-git.md#outcomes', suggestion: 'Read each skipped path and its reason in the message. Clear an assume-unchanged or skip-worktree flag after the user agrees, one flag per call (git update-index --no-assume-unchanged -- <path>, git update-index --no-skip-worktree -- <path>), or move a file out of a nested repository, then rerun the same commit-push.' },
commit_prestaged_paths: { class: 'consent', summary: "The commit was refused before staging: files another writer had already staged sit under a named directory, and committing them would publish that writer's work.", docs: 'docs/guides/shared-checkout-git.md#outcomes', actor: 'user' },
@@ -414,6 +415,7 @@ export const CODES = {
git_target_changed: { class: 'caller', actor: 'user', summary: "A strict (canonical: git) write's file changed on disk while it was being committed, so nothing was committed and the write was not published.", why: "The door commits exactly the bytes the write published, and checks the file's hash against them before and after Git stores it. An edit landing in between would otherwise be committed while the database records other content; recovery leaves the changed file as it is.", suggestion: "When the file holds neither the write's bytes nor the version before it, the write is held in recovery (blocked reason unexpected_file_bytes) and the source's later writes wait behind it; when it holds the version before the write, nothing is held and the write failed; when it holds the write's own bytes again by the time recovery runs, recovery restores the version before the write and the write failed, with nothing held. After a failure, read the page before resubmitting it with a new request_id. To resolve a held write, preview with gbrain repair stuck-recovery --source <id> --json, ask the user which version to keep, then run gbrain repair stuck-recovery --source <id> --keep disk|prior --apply --expect <preview_hash> --yes (disk keeps the edit).", fix: { argv: ['gbrain', 'sources', 'writer', 'status', '--json'], consent: [], actor: 'agent', why: 'Read-only: lists the held request, its source and its blocked reason.', requires_exclusive: false } },
git_target_ignored: { class: 'caller', summary: "A .gitignore rule excludes the canonical file, so its Git effect cannot commit it; the effect parks at once.", suggestion: 'Remove or narrow the rule and commit that change, then run gbrain sources writer retry-effects <source> --parked-code git_target_ignored; or keep the file out of Git and leave the effect parked.' },
git_target_unsafe: { class: 'caller', summary: "Git cannot identify the existing canonical file by its native spelling." },
+ git_command_stopped: { class: 'retryable', summary: "A git command was stopped before it finished (its time limit, an output limit, or a signal from outside gbrain), so gbrain did not use its partial output.", why: "Git itself works; the child ended without exiting on its own, and a cut-off listing read as the answer would stage, restore or report the wrong files.", reasons: ['timeout', 'output_limit', 'signal'], docs: 'docs/guides/shared-checkout-git.md#outcomes', suggestion: 'Rerun the same command once. For a signal, check the machine first (the out-of-memory killer or a supervisor); if a time limit stops it again, tell the user which command and checkout.' },
git_unavailable: { class: 'retryable', summary: "A git command did not complete." },
git_object_missing: { class: 'caller', summary: "A committed file's Git object is missing from the checkout and its working-tree copy differs or is gone, so managed sync holds that file alone; a partial clone that lacks a tree of the synced commit stops the run.", why: "An interrupted gc, a partial clone without its promisor remote or disk corruption can drop an object a commit still names. Sync imports the working-tree bytes when they hash to the committed blob id; otherwise it imports nothing from a guess, and the rest of the source keeps syncing.", docs: 'docs/guides/write-refusals.md#git_object_missing', suggestion: 'In a partial clone (git clone --filter), which sync never fetches from, fetch the blob with git cat-file -p <blob> in the checkout or check the file out, or, when the run stopped on a missing tree, run the git ls-tree -r -d <commit> it names; otherwise run git fsck in the checkout to see what is missing and restore it with git fetch (a shallow clone) or from a backup. Then sync again; every sync re-tests the hold.' },
git_conversion_blocked: { class: 'consent', actor: 'user', summary: "Converting a source to git-canonical would discard database content or cannot place it, so the apply wrote nothing.", reasons: ['both_moved', 'held_drift_both', 'held_drift_unknown_differs', 'deleted_in_git', 'uncommitted_edit', 'ignored_target', 'unparseable', 'unsafe_path', 'segmented_page', 'export_mismatch', 'git_overwrites_database', 'ignore_status_unknown', 'no_record_both_moved', 'no_record_no_evidence'], why: "gbrain sources canonical --to git applies only when every database row will be in Git or in a declared database-only class afterwards. The preview counts what would be lost or cannot be placed by category (detail lists them): both_moved and held_drift_both, a page Git and the database both changed; no_record_both_moved and no_record_no_evidence, a page with no import record whose content history shows both sides moved, or shows nothing, until the owner's --decisions file decides it; deleted_in_git, a page Git deleted that the database edited since; uncommitted_edit, a working-tree edit the adoption would overwrite; ignored_target, a page whose file Git ignores without a declared class; unparseable and unsafe_path, a committed file or path sync cannot read; segmented_page, a segmented page conversion does not adopt yet; export_mismatch, a page whose export does not read back equal; git_overwrites_database, a page version a strict pass would replace that nothing accepted; ignore_status_unknown, a target whose ignore status Git cannot read (beyond a symlink, outside the checkout, a timed-out check). There is no override.", docs: 'docs/designs/GIT_CANONICAL_MEMORY.md#conversion', suggestion: 'Relay the categories and their paths (the --dry-run preview lists them) and ask the user how each should be resolved; preview again afterwards.' },
diff --git a/src/core/git/commit-push.ts b/src/core/git/commit-push.ts
index e95dc9e9a2..09c3579617 100644
--- a/src/core/git/commit-push.ts
+++ b/src/core/git/commit-push.ts
@@ -32,7 +32,7 @@ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'nod
import { literalPathspecs } from '../git-env.ts';
import { git, gitOk, type GitRun } from './git-run.ts';
export type { SkippedPath } from './skipped-paths.ts';
-import { checkoutBehindStrayGitfile, directoryStatus, worktreeOfGitdir, flaggedChanges, stagedRemovals, STAGED_FOR_REMOVAL_WHY, unindexedFiles, unstagedPaths, type SkippedPath } from './skipped-paths.ts';
+import { assertNoUnmergedPaths, checkoutBehindStrayGitfile, directoryStatus, worktreeOfGitdir, flaggedChanges, stagedRemovals, STAGED_FOR_REMOVAL_WHY, unindexedFiles, unstagedPaths, type SkippedPath } from './skipped-paths.ts';
import { GIT_SSRF_SUBCOMMAND_FLAGS, ownRemoteTransportFlags as transportFlags } from '../git-transport.ts';
import { canonicalFilesystemPath } from '../persistence/root-registry.ts';
import { assertManagedFilesystemWrite, hasFilesystemPublication, managedFilesystemRootFor, type ManagedFilesystemRoot } from '../persistence/filesystem-guard.ts';
@@ -155,7 +155,7 @@ interface Ctx {
/** Remote operations: transport hardening on every call, credentials allowed, no prompt. */
function remoteGit(root: string, sub: 'fetch' | 'push', args: string[], timeoutMs = 120_000): GitRun {
- return git(root, [...transportFlags(), sub, ...GIT_SSRF_SUBCOMMAND_FLAGS, ...args], { auth: true, timeoutMs });
+ return git(root, [...transportFlags(), sub, ...GIT_SSRF_SUBCOMMAND_FLAGS, ...args], { auth: true, timeoutMs, returnStopped: true });
}
export function gitVersion(root: string): [number, number] {
@@ -375,9 +375,9 @@ function withRenamePartners(root: string, rel: string[], env?: NodeJS.ProcessEnv
return [...out];
}
-/** Index entries that differ from HEAD, whoever staged them, with rename detection off so both sides of a rename are listed. */
-function stagedPaths(root: string): string[] {
- return git(root, ['diff', '--cached', '--no-renames', '--name-only', '-z']).stdout.split('\0').filter(Boolean);
+/** Index entries under `rel` that differ from HEAD, whoever staged them, with rename detection off so both sides of a rename are listed. */
+function stagedPaths(root: string, rel: string[]): string[] {
+ return git(root, ['diff', '--cached', '--no-renames', '--name-only', '-z', '--', ...literalPathspecs(rel)]).stdout.split('\0').filter(Boolean);
}
/** The index entries under `rel` as `ls-files -s` records, so a failed commit can put them back exactly. */
@@ -503,13 +503,14 @@ function scopeBases(root: string, opts: CommitPushOptions, rel: string[]): Map<s
function admitPaths(root: string, rel: string[], roots: string[], bases?: ReadonlyMap<string, string>, dryRun = false): void {
const outside = rel.filter(p => !insideSourceRoots(p, roots));
if (outside.length) throw outsideRootError(root, roots, outside, 'Refusing to commit');
+ assertNoUnmergedPaths(root, rel);
for (const [path, base] of bases ?? []) {
const head = git(root, ['rev-parse', '--verify', '-q', `HEAD:${path}`]).stdout.trim() || 'absent';
if (head !== base) throw opError('commit_base_moved', `${path} changed at HEAD since the writer read it (base ${base}, HEAD ${head}).`,
`Nothing was staged or committed. Read ${path} at HEAD again (git -C ${root} show HEAD:${path}), redo the change on it, and rerun with --base ${path}=${head}.`,
{ detail: JSON.stringify({ path, base, head }), docs: 'docs/guides/shared-checkout-git.md#base-check' });
}
- const swept = stagedPaths(root).filter(p => !rel.includes(p) && rel.some(spec => covers(spec, p)));
+ const swept = stagedPaths(root, rel).filter(p => !rel.includes(p) && rel.some(spec => covers(spec, p)));
const removed = new Set(stagedRemovals(root, swept));
if (swept.length && swept.every(p => removed.has(p))) {
const branch = git(root, ['symbolic-ref', '--quiet', '--short', 'HEAD']).stdout.trim();
@@ -761,7 +762,7 @@ function untrackPaths(root: string, rel: string[], message: string, scope: Commi
export interface PendingWriteThrough { path: string; since: string }
-const PENDING_NOTED = new Set(['commit_lock_busy', 'git_index_locked', 'git_index_stale', 'git_unavailable', 'git_operation_in_progress']);
+const PENDING_NOTED = new Set(['commit_lock_busy', 'git_index_locked', 'git_index_stale', 'git_unavailable', 'git_command_stopped', 'git_operation_in_progress']);
function readPendingFile(file: string, into: Map<string, string>): void {
let text: string;
@@ -1147,12 +1148,12 @@ function remoteContains(ctx: Ctx, sha: string): boolean {
if (urls.length === 0) return false;
for (const url of urls) {
if (git(ctx.root, ['ls-remote', '--get-url', '--', url]).stdout.trim() !== url) return false;
- const listed = git(ctx.root, [...transportFlags(), 'ls-remote', '--exit-code', '--', url, branchRef], { auth: true, timeoutMs: 60_000 });
+ const listed = git(ctx.root, [...transportFlags(), 'ls-remote', '--exit-code', '--', url, branchRef], { auth: true, timeoutMs: 60_000, returnStopped: true });
if (listed.code !== 0) return false;
const tip = listed.stdout.split(/\s/)[0];
if (!/^[0-9a-f]{40,64}$/.test(tip)) return false;
if (git(ctx.root, ['cat-file', '-e', `${tip}^{commit}`]).code !== 0) {
- const got = git(ctx.root, [...transportFlags(), 'fetch', '--quiet', ...fetchFlags(ctx.root), ...GIT_SSRF_SUBCOMMAND_FLAGS, '--', url, tip], { auth: true, timeoutMs: 120_000 });
+ const got = git(ctx.root, [...transportFlags(), 'fetch', '--quiet', ...fetchFlags(ctx.root), ...GIT_SSRF_SUBCOMMAND_FLAGS, '--', url, tip], { auth: true, timeoutMs: 120_000, returnStopped: true });
if (got.code !== 0) return false;
}
if (!isAncestor(ctx.root, sha, tip)) return false;
@@ -1170,12 +1171,12 @@ function pushBase(ctx: Ctx, fetched: string, candidate: string): string {
const tips = new Set<string>();
for (const url of urls) {
if (git(ctx.root, ['ls-remote', '--get-url', '--', url]).stdout.trim() !== url) throw refuse(`push URL ${url} names another remote`);
- const listed = git(ctx.root, [...transportFlags(), 'ls-remote', '--exit-code', '--', url, ctx.mergeRef], { auth: true, timeoutMs: 60_000 });
+ const listed = git(ctx.root, [...transportFlags(), 'ls-remote', '--exit-code', '--', url, ctx.mergeRef], { auth: true, timeoutMs: 60_000, returnStopped: true });
if (listed.code === 2) { tips.add(''); continue; }
const tip = listed.code === 0 ? listed.stdout.split(/\s/)[0] ?? '' : '';
if (!/^[0-9a-f]{40,64}$/.test(tip)) throw refuse(`push URL ${url} could not be read`);
if (git(ctx.root, ['cat-file', '-e', `${tip}^{commit}`]).code !== 0
- && git(ctx.root, [...transportFlags(), 'fetch', '--quiet', ...fetchFlags(ctx.root), ...GIT_SSRF_SUBCOMMAND_FLAGS, '--', url, tip], { auth: true, timeoutMs: 120_000 }).code !== 0) {
+ && git(ctx.root, [...transportFlags(), 'fetch', '--quiet', ...fetchFlags(ctx.root), ...GIT_SSRF_SUBCOMMAND_FLAGS, '--', url, tip], { auth: true, timeoutMs: 120_000, returnStopped: true }).code !== 0) {
throw refuse(`the commit push URL ${url} holds could not be fetched`);
}
tips.add(tip);
diff --git a/src/core/git/git-run.ts b/src/core/git/git-run.ts
index 8be04fb7b7..f14d8691c7 100644
--- a/src/core/git/git-run.ts
+++ b/src/core/git/git-run.ts
@@ -2,32 +2,59 @@
import { execFileSync } from '../spawn.ts';
import { gitChildEnv } from '../git-env.ts';
import { GIT_ENV, GIT_ENV_AUTH } from '../git-transport.ts';
-import { opError } from '../ops/contract.ts';
+import { opError, type OperationError } from '../ops/contract.ts';
-export interface GitRun { code: number; stdout: string; stderr: string }
+export interface GitRun { code: number; stdout: string; stderr: string; stopped?: GitStop }
+/** Why a git child ended without exiting on its own: its time limit, an output limit the caller set, or a signal from outside. */
+export interface GitStop { reason: 'timeout' | 'output_limit' | 'signal'; signal?: string }
-export function git(root: string, args: string[], opts: { auth?: boolean; timeoutMs?: number; env?: NodeJS.ProcessEnv; input?: string; maxBuffer?: number } = {}): GitRun {
+interface GitOpts { auth?: boolean; timeoutMs?: number; env?: NodeJS.ProcessEnv; input?: string; maxBuffer?: number; returnStopped?: boolean }
+
+/**
+ * Output is read whole with no size limit unless the caller sets `maxBuffer`: a listing under a named folder is as long
+ * as the folder (a failed commit restores every index entry under it), and Node's default 1 MiB limit killed git on a
+ * large checkout. A child that did not exit on its own throws git_command_stopped, so a caller never reads a cut-off
+ * listing as the answer; `returnStopped` returns it instead, for remote calls that report their own timeout.
+ */
+export function git(root: string, args: string[], opts: GitOpts = {}): GitRun {
const base = opts.auth ? { ...GIT_ENV_AUTH } : { ...GIT_ENV };
+ const timeoutMs = opts.timeoutMs ?? 60_000;
try {
const stdout = execFileSync('git', ['-C', root, ...args], {
stdio: ['pipe', 'pipe', 'pipe'],
input: opts.input ?? '',
- timeout: opts.timeoutMs ?? 60_000,
- ...(opts.maxBuffer ? { maxBuffer: opts.maxBuffer } : {}),
+ timeout: timeoutMs,
+ maxBuffer: opts.maxBuffer ?? Infinity,
env: gitChildEnv({ ...base, LC_ALL: 'C', LANGUAGE: 'C', ...opts.env }),
}).toString();
return { code: 0, stdout, stderr: '' };
} catch (e) {
- const err = e as { status?: number | null; stdout?: Buffer | string; stderr?: Buffer | string; message?: string };
+ const err = e as { status?: number | null; signal?: string | null; code?: string; stdout?: Buffer | string; stderr?: Buffer | string; message?: string };
+ const reason: GitStop['reason'] | null = err.code === 'ETIMEDOUT' ? 'timeout' : err.code === 'ENOBUFS' ? 'output_limit' : typeof err.status !== 'number' && err.signal ? 'signal' : null;
+ const stopped = reason ? { reason, ...(err.signal ? { signal: err.signal } : {}) } : undefined;
+ if (stopped && !opts.returnStopped) throw stoppedError(root, args, stopped, timeoutMs, opts.maxBuffer);
return {
code: typeof err.status === 'number' ? err.status : -1,
stdout: String(err.stdout ?? ''),
stderr: String(err.stderr ?? err.message ?? ''),
+ ...(stopped ? { stopped } : {}),
};
}
}
-export function gitOk(root: string, args: string[], what: string, opts: Parameters<typeof git>[2] = {}): string {
+function stoppedError(root: string, args: string[], stop: GitStop, timeoutMs: number, maxBuffer?: number): OperationError {
+ const what = `git ${args.filter(a => !a.startsWith('-c') && !a.includes('=')).slice(0, 2).join(' ')}`;
+ const how = stop.reason === 'timeout' ? `it ran past its ${Math.round(timeoutMs / 1000)} s limit and was stopped`
+ : stop.reason === 'output_limit' ? `its output passed the ${maxBuffer} byte limit and it was stopped`
+ : `it was killed by ${stop.signal}, from outside gbrain`;
+ return opError('git_command_stopped', `${what} in ${root} did not finish: ${how}. Git itself is working; gbrain did not use its partial output.`,
+ stop.reason === 'signal'
+ ? 'Something on this machine stopped git (often the out-of-memory killer or a process supervisor). Check the machine, then rerun the same command once.'
+ : `Rerun the same command once. If it stops again, tell the user that ${what} in ${root} does not finish within the limit.`,
+ { reason: stop.reason, detail: JSON.stringify({ command: what, ...stop }) });
+}
+
+export function gitOk(root: string, args: string[], what: string, opts: GitOpts = {}): string {
const r = git(root, args, opts);
if (r.code !== 0) {
throw opError('git_unavailable', `git ${what} failed in ${root}: ${r.stderr.trim().slice(0, 300) || `exit ${r.code}`}`,
diff --git a/src/core/git/skipped-paths.ts b/src/core/git/skipped-paths.ts
index fec8d03ccd..9f58a3ba86 100644
--- a/src/core/git/skipped-paths.ts
+++ b/src/core/git/skipped-paths.ts
@@ -3,6 +3,7 @@ import { existsSync, lstatSync, readFileSync, readlinkSync, statSync } from 'nod
import { dirname, join, relative, resolve } from 'node:path';
import { literalPathspecs } from '../git-env.ts';
import { canonicalFilesystemPath } from '../persistence/root-registry.ts';
+import { opError } from '../ops/contract.ts';
import { git, gitOk } from './git-run.ts';
export interface SkippedPath { path: string; reason: 'assume_unchanged' | 'skip_worktree' | 'not_staged' | 'staged_for_removal'; why: string }
@@ -180,3 +181,18 @@ export function worktreeOfGitdir(top: string): string {
return top;
}
+/** Refuses, before anything is staged, named paths with unresolved merge conflicts in the index: staging one would commit its markers as resolved. */
+export function assertNoUnmergedPaths(root: string, rel: string[]): void {
+ const unmerged = [...new Set(git(root, ['ls-files', '-u', '-z', '--', ...literalPathspecs(rel)]).stdout.split('\0').filter(Boolean).map(l => l.slice(l.indexOf('\t') + 1)))];
+ if (unmerged.length) {
+ const list = `${unmerged.slice(0, 10).join(', ')}${unmerged.length > 10 ? ', ...' : ''}`;
+ throw opError('commit_paths_unmerged', `${unmerged.length} named file(s) still have unresolved merge conflicts in the index: ${list}.`,
+ `Nothing was staged or committed. Resolve each file first (edit out the conflict markers, or keep one side with git checkout --ours or --theirs -- <file>), mark it resolved with git add -- <file>, then rerun the commit. git ls-files -u -- <file> prints nothing once it is resolved.`,
+ { detail: JSON.stringify({ paths: unmerged }), fix: { ask_user: true, consent: [], actor: 'user', requires_exclusive: false,
+ argv: ['git', '-C', root, 'diff', '--', ...literalPathspecs(unmerged)],
+ why: 'Shows the conflict in each file; committing now would publish the conflict markers as the file content.',
+ user_message: `These files still have unresolved merge conflicts (${list}), for example after a merge, rebase or stash pop that stopped on a conflict. Resolve each one and mark it resolved with git add, then commit again?`,
+ verify: { argv: ['git', '-C', root, 'ls-files', '-u', '--', ...literalPathspecs(unmerged)] },
+ docs: 'docs/guides/shared-checkout-git.md#outcomes' } });
+ }
+}
diff --git a/src/core/setup/openclaw-skill-plugin-code.ts b/src/core/setup/openclaw-skill-plugin-code.ts
index 60332ed73f..d94915153f 100644
--- a/src/core/setup/openclaw-skill-plugin-code.ts
+++ b/src/core/setup/openclaw-skill-plugin-code.ts
@@ -105,6 +105,8 @@ const GBRAIN_HOME_ENV = __GBRAIN_HOME_ENV__;
const PLUGIN_VERSION = __PLUGIN_VERSION__;
const ID = 'gbrain-skill-resolver';
const DEADLINE_MS = Number(process.env.GBRAIN_TEST_OPENCLAW_SKILL_DEADLINE_MS) || 50;
+// The setup self-test checks that the plugin resolves a turn at all, so it waits this long, not a live turn's deadline.
+const SELF_TEST_MS = 10_000;
const STUCK_AFTER = 3;
const KEEP_DAYS = 14;
const MEMO_MAX = 1000;
@@ -245,10 +247,10 @@ function armFor(a, sessionKey) {
return bucket(sessionKey) < f ? 'live' : 'control';
}
-function ask(w, msg) {
+function ask(w, msg, ms = DEADLINE_MS) {
const id = ++seq;
return new Promise((resolve) => {
- const t = setTimeout(() => { waiters.delete(id); resolve({ id, late: true }); }, DEADLINE_MS);
+ const t = setTimeout(() => { waiters.delete(id); resolve({ id, late: true }); }, ms);
waiters.set(id, (m) => { clearTimeout(t); resolve(m ? { ...m, id } : { id, late: true }); });
w.postMessage({ ...msg, id });
});
@@ -391,7 +393,7 @@ export default {
const w = ensureWorker(s);
if (!w) return { ok: false, code: 'skill_resolver_worker_unavailable' };
const warm = await new Promise((resolve) => {
- const t = setTimeout(() => resolve({ code: 'skill_resolve_timeout' }), 10_000);
+ const t = setTimeout(() => resolve({ code: 'skill_resolve_timeout' }), SELF_TEST_MS);
const onMsg = (m) => { if (m && m.type === 'warm') { clearTimeout(t); w.off('message', onMsg); resolve(m); } };
w.on('message', onMsg);
w.postMessage({ type: 'warm' });
@@ -399,7 +401,7 @@ export default {
if (warm.code) { dropWorker(); return { ok: false, code: warm.code }; }
const a = s.agents[agentId];
const t0 = Date.now();
- const reply = await ask(w, { type: 'resolve', input: { message, harness: 'openclaw', top_k: Number.isInteger(a.top_k) ? a.top_k : 3, shadow: true, ...(typeof a.top_gate === 'number' ? { top_gate: a.top_gate } : {}) }, catalog: a.catalog, deadlineMs: DEADLINE_MS - 5, floor: a.min_match || null, dirs: [] });
+ const reply = await ask(w, { type: 'resolve', input: { message, harness: 'openclaw', top_k: Number.isInteger(a.top_k) ? a.top_k : 3, shadow: true, ...(typeof a.top_gate === 'number' ? { top_gate: a.top_gate } : {}) }, catalog: a.catalog, deadlineMs: SELF_TEST_MS - 5, floor: a.min_match || null, dirs: [] }, SELF_TEST_MS);
dropWorker();
if (reply.late) return { ok: false, code: 'skill_resolve_timeout', ms: Date.now() - t0 };
if (reply.code && !reply.block) return { ok: false, code: reply.code, ms: Date.now() - t0 };
diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.json
index 27b7ec6d11..adff887357 100644
--- a/test/fixtures/goldens/exports/types.json
+++ b/test/fixtures/goldens/exports/types.json
@@ -6875,7 +6875,7 @@
{
"kind": "class",
"members": [
- "canonical?: \"unknown\" | \"timeout\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"rate_limited\" | \"embedding_disabled\" | \"writer_lock_unavailable\" | \"writer_pool_capacity\" | \"owner_unavailable\" | \"recovery_required\" | \"queue_capacity\" | \"write_quota_exhausted\" | \"write_quota_insufficient\" | \"write_capacity_backpressure\" | \"revision_required\" | \"revision_conflict\" | \"idempotency_conflict\" | \"source_changed\" | \"write_pending\" | \"storage_error\" | \"cancelled\" | \"permission_denied\" | \"scope_denied\" | \"invalid_params\" | \"not_found\" | \"page_not_found\" | \"page_identity_changed\" | \"write_claim_lost\" | \"request_too_large\" | \"response_too_large\" | \"writer_registration_required\" | \"writer_identity_invalid\" | \"writer_not_initialized\" | \"writer_coordinator_required\" | \"fact_already_expired\" | \"source_writeback_required\" | \"unsupported_mutation_protocol\" | \"writer_upgrade_required\" | \"writer_not_quiesced\" | \"skill_bundle_required\" | \"take_row_collision\" | \"invalid_source_uri\" | \"writer_admin_locked\" | \"connector_account_changed\" | \"connector_intent_outdated\" | \"checkpoint_validation_timeout\" | \"invalid_connector_text\" | \"connector_holds_exhausted\" | \"connector_fence_below_timeline\" | \"core_budget_exceeded\" | \"core_mark_owner_only\" | \"core_remote_edit_refused\" | \"core_delete_owner_only\" | \"timeline_rows_would_be_removed\" | \"purged_content\" | \"preparation_stalled\" | \"fence_unrenderable\" | \"page_body_segmented\" | \"page_body_rows_unreadable\" | \"revision_changed\" | \"tail_changed\" | \"write_outcome_unknown\" | \"write_interrupted\" | \"connection_inherited_read_only\" | \"owner_marker_missing\" | \"embedding_failed\" | \"bucket_not_found\" | \"database_error\" | \"unknown_transport\" | \"extraction_failed\" | \"fact_not_found\" | \"provenance_required\" | \"unavailable\" | \"budget_unsatisfiable\" | \"embedding_budget_below_worst_case\" | \"absent_from_worktree\" | \"access_command_failed\" | \"access_identity_unavailable\" | \"access_member_disabled\" | \"archive_audience_unproven\" | \"archive_gateway_unreachable\" | \"archive_gateway_auth\" | \"archive_gateway_failed\" | \"archive_owner_unset\" | \"archive_redaction_failed\" | \"archive_run_busy\" | \"autopilot_no_repo\" | \"autopilot_pglite_daemon\" | \"cycle_already_running\" | \"engine_degraded\" | \"maintenance_disabled\" | \"maintenance_owned_by_serve\" | \"schedule_unsupported\" | \"schedule_install_failed\" | \"maintenance_owned_by_autopilot\" | \"on_behalf_of_invalid_audience\" | \"on_behalf_of_unknown_member\" | \"on_behalf_of_not_permitted\" | \"actor_not_attested\" | \"actor_unlinked\" | \"on_behalf_of_in_arguments\" | \"access_policy_invalid\" | \"access_policy_pending\" | \"access_policy_widening_held\" | \"access_policy_history_unreadable\" | \"access_policy_store_mismatch\" | \"access_rule_invalid\" | \"requester_scope_required\" | \"requester_scope_unknown\" | \"credential_scope_required\" | \"access_serves_roster_empty\" | \"access_serves_key_dir_in_git\" | \"repair_propose_dir_in_git\" | \"access_member_id_retired\" | \"access_labelled_only_owner\" | \"access_labelled_only_unnamed\" | \"access_member_invalid\" | \"access_denied_test_user\" | \"access_env_missing\" | \"acknowledgment_unavailable\" | \"admin_policy_enforced\" | \"admission_paused\" | \"ambient_capture_off\" | \"ambiguous_id\" | \"ambiguous_ref\" | \"ambiguous_skill\" | \"answer_not_yours\" | \"answer_pending\" | \"answer_unavailable\" | \"api_not_enabled\" | \"append_links_fence\" | \"approval_required\" | \"atom_drain_incomplete\" | \"atom_drain_no_progress\" | \"atom_drain_provider_failure\" | \"autopilot_job_owned_by_other_brain\" | \"body_staging_expired\" | \"budget_below_recent_runtime\" | \"backup_dump_failed\" | \"backup_too_large\" | \"belief_coverage_required\" | \"belief_stale_preparation\" | \"benchmark_duplicate_task_id\" | \"benchmark_empty\" | \"benchmark_exists\" | \"benchmark_judge_llm_no_rubric\" | \"benchmark_judge_qrels_no_expected\" | \"benchmark_judge_rule_no_checks\" | \"benchmark_judge_unknown_kind\" | \"benchmark_malformed\" | \"benchmark_missing_judge\" | \"benchmark_missing_task\" | \"benchmark_missing_task_id\" | \"benchmark_not_found\" | \"benchmark_rule_check_bad_arg\" | \"benchmark_rule_check_malformed\" | \"benchmark_rule_check_unknown_op\" | \"bootstrap_cleanup_pending\" | \"bootstrap_empty\" | \"bootstrap_pending_review\" | \"bridge_ownership_conflict\" | \"valid_time_undeclared\" | \"coverage_from\" | \"coverage_gap\" | \"clock_mismatch\" | \"extract_write_lost\" | \"item_failures_systemic\" | \"known_as_of_unproven\" | \"cache_quota_exceeded\" | \"calendar_unreadable\" | \"capacity_paused\" | \"catalog_capacity_exceeded\" | \"catalog_unavailable\" | \"host_upgrade_required\" | \"change_reason_rejected\" | \"changed_since_preview\" | \"chronicle_skipped\" | \"no_pricing\" | \"checkout_not_a_source\" | \"checkpoint_missing\" | \"claim_already_used\" | \"client_behind\" | \"client_json_unreadable\" | \"client_json_wrong_type\" | \"client_not_found\" | \"client_shape_invalid\" | \"code_callees_requires_symbol\" | \"code_callers_requires_symbol\" | \"code_def_requires_symbol\" | \"code_refs_requires_symbol\" | \"code_reused\" | \"colon_slug_windows_write_through\" | \"command_failed\" | \"commit_lock_busy\" | \"commit_base_moved\" | \"commit_paths_invalid\" | \"commit_paths_skipped\" | \"commit_prestaged_paths\" | \"commit_outside_source_root\" | \"concurrent_write\" | \"config_error\" | \"confirmation_required\" | \"conflicting_source_scope\" | \"connection_lost\" | \"connector_access_denied\" | \"connector_auth_required\" | \"connector_binding_missing\" | \"connector_item_too_large\" | \"connector_response_too_large\" | \"connector_shape_drift\" | \"chunkless_pages_healable\" | \"consent_required\" | \"consent_timeout\" | \"consumers_without_heartbeat\" | \"content_repair_needs_human\" | \"content_filter_owned\" | \"content_null_bytes\" | \"content_rejected\" | \"continuation_unproven\" | \"corpus_chat_unavailable\" | \"corpus_window_backoff\" | \"corpus_window_dead_lettered\" | \"convergence_read_failed\" | \"cost_cap_exceeded\" | \"cost_preview_requires_yes\" | \"cursor_incarnation_retired\" | \"cycle_failed\" | \"d_sel_too_small\" | \"delta_cursor_upgrade_required\" | \"deleted_page_chunks_overdue\" | \"demo_graph_failed\" | \"downgrade_blocked_deferred_writes\" | \"demo_import_failed\" | \"demo_verification_failed\" | \"derived_cap_exhausted\" | \"destination_not_ready\" | \"drain_holder_stalled\" | \"drain_stalled\" | \"managed_sync_not_moving\" | \"dream_breaker_tripped\" | \"dirty_tree\" | \"doctor_alert_act\" | \"doctor_alert_unknown\" | \"doctor_tier_unavailable\" | \"effect_not_failed\" | \"embed_backfill_stalled\" | \"embedding_auth_failed\" | \"embedding_configuration\" | \"embedding_identity_unqualified\" | \"embedding_model_mismatch\" | \"embedding_plane_split\" | \"embedding_state_unknown\" | \"embedding_storage_unavailable\" | \"embedding_unavailable\" | \"embedding_unconfigured\" | \"embedding_width_mismatch\" | \"embedded_core_required\" | \"enforced_member_refused\" | \"engine_embedding_mismatch\" | \"embedded_engine_required\" | \"engine_closed\" | \"engine_host_missing\" | \"engine_scope_missing\" | \"engine_scope_required\" | \"engine_settings_invalid\" | \"engine_graduated\" | \"entity_types_unavailable\" | \"eval_suite_unwired\" | \"explicit_tasks_conflict\" | \"export_limit\" | \"extractor_identity_mismatch\" | \"fact_withdrawn\" | \"fact_rows_collide\" | \"fence_row_changed\" | \"facts_absorb_write_refused\" | \"facts_backstop_skipped\" | \"facts_drain_deferred\" | \"facts_drain_job_failed\" | \"facts_payload_expired\" | \"feedback_disabled\" | \"feedback_not_authorized\" | \"fetch_failed\" | \"file_database_drift\" | \"fix_not_writable\" | \"file_drift\" | \"file_drift_mixed_selection\" | \"file_drift_state_required\" | \"file_removed_during_scan\" | \"file_unreadable\" | \"file_wins_rewrite\" | \"file_too_large\" | \"follow_approval_required\" | \"foreign_table\" | \"forget_requires_owner\" | \"reserved_frontmatter_key\" | \"generation_fenced\" | \"generation_held\" | \"generation_live_conflict\" | \"frontmatter_slug_conflict\" | \"full_resync_required\" | \"gate_failed\" | \"ghost_mass_delete_refused\" | \"notifier_stalled\" | \"moved_pages_mass_fold_refused\" | \"origin_twin_mass_merge_refused\" | \"ghost_storage_unknown\" | \"git_branch_unborn\" | \"git_durability_not_enabled\" | \"git_checkout_required\" | \"git_worktree_link_broken\" | \"hosted_repo_refused\" | \"git_detached_head\" | \"git_index_conflict\" | \"git_index_locked\" | \"git_index_stale\" | \"git_target_pending\" | \"git_operation_in_progress\" | \"git_push_unavailable\" | \"git_target_changed\" | \"git_target_ignored\" | \"git_target_unsafe\" | \"git_unavailable\" | \"git_object_missing\" | \"git_conversion_blocked\" | \"git_conversion_delta\" | \"conversion_file_in_source_root\" | \"git_conversion_incomplete\" | \"git_home_required\" | \"git_private_commit_refused\" | \"git_protocol_required\" | \"git_lfs_not_enabled\" | \"gitlink_not_followed\" | \"graduation_drain_timeout\" | \"graduation_embedding_dimension_mismatch\" | \"graduation_foreign_host_binding\" | \"graduation_in_progress\" | \"graduation_interrupted\" | \"graduation_rollback_writes_lost\" | \"graduation_source_writer_held\" | \"graduation_split_brain\" | \"graduation_target_auth_failed\" | \"graduation_target_ddl_unreachable\" | \"graduation_target_not_empty\" | \"graduation_target_unsupported\" | \"graduation_unclassified_table\" | \"graduation_unsupported_platform\" | \"graduation_verify_failed\" | \"grant_scope\" | \"graph_incomplete\" | \"host_identity_mismatch\" | \"harness_hook_duplicates\" | \"harness_hook_unowned\" | \"head_blocked\" | \"held_failed\" | \"held_out_overlaps_benchmark\" | \"held_out_required_for_bundled\" | \"independent_principal_required\" | \"insufficient_scope\" | \"integrate_conflict\" | \"internal\" | \"internal_error\" | \"interrupted\" | \"invalid_acknowledgment\" | \"invalid_client\" | \"invalid_fence\" | \"unclosed_ambiguous_tail\" | \"tail_exposure_approval\" | \"sync_in_progress\" | \"invalid_frontmatter\" | \"invalid_grant_clock_skew\" | \"invalid_grant_revoked\" | \"invalid_grant_testing_expiry\" | \"invalid_rating\" | \"invalid_receipt\" | \"invalid_receipt_transition\" | \"invalid_request\" | \"invalid_source\" | \"invalid_source_pin\" | \"invalid_token\" | \"invalid_write_wait\" | \"ipc_path_too_long\" | \"legacy_twin_mass_merge_refused\" | \"legacy_twins_storage_unknown\" | \"legacy_job_selection_invalid\" | \"legacy_jobs_active\" | \"legacy_lock_removal_refused\" | \"link_cursor_invalid\" | \"link_dates_unattributed\" | \"local_conflict\" | \"lock_busy\" | \"loops_extraction_skipped\" | \"maintenance_backpressure\" | \"maintenance_lock_busy\" | \"managed_failure_unsettled\" | \"managed_remedy_unavailable\" | \"memory_setting_write_outcome_unknown\" | \"merge_recommended\" | \"movement_unknown\" | \"managed_sync_flag_refused\" | \"managed_pull_skipped\" | \"manual_only_skipped\" | \"membership_inactive\" | \"membership_not_found\" | \"method_not_allowed\" | \"migration_lease_lost\" | \"migration_declined\" | \"migration_failed\" | \"migration_host_work_pending\" | \"migrations_pending\" | \"migrations_running\" | \"missing_source_scope\" | \"missing_source_value\" | \"models_strict_violation\" | \"no_context_ceiling\" | \"no_refresh_token\" | \"no_routing_eval\" | \"no_skill_md\" | \"no_worker\" | \"no_worker_surface\" | \"not_a_git_repo\" | \"not_converged\" | \"not_owner_host\" | \"not_connected\" | \"no_brain\" | \"overlapping_path\" | \"page_projection_conflict\" | \"page_projection_stale\" | \"label_edit_refused\" | \"page_shrink_refused\" | \"page_too_large_for_inline\" | \"parse_error\" | \"part_splits_code_point\" | \"part_too_large\" | \"frontmatter_alias_limit\" | \"parser_regression\" | \"pasted_wrong_url\" | \"payload_too_large\" | \"path_not_utf8\" | \"pattern_claims_pending\" | \"patterns_min_interval\" | \"pending_verify\" | \"pending_writes\" | \"persistence_restart_required\" | \"pool_inflight_over_budget\" | \"deep_health_probe_failed\" | \"refresh_required\" | \"serve_self_exit_suppressed\" | \"serve_unhealthy_exit\" | \"persistence_write_stall\" | \"publish_secret_found\" | \"publish_scan_unreadable\" | \"push_unconfirmed\" | \"schema_lock_blocked\" | \"postgres_tls_required\" | \"pg_connection_recovery_failed\" | \"pg_connection_stuck\" | \"pg_pool_stalled\" | \"pg_statement_build_failed\" | \"pglite_busy\" | \"pglite_vector_index_too_large\" | \"plan_output_failed\" | \"plan_stale\" | \"port_in_use\" | \"preview_changed\" | \"profile_incompatible\" | \"projection_owner_resident\" | \"knock_on_exhausted\" | \"keyword_skipped_after_timeout\" | \"proposal_closed\" | \"proposal_expired\" | \"proposals_pending_limit\" | \"provider_response_unparseable\" | \"publication_pending\" | \"pull_blocked_local_changes\" | \"purge_blocked_pending_recovery\" | \"purge_lookup_timeout\" | \"purge_mirror_unwritable\" | \"purge_replay_incomplete\" | \"question_not_found\" | \"question_owner_only\" | \"rank_entities_timeout\" | \"read_budget_exhausted\" | \"reason_purge_scan_capped\" | \"reason_purge_scan_failed\" | \"reason_scan_capped\" | \"reason_scan_failed\" | \"reason_trailer_secret\" | \"receipt_conflict\" | \"receipt_fence_changed\" | \"receipt_fence_required\" | \"receipt_identity_mismatch\" | \"pat_file_unreadable\" | \"reconcile_host_required\" | \"reconcile_read_incomplete\" | \"recovery_prior_stage_unavailable\" | \"recovery_version_unsupported\" | \"redirect_uri_mismatch\" | \"ref_not_in_answer\" | \"refresh_dirty\" | \"refresh_diverged\" | \"refresh_drain_timeout\" | \"refresh_lock_timeout\" | \"refresh_no_upstream\" | \"refresh_not_managed\" | \"refresh_not_owner\" | \"pending_import_expired\" | \"refresh_barrier_expired\" | \"refresh_source_changed\" | \"refresh_sync_timeout\" | \"relay_disabled\" | \"relay_session_expired\" | \"relay_unreachable\" | \"rename_held\" | \"rename_identity_unreadable\" | \"rename_reconcile_failed\" | \"repair_preview_timeout\" | \"request_already_submitted\" | \"requirements_changed\" | \"requires_local_engine\" | \"restart_refused\" | \"restart_unverified\" | \"runtime_build_skew\" | \"reset_upstream_refused\" | \"resume_spec_mismatch\" | \"result_too_large\" | \"revision_backfill_pending\" | \"revision_unavailable\" | \"schema_owner_required\" | \"scope_missing\" | \"search_cursor_requires_keyword\" | \"search_mode_local_only\" | \"scorecard_group_by_local_only\" | \"search_offset_over_cap\" | \"segmented_mirror_writer_gate\" | \"serve_build_drift\" | \"serve_port_in_use\" | \"serve_status_only\" | \"settle_mismatch\" | \"openclaw_not_found\" | \"setup_harness_unsupported\" | \"setup_hosted_connection\" | \"setup_owner_conflict\" | \"setup_serves_several\" | \"setup_serves_unreadable\" | \"hook_session_cwd\" | \"turn_hook_not_loaded\" | \"shared_skills_unavailable\" | \"shared_skills_unsupported\" | \"skill_asset_not_found\" | \"skill_candidate_invalid\" | \"skill_not_found\" | \"skill_catalog_mismatch\" | \"skill_catalog_too_large\" | \"skill_catalog_unknown\" | \"skill_index_incompatible\" | \"skill_index_locked\" | \"skill_index_missing\" | \"skill_index_removed\" | \"skill_resolve_invalid_input\" | \"skill_resolve_no_input\" | \"skill_resolve_timeout\" | \"skill_resolver_config_invalid\" | \"skill_resolver_config_unreadable\" | \"skill_resolver_setup_incomplete\" | \"skill_resolver_plugin_not_installed\" | \"skill_resolver_host_not_local\" | \"skill_resolver_selftest_failed\" | \"skill_resolver_pin_unknown\" | \"skill_resolver_library_missing\" | \"skill_resolver_library_mismatch\" | \"skill_resolver_library_skew\" | \"skill_resolver_worker_crash\" | \"skill_resolver_worker_stuck\" | \"skill_resolver_worker_unavailable\" | \"skill_resolver_state_missing\" | \"skill_resolver_host_load_cut\" | \"skill_resolver_internal\" | \"skill_source_invalid\" | \"skill_source_unreadable\" | \"skill_retention_capacity\" | \"skill_unavailable\" | \"skillpack_backup_corrupt\" | \"skillpack_journal_not_found\" | \"skillpack_restore_conflict\" | \"skillpack_state_locked\" | \"skillpack_update_incomplete\" | \"skillpack_workspace_locked\" | \"slug_page_mismatch\" | \"slug_root_mode_mismatch\" | \"source_binding_required\" | \"source_id_taken\" | \"source_mismatch\" | \"source_not_ready\" | \"source_profile_no_backfill\" | \"source_pages_remain\" | \"source_referenced\" | \"source_retire_superseded\" | \"source_root_conflict\" | \"source_root_unreadable\" | \"sources_not_readable\" | \"split_bad_ratio\" | \"split_unparseable\" | \"stable_channel_unresolved\" | \"stable_invalid\" | \"stable_missing\" | \"stable_unreadable\" | \"stale_unavailable\" | \"state_mismatch\" | \"store_unavailable\" | \"storage_adopt_field_refused\" | \"storage_adopt_unverified\" | \"storage_card_exists\" | \"storage_manifest_missing\" | \"storage_record_invalid\" | \"storage_record_secret\" | \"storage_revision_conflict\" | \"storage_source_managed\" | \"strict_requires_managed\" | \"sync_anchor_relative\" | \"sync_not_applicable\" | \"sync_admission_restricted\" | \"sync_deadline_stalled\" | \"sync_drain_lease_held\" | \"content_receipt_stale\" | \"sync_first_run_in_progress\" | \"sync_no_successful_sync\" | \"sync_cursor_replaced\" | \"sync_pass_superseded\" | \"sync_parser_regression\" | \"tag_too_long\" | \"target_escape\" | \"timeline_comment_markup\" | \"source_writer_restricted\" | \"guest_page_immutable\" | \"guest_page_promoted\" | \"guest_attribution_missing\" | \"guest_frontmatter_refused\" | \"guest_readers_invalid\" | \"guest_promotion_owner_only\" | \"guest_mark_immutable\" | \"guest_source_database_only\" | \"readable_by_invalid\" | \"topology_change_required\" | \"transcript_secret_exposure\" | \"transcript_source_mismatch\" | \"triage_unreliable_backoff\" | \"trust_raise_refused\" | \"two_consumers_on_host\" | \"trusted_local_only\" | \"unexpected_file_bytes\" | \"unexpected_staging_bytes\" | \"unknown_command\" | \"unknown_flag\" | \"unknown_method\" | \"unknown_source\" | \"unknown_tool\" | \"unpriced_model\" | \"unmanaged_database_path\" | \"unmanaged_path\" | \"unsupported_export_data\" | \"unsupported_path\" | \"untrack_not_db_only\" | \"upload_expired\" | \"upload_not_found\" | \"upload_protected_content\" | \"upload_too_many_parts\" | \"upstream\" | \"upstream_diverged\" | \"upstream_rewritten\" | \"upstream_unknown\" | \"vector_prewarm_extension_missing\" | \"vector_prewarm_unsupported_engine\" | \"vector_prewarm_wont_fit\" | \"verification_failed\" | \"visibility_noncanonical\" | \"visibility_not_applied\" | \"wakeshift_key_invalid\" | \"wakeshift_needs_conversation\" | \"wakeshift_not_enabled\" | \"wakeshift_refused\" | \"wakeshift_shared_brain\" | \"wakeshift_unavailable\" | \"withdrawal_capacity\" | \"withdrawal_mirror_failed\" | \"withdrawal_mirror_pending\" | \"withdrawal_provenance\" | \"write_capacity_low\" | \"write_gate_rejected\" | \"write_held\" | \"worktree_dirty\" | \"worktree_refreshing\" | \"writer_admin_intent_required\" | \"writer_admin_state_changed\" | \"writer_busy\" | \"writer_identity_publish_failed\" | \"writer_manifest_mismatch\" | \"writer_manifest_rescope_required\" | \"writer_manifest_unsafe\" | \"writer_regrant_required\" | \"writer_transfer_conflict\" | \"writer_transfer_required\" | \"wrong_account_consented\" | \"schema_pack_too_large\" | \"schema_pack_emit_mismatch\" | undefined",
+ "canonical?: \"unknown\" | \"timeout\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"rate_limited\" | \"embedding_disabled\" | \"writer_lock_unavailable\" | \"writer_pool_capacity\" | \"owner_unavailable\" | \"recovery_required\" | \"queue_capacity\" | \"write_quota_exhausted\" | \"write_quota_insufficient\" | \"write_capacity_backpressure\" | \"revision_required\" | \"revision_conflict\" | \"idempotency_conflict\" | \"source_changed\" | \"write_pending\" | \"storage_error\" | \"cancelled\" | \"permission_denied\" | \"scope_denied\" | \"invalid_params\" | \"not_found\" | \"page_not_found\" | \"page_identity_changed\" | \"write_claim_lost\" | \"request_too_large\" | \"response_too_large\" | \"writer_registration_required\" | \"writer_identity_invalid\" | \"writer_not_initialized\" | \"writer_coordinator_required\" | \"fact_already_expired\" | \"source_writeback_required\" | \"unsupported_mutation_protocol\" | \"writer_upgrade_required\" | \"writer_not_quiesced\" | \"skill_bundle_required\" | \"take_row_collision\" | \"invalid_source_uri\" | \"writer_admin_locked\" | \"connector_account_changed\" | \"connector_intent_outdated\" | \"checkpoint_validation_timeout\" | \"invalid_connector_text\" | \"connector_holds_exhausted\" | \"connector_fence_below_timeline\" | \"core_budget_exceeded\" | \"core_mark_owner_only\" | \"core_remote_edit_refused\" | \"core_delete_owner_only\" | \"timeline_rows_would_be_removed\" | \"purged_content\" | \"preparation_stalled\" | \"fence_unrenderable\" | \"page_body_segmented\" | \"page_body_rows_unreadable\" | \"revision_changed\" | \"tail_changed\" | \"write_outcome_unknown\" | \"write_interrupted\" | \"connection_inherited_read_only\" | \"owner_marker_missing\" | \"embedding_failed\" | \"bucket_not_found\" | \"database_error\" | \"unknown_transport\" | \"extraction_failed\" | \"fact_not_found\" | \"provenance_required\" | \"unavailable\" | \"budget_unsatisfiable\" | \"embedding_budget_below_worst_case\" | \"absent_from_worktree\" | \"access_command_failed\" | \"access_identity_unavailable\" | \"access_member_disabled\" | \"archive_audience_unproven\" | \"archive_gateway_unreachable\" | \"archive_gateway_auth\" | \"archive_gateway_failed\" | \"archive_owner_unset\" | \"archive_redaction_failed\" | \"archive_run_busy\" | \"autopilot_no_repo\" | \"autopilot_pglite_daemon\" | \"cycle_already_running\" | \"engine_degraded\" | \"maintenance_disabled\" | \"maintenance_owned_by_serve\" | \"schedule_unsupported\" | \"schedule_install_failed\" | \"maintenance_owned_by_autopilot\" | \"on_behalf_of_invalid_audience\" | \"on_behalf_of_unknown_member\" | \"on_behalf_of_not_permitted\" | \"actor_not_attested\" | \"actor_unlinked\" | \"on_behalf_of_in_arguments\" | \"access_policy_invalid\" | \"access_policy_pending\" | \"access_policy_widening_held\" | \"access_policy_history_unreadable\" | \"access_policy_store_mismatch\" | \"access_rule_invalid\" | \"requester_scope_required\" | \"requester_scope_unknown\" | \"credential_scope_required\" | \"access_serves_roster_empty\" | \"access_serves_key_dir_in_git\" | \"repair_propose_dir_in_git\" | \"access_member_id_retired\" | \"access_labelled_only_owner\" | \"access_labelled_only_unnamed\" | \"access_member_invalid\" | \"access_denied_test_user\" | \"access_env_missing\" | \"acknowledgment_unavailable\" | \"admin_policy_enforced\" | \"admission_paused\" | \"ambient_capture_off\" | \"ambiguous_id\" | \"ambiguous_ref\" | \"ambiguous_skill\" | \"answer_not_yours\" | \"answer_pending\" | \"answer_unavailable\" | \"api_not_enabled\" | \"append_links_fence\" | \"approval_required\" | \"atom_drain_incomplete\" | \"atom_drain_no_progress\" | \"atom_drain_provider_failure\" | \"autopilot_job_owned_by_other_brain\" | \"body_staging_expired\" | \"budget_below_recent_runtime\" | \"backup_dump_failed\" | \"backup_too_large\" | \"belief_coverage_required\" | \"belief_stale_preparation\" | \"benchmark_duplicate_task_id\" | \"benchmark_empty\" | \"benchmark_exists\" | \"benchmark_judge_llm_no_rubric\" | \"benchmark_judge_qrels_no_expected\" | \"benchmark_judge_rule_no_checks\" | \"benchmark_judge_unknown_kind\" | \"benchmark_malformed\" | \"benchmark_missing_judge\" | \"benchmark_missing_task\" | \"benchmark_missing_task_id\" | \"benchmark_not_found\" | \"benchmark_rule_check_bad_arg\" | \"benchmark_rule_check_malformed\" | \"benchmark_rule_check_unknown_op\" | \"bootstrap_cleanup_pending\" | \"bootstrap_empty\" | \"bootstrap_pending_review\" | \"bridge_ownership_conflict\" | \"valid_time_undeclared\" | \"coverage_from\" | \"coverage_gap\" | \"clock_mismatch\" | \"extract_write_lost\" | \"item_failures_systemic\" | \"known_as_of_unproven\" | \"cache_quota_exceeded\" | \"calendar_unreadable\" | \"capacity_paused\" | \"catalog_capacity_exceeded\" | \"catalog_unavailable\" | \"host_upgrade_required\" | \"change_reason_rejected\" | \"changed_since_preview\" | \"chronicle_skipped\" | \"no_pricing\" | \"checkout_not_a_source\" | \"checkpoint_missing\" | \"claim_already_used\" | \"client_behind\" | \"client_json_unreadable\" | \"client_json_wrong_type\" | \"client_not_found\" | \"client_shape_invalid\" | \"code_callees_requires_symbol\" | \"code_callers_requires_symbol\" | \"code_def_requires_symbol\" | \"code_refs_requires_symbol\" | \"code_reused\" | \"colon_slug_windows_write_through\" | \"command_failed\" | \"commit_lock_busy\" | \"commit_base_moved\" | \"commit_paths_unmerged\" | \"commit_paths_invalid\" | \"commit_paths_skipped\" | \"commit_prestaged_paths\" | \"commit_outside_source_root\" | \"concurrent_write\" | \"config_error\" | \"confirmation_required\" | \"conflicting_source_scope\" | \"connection_lost\" | \"connector_access_denied\" | \"connector_auth_required\" | \"connector_binding_missing\" | \"connector_item_too_large\" | \"connector_response_too_large\" | \"connector_shape_drift\" | \"chunkless_pages_healable\" | \"consent_required\" | \"consent_timeout\" | \"consumers_without_heartbeat\" | \"content_repair_needs_human\" | \"content_filter_owned\" | \"content_null_bytes\" | \"content_rejected\" | \"continuation_unproven\" | \"corpus_chat_unavailable\" | \"corpus_window_backoff\" | \"corpus_window_dead_lettered\" | \"convergence_read_failed\" | \"cost_cap_exceeded\" | \"cost_preview_requires_yes\" | \"cursor_incarnation_retired\" | \"cycle_failed\" | \"d_sel_too_small\" | \"delta_cursor_upgrade_required\" | \"deleted_page_chunks_overdue\" | \"demo_graph_failed\" | \"downgrade_blocked_deferred_writes\" | \"demo_import_failed\" | \"demo_verification_failed\" | \"derived_cap_exhausted\" | \"destination_not_ready\" | \"drain_holder_stalled\" | \"drain_stalled\" | \"managed_sync_not_moving\" | \"dream_breaker_tripped\" | \"dirty_tree\" | \"doctor_alert_act\" | \"doctor_alert_unknown\" | \"doctor_tier_unavailable\" | \"effect_not_failed\" | \"embed_backfill_stalled\" | \"embedding_auth_failed\" | \"embedding_configuration\" | \"embedding_identity_unqualified\" | \"embedding_model_mismatch\" | \"embedding_plane_split\" | \"embedding_state_unknown\" | \"embedding_storage_unavailable\" | \"embedding_unavailable\" | \"embedding_unconfigured\" | \"embedding_width_mismatch\" | \"embedded_core_required\" | \"enforced_member_refused\" | \"engine_embedding_mismatch\" | \"embedded_engine_required\" | \"engine_closed\" | \"engine_host_missing\" | \"engine_scope_missing\" | \"engine_scope_required\" | \"engine_settings_invalid\" | \"engine_graduated\" | \"entity_types_unavailable\" | \"eval_suite_unwired\" | \"explicit_tasks_conflict\" | \"export_limit\" | \"extractor_identity_mismatch\" | \"fact_withdrawn\" | \"fact_rows_collide\" | \"fence_row_changed\" | \"facts_absorb_write_refused\" | \"facts_backstop_skipped\" | \"facts_drain_deferred\" | \"facts_drain_job_failed\" | \"facts_payload_expired\" | \"feedback_disabled\" | \"feedback_not_authorized\" | \"fetch_failed\" | \"file_database_drift\" | \"fix_not_writable\" | \"file_drift\" | \"file_drift_mixed_selection\" | \"file_drift_state_required\" | \"file_removed_during_scan\" | \"file_unreadable\" | \"file_wins_rewrite\" | \"file_too_large\" | \"follow_approval_required\" | \"foreign_table\" | \"forget_requires_owner\" | \"reserved_frontmatter_key\" | \"generation_fenced\" | \"generation_held\" | \"generation_live_conflict\" | \"frontmatter_slug_conflict\" | \"full_resync_required\" | \"gate_failed\" | \"ghost_mass_delete_refused\" | \"notifier_stalled\" | \"moved_pages_mass_fold_refused\" | \"origin_twin_mass_merge_refused\" | \"ghost_storage_unknown\" | \"git_branch_unborn\" | \"git_durability_not_enabled\" | \"git_checkout_required\" | \"git_worktree_link_broken\" | \"hosted_repo_refused\" | \"git_detached_head\" | \"git_index_conflict\" | \"git_index_locked\" | \"git_index_stale\" | \"git_target_pending\" | \"git_operation_in_progress\" | \"git_push_unavailable\" | \"git_target_changed\" | \"git_target_ignored\" | \"git_target_unsafe\" | \"git_command_stopped\" | \"git_unavailable\" | \"git_object_missing\" | \"git_conversion_blocked\" | \"git_conversion_delta\" | \"conversion_file_in_source_root\" | \"git_conversion_incomplete\" | \"git_home_required\" | \"git_private_commit_refused\" | \"git_protocol_required\" | \"git_lfs_not_enabled\" | \"gitlink_not_followed\" | \"graduation_drain_timeout\" | \"graduation_embedding_dimension_mismatch\" | \"graduation_foreign_host_binding\" | \"graduation_in_progress\" | \"graduation_interrupted\" | \"graduation_rollback_writes_lost\" | \"graduation_source_writer_held\" | \"graduation_split_brain\" | \"graduation_target_auth_failed\" | \"graduation_target_ddl_unreachable\" | \"graduation_target_not_empty\" | \"graduation_target_unsupported\" | \"graduation_unclassified_table\" | \"graduation_unsupported_platform\" | \"graduation_verify_failed\" | \"grant_scope\" | \"graph_incomplete\" | \"host_identity_mismatch\" | \"harness_hook_duplicates\" | \"harness_hook_unowned\" | \"head_blocked\" | \"held_failed\" | \"held_out_overlaps_benchmark\" | \"held_out_required_for_bundled\" | \"independent_principal_required\" | \"insufficient_scope\" | \"integrate_conflict\" | \"internal\" | \"internal_error\" | \"interrupted\" | \"invalid_acknowledgment\" | \"invalid_client\" | \"invalid_fence\" | \"unclosed_ambiguous_tail\" | \"tail_exposure_approval\" | \"sync_in_progress\" | \"invalid_frontmatter\" | \"invalid_grant_clock_skew\" | \"invalid_grant_revoked\" | \"invalid_grant_testing_expiry\" | \"invalid_rating\" | \"invalid_receipt\" | \"invalid_receipt_transition\" | \"invalid_request\" | \"invalid_source\" | \"invalid_source_pin\" | \"invalid_token\" | \"invalid_write_wait\" | \"ipc_path_too_long\" | \"legacy_twin_mass_merge_refused\" | \"legacy_twins_storage_unknown\" | \"legacy_job_selection_invalid\" | \"legacy_jobs_active\" | \"legacy_lock_removal_refused\" | \"link_cursor_invalid\" | \"link_dates_unattributed\" | \"local_conflict\" | \"lock_busy\" | \"loops_extraction_skipped\" | \"maintenance_backpressure\" | \"maintenance_lock_busy\" | \"managed_failure_unsettled\" | \"managed_remedy_unavailable\" | \"memory_setting_write_outcome_unknown\" | \"merge_recommended\" | \"movement_unknown\" | \"managed_sync_flag_refused\" | \"managed_pull_skipped\" | \"manual_only_skipped\" | \"membership_inactive\" | \"membership_not_found\" | \"method_not_allowed\" | \"migration_lease_lost\" | \"migration_declined\" | \"migration_failed\" | \"migration_host_work_pending\" | \"migrations_pending\" | \"migrations_running\" | \"missing_source_scope\" | \"missing_source_value\" | \"models_strict_violation\" | \"no_context_ceiling\" | \"no_refresh_token\" | \"no_routing_eval\" | \"no_skill_md\" | \"no_worker\" | \"no_worker_surface\" | \"not_a_git_repo\" | \"not_converged\" | \"not_owner_host\" | \"not_connected\" | \"no_brain\" | \"overlapping_path\" | \"page_projection_conflict\" | \"page_projection_stale\" | \"label_edit_refused\" | \"page_shrink_refused\" | \"page_too_large_for_inline\" | \"parse_error\" | \"part_splits_code_point\" | \"part_too_large\" | \"frontmatter_alias_limit\" | \"parser_regression\" | \"pasted_wrong_url\" | \"payload_too_large\" | \"path_not_utf8\" | \"pattern_claims_pending\" | \"patterns_min_interval\" | \"pending_verify\" | \"pending_writes\" | \"persistence_restart_required\" | \"pool_inflight_over_budget\" | \"deep_health_probe_failed\" | \"refresh_required\" | \"serve_self_exit_suppressed\" | \"serve_unhealthy_exit\" | \"persistence_write_stall\" | \"publish_secret_found\" | \"publish_scan_unreadable\" | \"push_unconfirmed\" | \"schema_lock_blocked\" | \"postgres_tls_required\" | \"pg_connection_recovery_failed\" | \"pg_connection_stuck\" | \"pg_pool_stalled\" | \"pg_statement_build_failed\" | \"pglite_busy\" | \"pglite_vector_index_too_large\" | \"plan_output_failed\" | \"plan_stale\" | \"port_in_use\" | \"preview_changed\" | \"profile_incompatible\" | \"projection_owner_resident\" | \"knock_on_exhausted\" | \"keyword_skipped_after_timeout\" | \"proposal_closed\" | \"proposal_expired\" | \"proposals_pending_limit\" | \"provider_response_unparseable\" | \"publication_pending\" | \"pull_blocked_local_changes\" | \"purge_blocked_pending_recovery\" | \"purge_lookup_timeout\" | \"purge_mirror_unwritable\" | \"purge_replay_incomplete\" | \"question_not_found\" | \"question_owner_only\" | \"rank_entities_timeout\" | \"read_budget_exhausted\" | \"reason_purge_scan_capped\" | \"reason_purge_scan_failed\" | \"reason_scan_capped\" | \"reason_scan_failed\" | \"reason_trailer_secret\" | \"receipt_conflict\" | \"receipt_fence_changed\" | \"receipt_fence_required\" | \"receipt_identity_mismatch\" | \"pat_file_unreadable\" | \"reconcile_host_required\" | \"reconcile_read_incomplete\" | \"recovery_prior_stage_unavailable\" | \"recovery_version_unsupported\" | \"redirect_uri_mismatch\" | \"ref_not_in_answer\" | \"refresh_dirty\" | \"refresh_diverged\" | \"refresh_drain_timeout\" | \"refresh_lock_timeout\" | \"refresh_no_upstream\" | \"refresh_not_managed\" | \"refresh_not_owner\" | \"pending_import_expired\" | \"refresh_barrier_expired\" | \"refresh_source_changed\" | \"refresh_sync_timeout\" | \"relay_disabled\" | \"relay_session_expired\" | \"relay_unreachable\" | \"rename_held\" | \"rename_identity_unreadable\" | \"rename_reconcile_failed\" | \"repair_preview_timeout\" | \"request_already_submitted\" | \"requirements_changed\" | \"requires_local_engine\" | \"restart_refused\" | \"restart_unverified\" | \"runtime_build_skew\" | \"reset_upstream_refused\" | \"resume_spec_mismatch\" | \"result_too_large\" | \"revision_backfill_pending\" | \"revision_unavailable\" | \"schema_owner_required\" | \"scope_missing\" | \"search_cursor_requires_keyword\" | \"search_mode_local_only\" | \"scorecard_group_by_local_only\" | \"search_offset_over_cap\" | \"segmented_mirror_writer_gate\" | \"serve_build_drift\" | \"serve_port_in_use\" | \"serve_status_only\" | \"settle_mismatch\" | \"openclaw_not_found\" | \"setup_harness_unsupported\" | \"setup_hosted_connection\" | \"setup_owner_conflict\" | \"setup_serves_several\" | \"setup_serves_unreadable\" | \"hook_session_cwd\" | \"turn_hook_not_loaded\" | \"shared_skills_unavailable\" | \"shared_skills_unsupported\" | \"skill_asset_not_found\" | \"skill_candidate_invalid\" | \"skill_not_found\" | \"skill_catalog_mismatch\" | \"skill_catalog_too_large\" | \"skill_catalog_unknown\" | \"skill_index_incompatible\" | \"skill_index_locked\" | \"skill_index_missing\" | \"skill_index_removed\" | \"skill_resolve_invalid_input\" | \"skill_resolve_no_input\" | \"skill_resolve_timeout\" | \"skill_resolver_config_invalid\" | \"skill_resolver_config_unreadable\" | \"skill_resolver_setup_incomplete\" | \"skill_resolver_plugin_not_installed\" | \"skill_resolver_host_not_local\" | \"skill_resolver_selftest_failed\" | \"skill_resolver_pin_unknown\" | \"skill_resolver_library_missing\" | \"skill_resolver_library_mismatch\" | \"skill_resolver_library_skew\" | \"skill_resolver_worker_crash\" | \"skill_resolver_worker_stuck\" | \"skill_resolver_worker_unavailable\" | \"skill_resolver_state_missing\" | \"skill_resolver_host_load_cut\" | \"skill_resolver_internal\" | \"skill_source_invalid\" | \"skill_source_unreadable\" | \"skill_retention_capacity\" | \"skill_unavailable\" | \"skillpack_backup_corrupt\" | \"skillpack_journal_not_found\" | \"skillpack_restore_conflict\" | \"skillpack_state_locked\" | \"skillpack_update_incomplete\" | \"skillpack_workspace_locked\" | \"slug_page_mismatch\" | \"slug_root_mode_mismatch\" | \"source_binding_required\" | \"source_id_taken\" | \"source_mismatch\" | \"source_not_ready\" | \"source_profile_no_backfill\" | \"source_pages_remain\" | \"source_referenced\" | \"source_retire_superseded\" | \"source_root_conflict\" | \"source_root_unreadable\" | \"sources_not_readable\" | \"split_bad_ratio\" | \"split_unparseable\" | \"stable_channel_unresolved\" | \"stable_invalid\" | \"stable_missing\" | \"stable_unreadable\" | \"stale_unavailable\" | \"state_mismatch\" | \"store_unavailable\" | \"storage_adopt_field_refused\" | \"storage_adopt_unverified\" | \"storage_card_exists\" | \"storage_manifest_missing\" | \"storage_record_invalid\" | \"storage_record_secret\" | \"storage_revision_conflict\" | \"storage_source_managed\" | \"strict_requires_managed\" | \"sync_anchor_relative\" | \"sync_not_applicable\" | \"sync_admission_restricted\" | \"sync_deadline_stalled\" | \"sync_drain_lease_held\" | \"content_receipt_stale\" | \"sync_first_run_in_progress\" | \"sync_no_successful_sync\" | \"sync_cursor_replaced\" | \"sync_pass_superseded\" | \"sync_parser_regression\" | \"tag_too_long\" | \"target_escape\" | \"timeline_comment_markup\" | \"source_writer_restricted\" | \"guest_page_immutable\" | \"guest_page_promoted\" | \"guest_attribution_missing\" | \"guest_frontmatter_refused\" | \"guest_readers_invalid\" | \"guest_promotion_owner_only\" | \"guest_mark_immutable\" | \"guest_source_database_only\" | \"readable_by_invalid\" | \"topology_change_required\" | \"transcript_secret_exposure\" | \"transcript_source_mismatch\" | \"triage_unreliable_backoff\" | \"trust_raise_refused\" | \"two_consumers_on_host\" | \"trusted_local_only\" | \"unexpected_file_bytes\" | \"unexpected_staging_bytes\" | \"unknown_command\" | \"unknown_flag\" | \"unknown_method\" | \"unknown_source\" | \"unknown_tool\" | \"unpriced_model\" | \"unmanaged_database_path\" | \"unmanaged_path\" | \"unsupported_export_data\" | \"unsupported_path\" | \"untrack_not_db_only\" | \"upload_expired\" | \"upload_not_found\" | \"upload_protected_content\" | \"upload_too_many_parts\" | \"upstream\" | \"upstream_diverged\" | \"upstream_rewritten\" | \"upstream_unknown\" | \"vector_prewarm_extension_missing\" | \"vector_prewarm_unsupported_engine\" | \"vector_prewarm_wont_fit\" | \"verification_failed\" | \"visibility_noncanonical\" | \"visibility_not_applied\" | \"wakeshift_key_invalid\" | \"wakeshift_needs_conversation\" | \"wakeshift_not_enabled\" | \"wakeshift_refused\" | \"wakeshift_shared_brain\" | \"wakeshift_unavailable\" | \"withdrawal_capacity\" | \"withdrawal_mirror_failed\" | \"withdrawal_mirror_pending\" | \"withdrawal_provenance\" | \"write_capacity_low\" | \"write_gate_rejected\" | \"write_held\" | \"worktree_dirty\" | \"worktree_refreshing\" | \"writer_admin_intent_required\" | \"writer_admin_state_changed\" | \"writer_busy\" | \"writer_identity_publish_failed\" | \"writer_manifest_mismatch\" | \"writer_manifest_rescope_required\" | \"writer_manifest_unsafe\" | \"writer_regrant_required\" | \"writer_transfer_conflict\" | \"writer_transfer_required\" | \"wrong_account_consented\" | \"schema_pack_too_large\" | \"schema_pack_emit_mismatch\" | undefined",
"canonicalCode: string",
"cause?: unknown",
"code: ErrorCode",
diff --git a/test/git-command-stopped-recovery.test.ts b/test/git-command-stopped-recovery.test.ts
new file mode 100644
index 0000000000..c8e2f488c2
--- /dev/null
+++ b/test/git-command-stopped-recovery.test.ts
@@ -0,0 +1,84 @@
+/**
+ * A git child that gbrain stops (its time limit or a signal) after this change throws git_command_stopped instead of
+ * returning exit -1. Two recovery paths keyed on the old outcome must still see it.
+ * Protects: a write-through commit whose git child was stopped keeps its page in the pending write-through ledger
+ * (so the next write-through and `--pending` retry it and doctor dirty_age reports it), and a push URL whose ls-remote is
+ * stopped after the local commit still ends in push_unconfirmed (exit 4, the commit is durable locally; `--push-only`).
+ * Fails when: PENDING_NOTED leaves out git_command_stopped, or a remote call in pushBase or remoteContains omits returnStopped.
+ * Seams: none; real git in temp repositories. A pre-commit hook and an upload-pack wrapper kill their parent git with
+ * SIGKILL, the way the out-of-memory killer would. DB-free, so there is no engine axis.
+ */
+import { afterAll, expect, test } from 'bun:test';
+import { execFileSync } from 'node:child_process';
+import { chmodSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { commitPathsLocked, readPendingWriteThrough } from '../src/core/git/commit-push.ts';
+import { runCli } from './helpers/cli-spawn.ts';
+import { withEnv } from './helpers/with-env.ts';
+
+const dir = realpathSync(mkdtempSync(join(tmpdir(), 'gbrain-git-stopped-')));
+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`;
+
+/** A script that SIGKILLs the nearest git process above it (a shell may sit between, and git may run as git.real). */
+function killer(name: string): string {
+ const file = join(dir, name);
+ writeFileSync(file, [
+ '#!/bin/sh',
+ 'p=$$',
+ 'while [ "$p" -gt 1 ]; do',
+ ' p=$(ps -o ppid= -p "$p" | tr -d " ")',
+ ' case "$(ps -o comm= -p "$p")" in *git*) kill -9 "$p"; exit 1;; esac',
+ 'done',
+ 'exit 1',
+ '',
+ ].join('\n'));
+ chmodSync(file, 0o755);
+ return file;
+}
+
+test('a write-through commit whose git child is killed stays in the pending ledger', async () => {
+ const brain = join(dir, 'write-through');
+ execFileSync('git', ['init', '-q', '-b', 'main', brain]);
+ mkdirSync(join(brain, 'people'));
+ writeFileSync(join(brain, 'people', 'alice-example.md'), page('Alice', 'First version.'));
+ git(brain, 'add', '.'); git(brain, 'commit', '-qm', 'init');
+ const hooks = join(brain, '.git', 'hooks');
+ mkdirSync(hooks, { recursive: true });
+ writeFileSync(join(hooks, 'pre-commit'), `#!/bin/sh\nexec ${killer('kill-commit.sh')}\n`);
+ chmodSync(join(hooks, 'pre-commit'), 0o755);
+ writeFileSync(join(brain, 'people', 'alice-example.md'), page('Alice', 'A write-through edit.'));
+
+ const thrown = await withEnv(identity, async () => {
+ try { commitPathsLocked(brain, [join(brain, 'people', 'alice-example.md')], 'gbrain: write-through people/alice-example', { lockWaitMs: 1000 }); } catch (e) { return e as { code?: string; reason?: string }; }
+ return null;
+ });
+ expect(thrown).toMatchObject({ code: 'git_command_stopped', reason: 'signal' });
+ expect(readPendingWriteThrough(brain).map(e => e.path)).toContain('people/alice-example.md');
+}, 60_000);
+
+test('a push URL whose ls-remote is killed after the local commit reports push_unconfirmed, exit 4', async () => {
+ const first = join(dir, 'first.git'), second = join(dir, 'second.git'), brain = join(dir, 'push-brain'), home = join(dir, 'home');
+ execFileSync('git', ['init', '-q', '--bare', '-b', 'main', first]);
+ execFileSync('git', ['clone', '-q', first, brain], { stdio: 'ignore' });
+ git(brain, 'checkout', '-q', '-b', 'main');
+ writeFileSync(join(brain, 'a.md'), page('A', 'First version.'));
+ git(brain, 'add', '.'); git(brain, 'commit', '-qm', 'init'); git(brain, 'push', '-q', '-u', 'origin', 'main');
+ execFileSync('git', ['clone', '-q', '--bare', first, second], { stdio: 'ignore' });
+ git(brain, 'remote', 'set-url', '--add', '--push', 'origin', first);
+ git(brain, 'remote', 'set-url', '--add', '--push', 'origin', `file://${second}`);
+ git(brain, 'config', `remote.file://${second}.uploadpack`, killer('kill-upload-pack.sh'));
+ mkdirSync(home, { recursive: true });
+ writeFileSync(join(brain, 'a.md'), page('A', 'Second version.'));
+ const head = git(brain, 'rev-parse', 'HEAD');
+
+ const result = await runCli(['git', 'commit-push', '--json', '--path', brain, '-m', 'save page', '--', 'a.md'], { cwd: dir, home, env: { ...identity, GBRAIN_GIT_ALLOW_FILE_TRANSPORT: '1' } });
+ expect(JSON.parse(result.stdout).code).toBe('push_unconfirmed');
+ expect(result.exitCode).toBe(4);
+ expect(git(brain, 'rev-parse', 'HEAD')).not.toBe(head);
+ expect(git(brain, 'show', 'HEAD:a.md')).toBe(page('A', 'Second version.').trim());
+}, 60_000);
diff --git a/test/git-commit-push-large-index.test.ts b/test/git-commit-push-large-index.test.ts
new file mode 100644
index 0000000000..dc08b51b53
--- /dev/null
+++ b/test/git-commit-push-large-index.test.ts
@@ -0,0 +1,89 @@
+/**
+ * commit-push on a checkout whose index listing is larger than Node's default 1 MiB child-output limit.
+ * Protects: naming a folder that holds most of a large checkout commits and pushes, because every git read on the commit
+ * path takes its whole output; and a git child that is stopped (its time limit, or a signal) reports git_command_stopped
+ * with its reason, never git_unavailable and never a cut-off listing used as the answer.
+ * Fails when: the runner keeps the default output limit (git is killed with ENOBUFS and reported as "git ls-files -v
+ * failed: exit -1"), or a stopped child returns its partial output.
+ * Seams: none; real git, a generated index of 15,000 tracked files with long names, and a local bare remote.
+ */
+import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
+import { execFileSync } from 'node:child_process';
+import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { git as run } from '../src/core/git/git-run.ts';
+import { runCli } from './helpers/cli-spawn.ts';
+
+const dir = realpathSync(mkdtempSync(join(tmpdir(), 'gbrain-large-index-')));
+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]',
+ GBRAIN_GIT_ALLOW_FILE_TRANSPORT: '1' };
+const git = (root: string, ...args: string[]) => execFileSync('git', ['-C', root, '-c', 'user.name=Example', '-c', '[email protected]',
+ '-c', 'commit.gpgsign=false', ...args], { encoding: 'utf8', maxBuffer: Infinity, stdio: ['ignore', 'pipe', 'pipe'] });
+const FILES = 15_000;
+const remote = join(dir, 'remote.git'), brain = join(dir, 'brain'), home = join(dir, 'home');
+
+beforeAll(() => {
+ execFileSync('git', ['init', '-q', '--bare', '-b', 'main', remote]);
+ execFileSync('git', ['init', '-q', '-b', 'main', brain]);
+ for (let i = 0; i < FILES; i++) {
+ const shard = join(brain, 'archive', `shard-${String(i % 50).padStart(2, '0')}`);
+ if (i < 50) mkdirSync(shard, { recursive: true });
+ writeFileSync(join(shard, `a-page-with-a-long-generated-name-so-the-index-listing-grows-quickly-${String(i).padStart(6, '0')}.md`), '');
+ }
+ git(brain, 'add', '-A'); git(brain, 'commit', '-qm', 'seed');
+ git(brain, 'remote', 'add', 'origin', remote); git(brain, 'push', '-q', '-u', 'origin', 'main');
+ mkdirSync(home, { recursive: true });
+}, 120_000);
+
+const commitPush = (...paths: string[]) =>
+ runCli(['git', 'commit-push', '--json', '--path', brain, '-m', 'save pages', '--', ...paths], { cwd: dir, home, env: identity });
+
+describe('a checkout whose index listing passes 1 MiB', () => {
+ test('the listing under the named folder is over the old limit', () => {
+ expect(git(brain, 'ls-files', '-v', '-z', '--', 'archive').length).toBeGreaterThan(1024 * 1024);
+ });
+
+ test('naming a folder that holds most of the checkout commits and pushes it', async () => {
+ writeFileSync(join(brain, 'archive', 'shard-07', 'new-page.md'), 'New page.\n');
+ writeFileSync(join(brain, 'archive', 'shard-03', `a-page-with-a-long-generated-name-so-the-index-listing-grows-quickly-${'3'.padStart(6, '0')}.md`), 'Edited.\n');
+ const result = await commitPush('archive');
+ expect(result.stderr).not.toContain('git_unavailable');
+ expect(result.exitCode).toBe(0);
+ expect(JSON.parse(result.stdout)).toMatchObject({ outcome: 'pushed', paths: ['archive'] });
+ expect(git(remote, 'show', 'main:archive/shard-07/new-page.md')).toBe('New page.\n');
+ expect(git(brain, 'status', '--porcelain', '--', 'archive')).toBe('');
+ }, 120_000);
+
+ test('a single file in it commits and pushes too', async () => {
+ writeFileSync(join(brain, 'archive', 'shard-07', 'new-page.md'), 'Second version.\n');
+ const result = await commitPush('archive/shard-07/new-page.md');
+ expect(result.exitCode).toBe(0);
+ expect(JSON.parse(result.stdout).outcome).toBe('pushed');
+ expect(git(remote, 'show', 'main:archive/shard-07/new-page.md')).toBe('Second version.\n');
+ }, 120_000);
+});
+
+describe('a git child that does not exit on its own', () => {
+ const slow = ['-c', 'alias.slow=!sleep 5', 'slow'];
+ const killed = ['-c', 'alias.die=!kill -9 $PPID', 'die'];
+
+ test('a child past its time limit is git_command_stopped (timeout), not git_unavailable', () => {
+ let error: any;
+ try { run(brain, slow, { timeoutMs: 300 }); } catch (e) { error = e; }
+ expect(error).toMatchObject({ code: 'git_command_stopped', reason: 'timeout' });
+ expect(error.message).toContain('did not finish');
+ });
+
+ test('a child killed from outside is git_command_stopped (signal)', () => {
+ let error: any;
+ try { run(brain, killed); } catch (e) { error = e; }
+ expect(error).toMatchObject({ code: 'git_command_stopped', reason: 'signal' });
+ expect(error.message).toContain('SIGKILL');
+ });
+
+ test('a remote call can take the stop as its result instead', () => {
+ expect(run(brain, slow, { timeoutMs: 300, returnStopped: true }).stopped).toMatchObject({ reason: 'timeout' });
+ });
+});
diff --git a/test/git-commit-push-unmerged.test.ts b/test/git-commit-push-unmerged.test.ts
new file mode 100644
index 0000000000..d8fe9a994a
--- /dev/null
+++ b/test/git-commit-push-unmerged.test.ts
@@ -0,0 +1,74 @@
+/**
+ * commit-push refuses a named file that still has unresolved merge conflicts in the index (unmerged stage 1-3 entries,
+ * as a stash pop that stopped on a conflict leaves them, with no MERGE_HEAD), before it stages anything.
+ * Protects: the conflict markers never reach a commit or the remote, the other named paths are not committed either, and
+ * the file stays unmerged for the person to resolve, on a plain checkout and on a managed canonical worktree.
+ * Fails when: admitPaths stages the file with git add, which records it, markers and all, as resolved.
+ * Seams: none; the real CLI against temp repositories, a bare remote 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, 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-commit-unmerged-')));
+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[], input?: string) => execFileSync('git', ['-C', root, '-c', 'user.name=Example', '-c', '[email protected]',
+ '-c', 'commit.gpgsign=false', ...args], { encoding: 'utf8', input, stdio: ['pipe', 'pipe', 'pipe'] }).trim();
+const page = (title: string, body: string) => `---\ntitle: ${title}\n---\n${body}\n`;
+
+interface Fixture { home: string; remote: string; brain: string }
+
+/** A pushed checkout holding people/alice-example.md and notes/b.md; `managed` registers it as source-a's canonical worktree. */
+function fixture(name: string, managed: boolean): Fixture {
+ const remote = join(dir, `${name}.git`), brain = join(dir, `${name}-brain`), 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')); mkdirSync(join(brain, 'notes'));
+ writeFileSync(join(brain, 'people', 'alice-example.md'), page('Alice', 'First version.'));
+ writeFileSync(join(brain, 'notes', 'b.md'), page('B', 'First version.'));
+ git(brain, ['add', '.']); git(brain, ['commit', '-qm', 'init']); git(brain, ['push', '-q', '-u', 'origin', 'main']);
+ mkdirSync(home, { recursive: true });
+ if (managed) withEnv({ GBRAIN_HOME: home }, () => { recordManagedRoots('00000000-0000-4000-8000-000000000911', [{ local_path: brain, source_id: 'source-a' }]); });
+ return { home, remote, brain };
+}
+
+/** Leaves people/alice-example.md conflicted the way a stash pop that stopped on a conflict does: stages 1-3 in the index, markers in the file, no MERGE_HEAD. */
+function conflict(f: Fixture): string {
+ const path = 'people/alice-example.md';
+ const blob = (text: string) => git(f.brain, ['hash-object', '-w', '--stdin'], text);
+ const [base, ours, theirs] = [page('Alice', 'First version.'), page('Alice', 'Upstream edit.'), page('Alice', 'Local edit.')].map(blob);
+ const marked = `---\ntitle: Alice\n---\n<<<<<<< Updated upstream\nUpstream edit.\n=======\nLocal edit.\n>>>>>>> Stashed changes\n`;
+ writeFileSync(join(f.brain, path), marked);
+ git(f.brain, ['update-index', '--index-info'], `0 ${'0'.repeat(40)}\t${path}\n100644 ${base} 1\t${path}\n100644 ${ours} 2\t${path}\n100644 ${theirs} 3\t${path}\n`);
+ writeFileSync(join(f.brain, 'notes', 'b.md'), page('B', 'Second version.'));
+ return path;
+}
+
+for (const managed of [false, true]) {
+ test(`a named file with unresolved conflicts is refused before staging, and nothing is committed (${managed ? 'managed canonical worktree' : 'plain checkout'})`, async () => {
+ const f = fixture(managed ? 'managed' : 'plain', managed);
+ const path = conflict(f);
+ const head = git(f.brain, ['rev-parse', 'HEAD']), tip = git(f.remote, ['rev-parse', 'refs/heads/main']);
+ const unmerged = git(f.brain, ['ls-files', '-u', '--', path]);
+ expect(unmerged.split('\n')).toHaveLength(3);
+
+ const result = await runCli(['git', 'commit-push', '--json', '--path', f.brain, '-m', 'save pages', '--', path, 'notes/b.md'], { cwd: dir, home: f.home, env: identity });
+ expect(result.exitCode).toBe(1);
+ const envelope = JSON.parse(result.stdout);
+ expect(envelope.code).toBe('commit_paths_unmerged');
+ expect(envelope.message).toContain(path);
+ expect(envelope.fix).toMatchObject({ next: 'ask_user', verify: { argv: ['git', '-C', f.brain, 'ls-files', '-u', '--', `:(literal)${path}`] } });
+
+ expect(git(f.brain, ['rev-parse', 'HEAD'])).toBe(head);
+ expect(git(f.remote, ['rev-parse', 'refs/heads/main'])).toBe(tip);
+ expect(git(f.brain, ['ls-files', '-u', '--', path])).toBe(unmerged);
+ expect(git(f.brain, ['diff', '--cached', '--name-only', '--', 'notes/b.md'])).toBe('');
+ }, 60_000);
+}
diff --git a/test/openclaw-skill-plugin.test.ts b/test/openclaw-skill-plugin.test.ts
index f474665a77..ac9b9ed86f 100644
--- a/test/openclaw-skill-plugin.test.ts
+++ b/test/openclaw-skill-plugin.test.ts
@@ -81,6 +81,11 @@ async function setup(b: Box, extra: string[], env: Record<string, string | undef
return { ...r, doc, resolver: doc?.skill_resolver };
}
+/** Assert a setup run's exit code; a mismatch prints the run's stdout and stderr, so the failure names its cause. */
+function expectExit(r: { exitCode: number; stdout: string; stderr: string }, code: number): void {
+ expect(r.exitCode, `setup exited ${r.exitCode}, expected ${code}\n--- stdout\n${r.stdout}\n--- stderr\n${r.stderr}`).toBe(code);
+}
+
const calls = (b: Box) => (existsSync(b.calls) ? readFileSync(b.calls, 'utf8').trim().split('\n').filter((l) => l.includes('gbrain-skill-resolver')) : []);
const gbrainHome = (b: Box) => join(b.home, '.gbrain');
const statePath = (b: Box) => join(gbrainHome(b), 'openclaw-skill-resolver.json');
@@ -130,7 +135,7 @@ describe.skipIf(!NODE)('gbrain setup openclaw --skill-loading', () => {
test('shadow installs once; a flip to live runs no OpenClaw command and keeps the plugin files', async () => {
const b = box();
const first = await setup(b, ['--skill-loading', 'shadow']);
- expect(first.exitCode).toBe(0);
+ expectExit(first, 0);
expect(first.resolver.error).toBeUndefined();
expect(first.resolver.steps.map((s: any) => s.step)).toEqual(['catalog', 'library', 'state', 'plugin', 'install', 'verify', 'self-test']);
expect(calls(b)).toEqual([
@@ -144,7 +149,7 @@ describe.skipIf(!NODE)('gbrain setup openclaw --skill-loading', () => {
const index = readFileSync(join(pluginDir(b), 'index.js'), 'utf8');
const before = calls(b).length;
const flip = await setup(b, ['--skill-loading', 'resolve', '--live-fraction', '0.5']);
- expect(flip.exitCode).toBe(0);
+ expectExit(flip, 0);
expect(calls(b).length).toBe(before);
expect(flip.resolver.steps.find((s: any) => s.step === 'install')).toMatchObject({ action: 'skip' });
expect(readFileSync(join(pluginDir(b), 'index.js'), 'utf8')).toBe(index);
@@ -155,7 +160,7 @@ describe.skipIf(!NODE)('gbrain setup openclaw --skill-loading', () => {
test('no openclaw on PATH: exit 3, skill_resolver_plugin_not_installed, the commands still to run', async () => {
const b = box({ openclaw: false });
const r = await setup(b, ['--skill-loading', 'resolve']);
- expect(r.exitCode).toBe(3);
+ expectExit(r, 3);
expect(r.resolver.error.code).toBe('skill_resolver_plugin_not_installed');
expect(r.resolver.error.commands).toHaveLength(3);
expect(r.resolver.error.recovery).toContain('0 of 3 commands ran');
@@ -166,7 +171,7 @@ describe.skipIf(!NODE)('gbrain setup openclaw --skill-loading', () => {
test('a failed openclaw step: exit 3 naming it, with only the remaining commands', async () => {
const b = box();
const r = await setup(b, ['--skill-loading', 'resolve'], { FAIL_STEP: 'plugins enable' });
- expect(r.exitCode).toBe(3);
+ expectExit(r, 3);
expect(r.resolver.error.code).toBe('skill_resolver_plugin_not_installed');
expect(r.resolver.error.message).toContain('boom: plugins enable failed');
expect(r.resolver.error.commands).toEqual(['openclaw plugins enable gbrain-skill-resolver', 'openclaw config set plugins.entries.gbrain-skill-resolver.hooks.allowConversationAccess true'].map((c) => join(b.root, 'bin') + '/' + c));
@@ -176,7 +181,7 @@ describe.skipIf(!NODE)('gbrain setup openclaw --skill-loading', () => {
test('plugins inspect not showing it loaded: exit 3, never success', async () => {
const b = box();
const r = await setup(b, ['--skill-loading', 'resolve'], { INSPECT_BROKEN: '1' });
- expect(r.exitCode).toBe(3);
+ expectExit(r, 3);
expect(r.resolver.error.code).toBe('skill_resolver_plugin_not_installed');
});
@@ -193,7 +198,7 @@ describe.skipIf(!NODE)('gbrain setup openclaw --skill-loading', () => {
const b = box();
mkdirSync(gbrainHome(b), { recursive: true });
writeFileSync(join(gbrainHome(b), 'config.json'), JSON.stringify({ skills: { resolver: { pinned: ['email-triage'], per_harness: { openclaw: { top_k: 2 } } } } }));
- expect((await setup(b, ['--skill-loading', 'resolve'])).exitCode).toBe(0);
+ expectExit(await setup(b, ['--skill-loading', 'resolve']), 0);
expect(readState(b).agents.main).toMatchObject({ top_k: 2, min_match: 'description', exclude_ids: ['email-triage'] });
const out = drive(b, [['turn', { text: 'deploy the service to production and triage the email inbox', id: 'm1' }]]);
expect(out[0].appendContext).toContain('deploy-service');
@@ -204,7 +209,7 @@ describe.skipIf(!NODE)('gbrain setup openclaw --skill-loading', () => {
const b = box();
mkdirSync(gbrainHome(b), { recursive: true });
writeFileSync(join(gbrainHome(b), 'config.json'), JSON.stringify({ skills: { resolver: { per_harness: { openclaw: { top_gate: 100 } } } } }));
- expect((await setup(b, ['--skill-loading', 'resolve'])).exitCode).toBe(0);
+ expectExit(await setup(b, ['--skill-loading', 'resolve']), 0);
expect(readState(b).agents.main).toMatchObject({ top_gate: 100 });
const out = drive(b, [['turn', { text: 'deploy the service to production', id: 'g1' }]]);
expect(out[0]?.appendContext ?? '').not.toContain('deploy-service');
@@ -212,23 +217,30 @@ describe.skipIf(!NODE)('gbrain setup openclaw --skill-loading', () => {
const off = box();
mkdirSync(gbrainHome(off), { recursive: true });
writeFileSync(join(gbrainHome(off), 'config.json'), JSON.stringify({ skills: { resolver: { top_gate: 0 } } }));
- expect((await setup(off, ['--skill-loading', 'resolve'])).exitCode).toBe(0);
+ expectExit(await setup(off, ['--skill-loading', 'resolve']), 0);
expect(readState(off).agents.main).toMatchObject({ top_gate: 0 });
const weak = 'what runs in production today';
const shown = drive(off, [['turn', { text: weak, id: 'g2' }]]);
expect(shown[0]?.appendContext ?? '').toContain('deploy-service');
const dflt = box();
- expect((await setup(dflt, ['--skill-loading', 'resolve'])).exitCode).toBe(0);
+ expectExit(await setup(dflt, ['--skill-loading', 'resolve']), 0);
expect(readState(dflt).agents.main.top_gate).toBeUndefined();
const gated = drive(dflt, [['turn', { text: weak, id: 'g3' }]]);
expect(gated[0]?.appendContext ?? '').not.toContain('deploy-service');
});
+ test('the setup self-test checks that a turn resolves, not that it beats a live turn\'s deadline (a slow machine still installs)', async () => {
+ const b = box();
+ const r = await setup(b, ['--skill-loading', 'resolve'], { GBRAIN_TEST_OPENCLAW_SKILL_DEADLINE_MS: '1' });
+ expectExit(r, 0);
+ expect(r.resolver.steps.map((s: { step: string }) => s.step)).toContain('self-test');
+ });
+
test('--dry-run writes nothing', async () => {
const b = box();
const r = await setup(b, ['--skill-loading', 'resolve', '--dry-run']);
- expect(r.exitCode).toBe(0);
+ expectExit(r, 0);
expect(existsSync(statePath(b))).toBe(false);
expect(existsSync(pluginDir(b))).toBe(false);
expect(calls(b)).toEqual([]);
@@ -254,7 +266,7 @@ describe.skipIf(!NODE)('the OpenClaw eligibility filter', () => {
{ name: 'weather', eligible: false, modelVisible: false },
]);
const r = await setup(b, ['--skill-loading', 'resolve'], env);
- expect(r.exitCode).toBe(0);
+ expectExit(r, 0);
expect([...readState(b).agents.main.exclude_ids].sort()).toEqual(['calendar-sync', 'email-triage']);
expect(r.resolver.agents[0]).toMatchObject({ id: 'main', skills: 1 });
const notes = r.resolver.notes.join('\n');
@@ -270,7 +282,7 @@ describe.skipIf(!NODE)('the OpenClaw eligibility filter', () => {
test('a list naming none of the catalog' + "'" + 's skills filters nothing and says so', async () => {
const b = box();
const r = await setup(b, ['--skill-loading', 'resolve'], listed(b, [{ name: 'weather', eligible: true, modelVisible: true }]));
- expect(r.exitCode).toBe(0);
+ expectExit(r, 0);
expect(readState(b).agents.main.exclude_ids).toEqual([]);
expect(r.resolver.agents[0].skills).toBe(3);
expect(r.resolver.notes.join('\n')).toContain('lists none of openclaw-main' + "'" + 's skills for this agent, so the catalog was not filtered');
@@ -279,11 +291,11 @@ describe.skipIf(!NODE)('the OpenClaw eligibility filter', () => {
test('a failed list, or no openclaw on PATH, filters nothing', async () => {
const b = box();
const r = await setup(b, ['--skill-loading', 'resolve']);
- expect(r.exitCode).toBe(0);
+ expectExit(r, 0);
expect(readState(b).agents.main.exclude_ids).toEqual([]);
expect(r.resolver.notes.join('\n')).toContain('--agent main' + String.fromCharCode(96) + ' failed, so skills OpenClaw hides from this agent were not filtered');
const none = box({ openclaw: false });
- expect((await setup(none, ['--skill-loading', 'resolve'])).exitCode).toBe(3);
+ expectExit(await setup(none, ['--skill-loading', 'resolve']), 3);
expect(readState(none).agents.main.exclude_ids).toEqual([]);
});
});
@@ -307,7 +319,7 @@ describe.skipIf(!NODE)('gbrain skills pin', () => {
expect(st.pinned_block).toContain('id: "deploy-service" when: "Before any production deploy"');
expect(st.pinned_block).toContain('skills_read({name})');
const off = await setup(b, ['--skill-loading', 'off']);
- expect(off.exitCode).toBe(0);
+ expectExit(off, 0);
expect(existsSync(statePath(b))).toBe(false);
expect(existsSync(pluginDir(b))).toBe(false);
expect(calls(b).at(-1)).toBe('plugins uninstall gbrain-skill-resolver --force');
@@ -378,7 +390,7 @@ describe.skipIf(!NODE)('the gbrain-skill-resolver plugin under Node', () => {
const skills = join(b.state, 'workspace', 'skills');
mkdirSync(join(skills, 'zeta-notes'), { recursive: true });
writeFileSync(join(skills, 'zeta-notes', 'SKILL.md'), '---\nname: zeta-notes\ndescription: Use when you keep a journal\n---\nAlso covers quarterly xylophone tuning.\n');
- expect((await setup(b, ['--skill-loading', 'resolve'])).exitCode).toBe(0);
+ expectExit(await setup(b, ['--skill-loading', 'resolve']), 0);
const out = drive(b, [
['turn', { text: 'xylophone tuning', id: 'm1' }],
['turn', { text: 'triage the email inbox and the xylophone tuning', id: 'm2', session: 'agent:main:s2' }],
@@ -476,7 +488,7 @@ describe.skipIf(!NODE)('the gbrain-skill-resolver plugin under Node', () => {
describe.skipIf(!NODE)('doctor skill_resolver: the OpenClaw plugin', () => {
test('reports the deadline-miss rate from the daily logs and warns above 5% once there are 20 turns', async () => {
const b = box();
- expect((await setup(b, ['--skill-loading', 'shadow'])).exitCode).toBe(0);
+ expectExit(await setup(b, ['--skill-loading', 'shadow']), 0);
const dir = join(gbrainHome(b), 'skill-index', 'logs');
mkdirSync(dir, { recursive: true });
const at = new Date().toISOString();