Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(sync): refuse a relative stored sync anchor; diagnose stalled foreground writes by operation (#7630)

garrytanceb4fcfa1a6e
diff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.md
index c54608a739..254610e578 100644
--- a/docs/guides/error-codes.md
+++ b/docs/guides/error-codes.md
@@ -4151,6 +4151,16 @@ More: [docs/designs/GIT_CANONICAL_MEMORY.md#the-model](../../docs/designs/GIT_CA
|---|---|---|---|---|---|---|
| `sync.admission` is not `normal`, so managed sync admits less than it classifies: `imports_only` admits no deletes and no keep_db writes (they wait as `paused_deletes` and `paused_keep_db`), and `classify_only` writes and stamps nothing. | The owner sets the switch on the brain host (`gbrain config set`; it is never settable remotely) as the first response to a suspected sync bug. A pass reads it at pin and in every group's admission, and a destructive request re-reads it at publication, so the change applies at the next group; `sync status --json` reports `admission: {value, set_at, effective}`, where `effective` turns true once no pass pinned before `set_at` holds the lease and no delete or keep_db reconcile admitted before it is unpublished. Doctor warns, with the value's age, for as long as it stays restricted. | Tell the user how long ago the switch was set and ask whether its reason still holds. Only they restore it: gbrain config set sync.admission normal on the brain host; the next sync admits what waited. Run: gbrain config set sync.admission normal | user | `gbrain doctor --only sync_admission_restricted --json` | 1 | no |
+### sync_anchor_relative
+
+<a id="sync_anchor_relative"></a>
+
+| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |
+|---|---|---|---|---|---|---|
+| Sync refused: the source's stored directory (sources.local_path, or sync.repo_path) is a relative path such as ".", which names whatever directory gbrain runs from. | A relative stored path cannot prove which folder is the brain. Before #7630 a sync run from an unrelated folder treated that folder as the brain repo: it Git-initialized it, committed everything in it and imported its markdown. gbrain now refuses before any Git probe or import, and nothing is changed. | Ask the user which directory holds the source, then gbrain sources set-path <id> <absolute-directory>; or clear the pointer with gbrain sources set-path <id> --clear. | user | `repeat the read that failed` | 3 | no |
+
+More: [docs/guides/troubleshooting.md#relative-source-path](../../docs/guides/troubleshooting.md#relative-source-path)
+
### sync_cursor_replaced
<a id="sync_cursor_replaced"></a>
diff --git a/docs/guides/troubleshooting.md b/docs/guides/troubleshooting.md
index 91852044ac..77915c00b1 100644
--- a/docs/guides/troubleshooting.md
+++ b/docs/guides/troubleshooting.md
@@ -820,3 +820,36 @@ syncs keep ending `partial` or failing has none, however many pages it imported.
- `last_attempt_unsuccessful`: read the job (`gbrain jobs get <id> --json`)
or the managed failure, then retry.
- `no_attempt`: run `gbrain sync --source <id>` (`--no-pull` on a managed brain).
+
+## Relative source path
+
+<a id="relative-source-path"></a>
+
+**Say to your agent:** *"Sync refused with `sync_anchor_relative`, or doctor warns that my default source's local_path is relative."*
+
+A source's stored directory (`sources.local_path`, or the legacy `sync.repo_path`)
+must be an absolute path. A relative one such as `.` names whatever directory
+gbrain runs from, so it cannot say which folder is the brain. Before #7630, a
+`gbrain sync --source default` or `gbrain sync --all` run from an unrelated
+folder treated that folder as the brain repo: it ran `git init`, committed
+everything in it and imported its markdown. Sync now refuses
+`sync_anchor_relative` (exit 3) before any Git probe, cost estimate or import,
+and nothing is changed. Doctor's `default_source_local_path` check warns on a
+relative `default` path.
+
+Ask the user which directory holds the source, then do one of:
+
+- `gbrain sources set-path <id> <absolute-directory>` points the source at that
+ directory (non-destructive; it only updates the pointer).
+- `gbrain sources set-path <id> --clear` clears the relative pointer. It changes
+ no file or page. A `default` source with no path writes through
+ `sync.repo_path` (the designed fallback), and its sync refuses until a path
+ is set again.
+
+For `sync.repo_path`: `gbrain config set sync.repo_path <absolute-directory>`.
+
+If an earlier sync already initialized and imported the wrong folder, the user
+decides what to undo: the folder's new `.git` directory and the pages imported
+from it are theirs to review before anything is removed.
+Verify with `gbrain sources status <id> --json` and
+`gbrain doctor --only default_source_local_path --json`.
diff --git a/llms-full.txt b/llms-full.txt
index a134c186ef..9406d25424 100644
--- a/llms-full.txt
+++ b/llms-full.txt
@@ -10978,6 +10978,39 @@ syncs keep ending `partial` or failing has none, however many pages it imported.
or the managed failure, then retry.
- `no_attempt`: run `gbrain sync --source <id>` (`--no-pull` on a managed brain).
+## Relative source path
+
+<a id="relative-source-path"></a>
+
+**Say to your agent:** *"Sync refused with `sync_anchor_relative`, or doctor warns that my default source's local_path is relative."*
+
+A source's stored directory (`sources.local_path`, or the legacy `sync.repo_path`)
+must be an absolute path. A relative one such as `.` names whatever directory
+gbrain runs from, so it cannot say which folder is the brain. Before #7630, a
+`gbrain sync --source default` or `gbrain sync --all` run from an unrelated
+folder treated that folder as the brain repo: it ran `git init`, committed
+everything in it and imported its markdown. Sync now refuses
+`sync_anchor_relative` (exit 3) before any Git probe, cost estimate or import,
+and nothing is changed. Doctor's `default_source_local_path` check warns on a
+relative `default` path.
+
+Ask the user which directory holds the source, then do one of:
+
+- `gbrain sources set-path <id> <absolute-directory>` points the source at that
+ directory (non-destructive; it only updates the pointer).
+- `gbrain sources set-path <id> --clear` clears the relative pointer. It changes
+ no file or page. A `default` source with no path writes through
+ `sync.repo_path` (the designed fallback), and its sync refuses until a path
+ is set again.
+
+For `sync.repo_path`: `gbrain config set sync.repo_path <absolute-directory>`.
+
+If an earlier sync already initialized and imported the wrong folder, the user
+decides what to undo: the folder's new `.git` directory and the pages imported
+from it are theirs to review before anything is removed.
+Verify with `gbrain sources status <id> --json` and
+`gbrain doctor --only default_source_local_path --json`.
+
---
## docs/guides/exit-codes.md
diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsv
index 4d9b63679a..71c5093aa8 100644
--- a/scripts/module-size-limits.tsv
+++ b/scripts/module-size-limits.tsv
@@ -47,4 +47,4 @@ src/commands/doctor/checks/extraction-sync.ts 1500 ratchet +7 GBRA-130 A-1: link
src/core/search/evidence-delivery.ts 1733 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); new row: crossed the 1500 unlisted cap at the #6367 merge (master 1479, its explicit-budget cap) by the C1 date header threaded through every block path, cap included; pagePlanHits (search/page-plan-hits.ts) and the header loader (evidence-date.ts blockDateHeaders) were peeled first; peel candidate: allocateCapped; +8 at the #6396 merge: page evidence text cut through the fence-chunk trust overlay and the caller minTrust floor (re-summed: our 1504 + master +8); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136); +39 Wave B PR 2 lane 2b: planSegmentedBlock joins the windows search/segmented-evidence.ts reads around a segmented page's hits into one run-marked document (needs the private Doc/Piece/buildDoc/locateAnchor internals), planBlock's unit cut split into blockFromDoc for both, sections bounded by their run, selectionCost counts a gap between runs, and the fetch skips the whole-body fence overlay for a segmented page; +4 segmented pages read at once before planning (segmentedReads; the read is search/segmented-evidence.ts, the statements page-body/read-range.ts); +17 GBRA-156: tail trim plan flag, DeliverOptions.query, DeliveryMeta.tail_trim, the trim call and the frozen-hit score/query library fields (logic in search/evidence-tail-trim.ts; interface fields cannot move)
src/commands/config.ts 1523 ratchet 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)
src/commands/mcp-expose.ts 1512 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)
-src/core/behavior-change-notice.ts 1502 ratchet new row: crossed the 1500 unlisted cap with the GBRA-95 RLS backfill disclosure row (+2); the behavior-change table split (#7607) retires this row
+src/core/behavior-change-notice.ts 1505 ratchet new row: crossed the 1500 unlisted cap with the GBRA-95 RLS backfill disclosure row (+2); +3 GBRA-207 #7630 relative-anchor and stalled-write disclosure rows; the behavior-change table split (#7607) retires this row
diff --git a/src/commands/sources-lifecycle-args.ts b/src/commands/sources-lifecycle-args.ts
index 3715355d90..25ab9965a9 100644
--- a/src/commands/sources-lifecycle-args.ts
+++ b/src/commands/sources-lifecycle-args.ts
@@ -85,7 +85,7 @@ export function parseSourceLifecycleArgs(args: string[], generatedId = randomUUI
`Give the successor directory once: gbrain sources set-path ${id} DIRECTORY, or --path DIRECTORY, not both.`);
const target = positionals.shift() ?? values.get('path');
if (!target) throw invalid('set-path requires the verified successor directory.',
- `Pass the directory that now holds source ${id}'s checkout: gbrain sources set-path ${id} DIRECTORY (--clear clears a connector source's stale local_path).`);
+ `Pass the directory that now holds source ${id}'s checkout: gbrain sources set-path ${id} DIRECTORY (--clear clears a connector source's stale local_path, or any relative one).`);
params.path = absolute(target);
}
if (positionals.length) throw invalid(`Unexpected argument: ${positionals[0]}.`, `Remove ${positionals[0]}; sources ${verb} takes only the source id${verb === 'set-path' ? ' and the directory' : ''} as arguments.`);
diff --git a/src/commands/sources-lifecycle.ts b/src/commands/sources-lifecycle.ts
index 83823ef7ba..7f8f0d17a4 100644
--- a/src/commands/sources-lifecycle.ts
+++ b/src/commands/sources-lifecycle.ts
@@ -21,7 +21,7 @@ export const SOURCE_LIFECYCLE_HELP = `Managed source administration:
gbrain sources remove <id> --confirm-destructive
gbrain sources purge <archived-id> --confirm-destructive
gbrain sources set-path <id> <verified-directory>
- gbrain sources set-path <id> --clear (connector sources: clear a stale local_path)
+ gbrain sources set-path <id> --clear (connector sources, or any relative local_path: clear it)
gbrain sources reclone <id>
All commands accept --request-id <uuid>, --expected-incarnation <uuid>, --dry-run,
diff --git a/src/commands/sources-set-path.ts b/src/commands/sources-set-path.ts
index 7f4a5f547b..4a36f32876 100644
--- a/src/commands/sources-set-path.ts
+++ b/src/commands/sources-set-path.ts
@@ -39,7 +39,7 @@ export async function runSetPath(engine: BrainEngine, rawArgs: string[]): Promis
console.error(' its write-through target and walks for sync/audit. Non-destructive: only');
console.error(' updates the pointer, never touches files on disk.');
console.error(" Refuses a path that overlaps another source's tree; --force bypasses that guard.");
- console.error(' --clear removes a connector source\'s (google, github) stale local_path; it takes no path.');
+ console.error(' --clear removes a connector source\'s (google, github) stale local_path, or any source\'s relative one; it takes no path.');
process.exit(2);
}
@@ -93,18 +93,19 @@ export async function runSetPath(engine: BrainEngine, rawArgs: string[]): Promis
console.log('Run `gbrain doctor` to confirm the change resolves any related warning.');
}
-/** #5673: `gbrain sources set-path <id> --clear` for connector sources. */
+/** #5673: `gbrain sources set-path <id> --clear` for connector sources; #7630: and for any relative local_path. */
async function runClearPath(engine: BrainEngine, args: string[]): Promise<void> {
const [id, extra] = args;
if (!id || extra !== undefined || args.some(a => a.startsWith('-'))) {
console.error('Usage: gbrain sources set-path <id> --clear');
- console.error(' --clear takes no path: it removes a connector source\'s local_path. To set a path, run gbrain sources set-path <id> <path>.');
+ console.error(' --clear takes no path: it removes a connector source\'s local_path, or any source\'s relative one. To set a path, run gbrain sources set-path <id> <path>.');
process.exit(2);
}
try {
- const { prior } = await clearConnectorLocalPath(engine, id);
+ const { prior, connector } = await clearConnectorLocalPath(engine, id);
console.log(prior === null ? `Source "${id}" has no local_path; nothing to clear.` : `Cleared source "${id}" local_path (was ${prior}).`);
- console.log('Autopilot keeps syncing it from its provider on the autopilot interval.');
+ console.log(connector ? 'Autopilot keeps syncing it from its provider on the autopilot interval.'
+ : `No file or page changed. Sync of "${id}" refuses until a directory is set: gbrain sources set-path ${id} <absolute-directory>.`);
} catch (e) {
if (!(e instanceof OperationError)) throw e;
console.error(`Error (${e.code}): ${e.message}`);
diff --git a/src/commands/sync/preflight.ts b/src/commands/sync/preflight.ts
index f4f915baad..1ea08ab719 100644
--- a/src/commands/sync/preflight.ts
+++ b/src/commands/sync/preflight.ts
@@ -298,12 +298,11 @@ async function resolveSyncRepo(engine: BrainEngine, opts: SyncOpts): Promise<{ d
: `No repo path specified. Use --repo or run gbrain init with --repo first.`;
throw new Error(hint);
}
- // #3696: resolve to ABSOLUTE at entry. A relative path (legacy relative
- // sources.local_path row, or a caller-passed `--repo .`) breaks the moment
- // any consumer runs from a different cwd (launchd daemon at cwd=/). Since
- // writeSyncAnchor('repo_path', anchorPath) re-persists this value below,
- // one successful sync from the right cwd self-heals a legacy relative row
- // to absolute.
+ // #3696: resolve to ABSOLUTE at entry. A caller-passed relative path
+ // (`--repo .`) breaks the moment any consumer runs from a different cwd
+ // (launchd daemon at cwd=/). A relative STORED anchor never reaches here:
+ // performSync refuses it `sync_anchor_relative` (#7630), because from an
+ // unrelated cwd it would make that folder the brain repo.
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal -- rawRepoPath is the local operator's --repo CLI arg or the operator-written sync anchor (sync.repo_path / sources.local_path); the sync_brain op is localOnly:true so no remote caller reaches this path, and absolutizing it here IS the #3696 fix
const repoPath = pathResolve(rawRepoPath);
diff --git a/src/commands/sync/run.ts b/src/commands/sync/run.ts
index e78926b154..4e6994133f 100644
--- a/src/commands/sync/run.ts
+++ b/src/commands/sync/run.ts
@@ -1,5 +1,6 @@
/** `gbrain sync` CLI body (`runSyncInner`): flag parsing, --all fan-out, watch mode. */
import { existsSync } from 'fs';
+import { isAbsolute } from 'path';
import { getCompanyBrainProfile } from '../../core/company-brain/profile.ts';
import { slog, withSourcePrefix } from '../../core/console-prefix.ts';
import type { BrainEngine } from '../../core/engine.ts';
@@ -19,6 +20,7 @@ import {
import type { SyncEmbedBackfillOutcome } from '../../core/sync-embed-backfill.ts';
import { runBreakLock } from '../../core/sync-lock.ts';
import { automaticSyncSkip, isSyncDisabledConfig } from '../../core/sync-policy.ts';
+import { assertSyncAnchorAbsolute, syncAnchorRelativeError } from '../../core/sync-applicability.ts';
import { composeAbortSignals } from '../../core/sync-reconcile.ts';
import { acknowledgeFailures, unacknowledgedSyncFailures } from '../../core/sync.ts';
import type { SyncResult, SyncOpts } from '../sync.ts';
@@ -469,6 +471,8 @@ async function runSyncAll(
const companyPolicies = new Map<string, Awaited<ReturnType<typeof getCompanyBrainProfile>>>();
const policyFailures = new Map<string, unknown>();
for (const source of runnableSources) {
+ // #7630: a relative local_path fails its source before the cost gate walks the directory.
+ if (source.local_path && !isAbsolute(msysToNativePath(source.local_path))) { policyFailures.set(source.id, syncAnchorRelativeError(source.id, source.local_path)); continue; }
try { companyPolicies.set(source.id, await getCompanyBrainProfile(engine, source.id)); }
catch (error) { policyFailures.set(source.id, error); }
}
@@ -813,6 +817,8 @@ async function runSingleSourceSync(
excludePatterns, includeHiddenPatterns, concurrency, timeoutSeconds,
} = flags;
const { sourceId, companyPolicy, noEmbed, resumeCommand, args } = input;
+ // #7630: before the cost gate walks the directory.
+ await assertSyncAnchorAbsolute(engine, { sourceId, repoPath });
// v0.41.13.0 (T6) — single-source --timeout: same per-source AbortController
// shape as the --all runOne closure. Timer scoped to this CLI invocation;
// try/finally clears it after performSync resolves (or throws).
diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.ts
index 62020e1c05..f9ff255199 100644
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@ -1302,6 +1302,9 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;
{ since: '0.60.460.0', text: 'A legacy fact row whose `notability` or `confidence` is empty (a long-lived database whose column lost its NOT NULL) is now adopted into its page\'s `## Facts` table with the column default (notability `medium`, confidence 1) instead of being refused as unadoptable (`parse`) on every run, which held its page out of fact reconciliation and booked an `integrity_guard` halt each cycle. The fence cell is written first and the row derives its values from it. A row with no kind or visibility is still refused.' },
{ since: '0.60.460.0', text: '`gbrain repair duplicate-facts` keeps the copy that is a row of a page\'s `## Facts` table over an older database-only copy of the same fact, so the legacy copy is superseded onto the fence row instead of holding it (which left the legacy row unfenced and its page out of fact reconciliation). With no fenced copy it still keeps the oldest row. It stays preview-first and explicit.' },
{ since: '0.60.460.0', text: 'Dream consolidation on a managed brain now closes a fenced fact in its page: the closing `valid_until` is written into the fact\'s row in the entity page\'s `## Facts` fence, published with the take, and the database row takes its value from that cell, so a later sync or re-import keeps the fact closed. Before, only the database row was closed and the next re-import of the page reopened it. A fact with no fence row is still closed in the database. A fenced fact whose fence row is on another page is left open. Facts an earlier release closed in the database only are not changed (GBRA-190).' },
+ // GBRA-207 (#7630). `since` is stamped at the merge slot.
+ { since: 'TBD', id: 'sync_refuses_relative_anchor', text: 'A sync whose source directory (`sources.local_path`) or legacy `sync.repo_path` is a relative path such as `.` now refuses `sync_anchor_relative` (exit 3) before any Git probe or import, instead of treating whatever folder it ran from as the brain repo (Git init, a baseline commit of the whole folder, an import of its markdown). `gbrain sources set-path <id> <absolute-directory>` sets the path, `gbrain sources set-path <id> --clear` now also clears a relative path on any source, and doctor\'s `default_source_local_path` warns on a relative default path.' },
+ { since: 'TBD', text: 'A foreground write (`remember`, `put_page` and the other non-sync operations) that ends with a retryable fault such as `preparation_stalled` now carries a diagnosis that inspects the writer read-only (`gbrain sources writer status --source <id> --json`) and says to resubmit the same write with a new request_id, instead of telling the user to run `gbrain sync`. Recorded sync faults keep their sync retry.' },
// GBRA-95 RLS backfill. `since` is stamped at the merge slot.
{ since: '0.60.463.0', id: 'rls_backfill_unguarded_tables', text: 'On Postgres, a schema migration now enables row-level security on every gbrain table still without it. A table could be left without RLS because its RLS came only from a full schema replay, which `gbrain apply-migrations --yes` does not run (the four incremental-derivation tables, `page_segment_derivations`, `page_derivation_spend` and the two purge tables), or only from the auto-RLS event trigger, which needs a superuser and is absent on many managed brains. Supabase gives public tables anon and authenticated grants, so with the Data API on such a table was reachable with the anon key. Only a table still without RLS changes; one with a `GBRAIN:RLS_EXEMPT` comment is left alone; no row is read or written. Under a role that does not bypass RLS or does not own a table, the migration names the table on stderr and leaves it, and `gbrain doctor` (rls) keeps naming it with the fix. `gbrain repair missing-tables` now recreates a cache table with RLS on. A role that neither owns a table nor bypasses RLS reads no rows from it and cannot insert or update it once RLS is on (a read-only reporting role or a scoped write role, for example): give that role policies before upgrading (docs/ENGINES.md has the source-scope recipe), or, to keep a table open to it on purpose, add the `GBRAIN:RLS_EXEMPT reason=...` comment to that table. A write role set up with an earlier copy of that recipe also needs its new policies on `page_derivation_spend` and the two purge tables: without them its segmented derivation writes are refused, and the derivation purge triggers its writes fire read no purge, so they do not hold back a purged claim.' },
];
diff --git a/src/core/default-source-path-check.ts b/src/core/default-source-path-check.ts
index cceaf28c6f..1335c2fa5e 100644
--- a/src/core/default-source-path-check.ts
+++ b/src/core/default-source-path-check.ts
@@ -21,6 +21,10 @@
* nor a resolvable `sync.repo_path` names the tree they live in, so
* write-through, fence writes, and delete-reconcile cannot find them.
*
+ * - RELATIVE PATH (#7630): a set `local_path` that is not absolute (a
+ * legacy "."). It names whatever directory gbrain runs from, and sync
+ * refuses it `sync_anchor_relative`.
+ *
* Everything else (no pages yet, resolvable repo fallback, deliberate
* DB-only brain) reports ok. The repair for a genuinely broken pointer is
* the non-destructive `gbrain sources set-path default <path>`.
@@ -30,6 +34,8 @@
* npm-squat-check.ts / pglite-leftovers-check.ts. The gathering wrapper
* lives on the doctor surface (doctor/checks/default-source-path.ts).
*/
+import { isAbsolute } from 'path';
+
export interface DefaultSourcePathInput {
/** The `default` sources row, or undefined when no such row exists. */
defaultSource: { local_path: string | null } | undefined;
@@ -62,6 +68,16 @@ export function assessDefaultSourcePath(
// integrity.
return { status: 'skip', message: '' };
}
+ if (defaultSource.local_path && !isAbsolute(defaultSource.local_path)) {
+ return {
+ status: 'warn',
+ message:
+ `default source local_path is the relative path "${defaultSource.local_path}", which names whatever directory ` +
+ 'gbrain runs from, so sync refuses it (sync_anchor_relative). Ask the user which directory holds the brain, then ' +
+ 'run `gbrain sources set-path default <absolute-directory>`, or clear the pointer with ' +
+ '`gbrain sources set-path default --clear`.',
+ };
+ }
if (defaultSource.local_path) {
return {
status: 'ok',
diff --git a/src/core/error-registry.ts b/src/core/error-registry.ts
index abdc64909b..eccbb9a3af 100644
--- a/src/core/error-registry.ts
+++ b/src/core/error-registry.ts
@@ -685,6 +685,10 @@ export const CODES = {
why: "Usually a dropped connection or a failed statement; the same error after a rerun is not transient. `reason: database_contention`: a write admission that deadlocks, serialization failures, lock timeouts or statement timeouts kept refusing for its whole retry budget; no receipt was confirmed, so the same request_id is safe to retry once the contention clears. `detail: persistence_mode_unknown` (#6482): the persistence_brain singleton is missing, duplicated or carries a non-boolean `enabled`, so gbrain cannot tell whether the brain is managed and refuses every write, sync, connector run and activation step that depends on it rather than route a managed brain through the unmanaged writer; only a well-formed `enabled: false` row selects the unmanaged path.",
suggestion: 'For persistence_mode_unknown: run gbrain sources writer status --probe --json on the brain host (it reports the malformed state instead of refusing), fix the persistence_brain row it names, then gbrain doctor --json.' },
strict_requires_managed: { class: 'consent', actor: 'user', summary: "A git-canonical source (config canonical: git) was written on a brain without managed persistence; nothing was written.", why: 'A strict source is committed to Git before the database indexes it, and only managed persistence (the writer coordinator) does that; the legacy writer of an unmanaged brain writes the database first.', docs: 'docs/designs/GIT_CANONICAL_MEMORY.md#the-model', suggestion: 'Ask the user whether to turn on managed persistence for this brain, or to remove canonical: git from the source.' },
+ sync_anchor_relative: { class: 'consent', exit: 3, actor: 'user', docs: 'docs/guides/troubleshooting.md#relative-source-path',
+ summary: "Sync refused: the source's stored directory (sources.local_path, or sync.repo_path) is a relative path such as \".\", which names whatever directory gbrain runs from.",
+ why: "A relative stored path cannot prove which folder is the brain. Before #7630 a sync run from an unrelated folder treated that folder as the brain repo: it Git-initialized it, committed everything in it and imported its markdown. gbrain now refuses before any Git probe or import, and nothing is changed.",
+ suggestion: 'Ask the user which directory holds the source, then gbrain sources set-path <id> <absolute-directory>; or clear the pointer with gbrain sources set-path <id> --clear.' },
sync_not_applicable: { class: 'caller', summary: "Sync does not apply to this source: its directory is not a Git checkout.", why: "Sync imports changes between Git commits. A gbrain-owned content directory (created by init) holds files gbrain manages itself and is not a Git repository, so there is nothing to sync; gbrain never initializes Git on its own.", reasons: ['content_directory'] },
// #6712 PR 1: the drain lease (src/core/persistence/sync-lease.ts).
sync_admission_restricted: { class: 'host_only', retryable: false, actor: 'user',
diff --git a/src/core/persistence/connector-path.ts b/src/core/persistence/connector-path.ts
index 4a8fba8104..50f40309a5 100644
--- a/src/core/persistence/connector-path.ts
+++ b/src/core/persistence/connector-path.ts
@@ -1,3 +1,4 @@
+import { isAbsolute } from 'node:path';
import type { BrainEngine } from '../engine.ts';
import { OperationError } from '../ops/contract.ts';
import { isConnectorSourceKind } from './connector-identity.ts';
@@ -12,27 +13,32 @@ import { readManagedMode } from './managed-mode.ts';
* is its canonical root), and so is a connector with a live persistence
* binding (its worktree still owns that root). On a managed brain the update
* is a coordinated write, rechecked under the source row lock.
+ *
+ * #7630: any source's RELATIVE `local_path` (a legacy ".") clears too. It
+ * names whatever directory gbrain runs from, never a checkout, and sync
+ * refuses it; clearing it was otherwise possible only with SQL.
*/
-export async function clearConnectorLocalPath(engine: BrainEngine, sourceId: string): Promise<{ prior: string | null }> {
+export async function clearConnectorLocalPath(engine: BrainEngine, sourceId: string): Promise<{ prior: string | null; connector: boolean }> {
return engine.transaction(async tx => {
const [source] = await tx.executeRaw<{ local_path: string | null; kind: string | null; incarnation: string }>(
"SELECT local_path, config->>'kind' AS kind, incarnation FROM sources WHERE id=$1 FOR UPDATE", [sourceId]);
if (!source) throw new OperationError('not_found', `Source "${sourceId}" not found.`, "Run 'gbrain sources list' to see registered sources.");
- if (!isConnectorSourceKind(source.kind)) {
- throw new OperationError('invalid_params', `--clear applies only to connector sources (google, github); "${sourceId}" is a filesystem source whose path is its canonical checkout.`,
+ const connector = isConnectorSourceKind(source.kind);
+ if (!connector && (source.local_path === null || isAbsolute(source.local_path))) {
+ throw new OperationError('invalid_params', `--clear applies only to connector sources (google, github) and to a relative local_path; "${sourceId}" is a filesystem source whose path is its canonical checkout.`,
`Point it at its checkout with gbrain sources set-path ${sourceId} <path>, or remove it with gbrain sources remove ${sourceId}.`);
}
const bound = await tx.executeRaw('SELECT 1 FROM persistence_source_bindings WHERE source_id=$1 AND source_incarnation=$2::uuid',
[sourceId, source.incarnation]);
if (bound.length) {
- throw new OperationError('writer_transfer_required', `Connector source "${sourceId}" has a canonical owner bound to its checkout, so its path cannot be cleared.`,
+ throw new OperationError('writer_transfer_required', `${connector ? 'Connector source' : 'Source'} "${sourceId}" has a canonical owner bound to its checkout, so its path cannot be cleared.`,
`Inspect the binding with gbrain sources writer status ${sourceId}.`);
}
- if (source.local_path === null) return { prior: null };
+ if (source.local_path === null) return { prior: null, connector };
const managed = await readManagedMode(tx);
const clear = () => tx.executeRaw('UPDATE sources SET local_path=NULL WHERE id=$1 AND incarnation=$2::uuid', [sourceId, source.incarnation]);
if (managed) await withCoordinatedWrite(tx, [sourceId], clear, await maintenanceAttribution(tx));
else await clear();
- return { prior: source.local_path };
+ return { prior: source.local_path, connector };
});
}
diff --git a/src/core/persistence/terminal-classify.ts b/src/core/persistence/terminal-classify.ts
index 68c24b3656..d629a5c398 100644
--- a/src/core/persistence/terminal-classify.ts
+++ b/src/core/persistence/terminal-classify.ts
@@ -338,8 +338,16 @@ function schemaMissingVerdict(input: TerminalInput, code: string, origin: string
why: `The write needed ${what}. Read-only: when doctor's schema_version reports the schema behind, run gbrain apply-migrations --yes as the database role that owns the gbrain tables and resubmit; when it is at head, its schema_missing_tables check names what is missing (gbrain repair missing-tables previews it).` } };
}
+/**
+ * #7630: a sync write (and a recorded sync fault, read as one) is stored as `submit_job`; its retry is the sync. Any other
+ * operation is a foreground write (`remember`, `put_page`, ...) that no sync replays: its caller resubmits it.
+ */
function faultAction(code: string, input: TerminalInput): Action {
const v = classifySyncFault({ code });
+ if (v.safe_actions[0] === 'retry' && input.operation !== 'submit_job') {
+ return inspect(input.source_id, `The ${input.operation} write ended ${code}; it was not part of a sync, so a sync does not retry it. `
+ + `Writer status names the step it stopped at and what held it, read-only. Once that clears, resubmit the same ${input.operation} with a new request_id.`);
+ }
if (v.safe_actions[0] === 'retry') return syncRetry(input.source_id, `The sync recorded ${code} (${v.class}); a rerun holds or retries it.`);
return inspect(input.source_id, `The write ended ${code}; writer status names what holds it, read-only.`, v.human_reason);
}
diff --git a/src/core/sync-anchor.ts b/src/core/sync-anchor.ts
index b60d1ea3ff..5dd5e42753 100644
--- a/src/core/sync-anchor.ts
+++ b/src/core/sync-anchor.ts
@@ -6,7 +6,7 @@ import { withCompanyBrainSource } from './company-brain/profile.ts';
*/
import { realpathSync } from 'fs';
import { syncDispatchRow } from './sync-dispatch-read.ts';
-import { resolve as pathResolve } from 'path';
+import { isAbsolute, resolve as pathResolve } from 'path';
import type { BrainEngine } from './engine.ts';
import type { SyncOpts } from '../commands/sync.ts';
import { ownsGlobalSyncAnchor, sameRepoDir } from './sync.ts';
@@ -78,6 +78,10 @@ export async function readSyncAnchor(
* commit runs `git add -A` at the git root (there's no file list yet to
* scope it to — collection happens after this point) — see the P2 review
* finding on `createSyncBaselineCommit`'s callers.
+ *
+ * #7630: a relative stored anchor (a legacy `local_path` of ".") proves
+ * nothing: it realpath-resolves against the process cwd, so it "equals"
+ * whatever directory the sync runs from. Only an absolute anchor can.
*/
export async function isAnchorOwnedSyncPath(
engine: BrainEngine,
@@ -87,7 +91,7 @@ export async function isAnchorOwnedSyncPath(
if (opts.srcSubpath) return false;
if (opts.sourceId && opts.sourceId !== 'default') return false;
const anchor = await readSyncAnchor(engine, opts.sourceId, 'repo_path');
- if (anchor === null) return false;
+ if (anchor === null || !isAbsolute(anchor)) return false;
try {
return realpathSync(anchor) === realpathSync(repoPath);
} catch {
diff --git a/src/core/sync-applicability.ts b/src/core/sync-applicability.ts
index 3f45cf7579..5804c28727 100644
--- a/src/core/sync-applicability.ts
+++ b/src/core/sync-applicability.ts
@@ -82,8 +82,41 @@ export function syncNotApplicableError(dir: SyncContentDirectory): OperationErro
});
}
+/**
+ * #7630: the `sync_anchor_relative` refusal. A stored anchor (`sources.local_path` or `sync.repo_path`) that is a
+ * relative path such as "." names whatever directory gbrain happens to run from, so it cannot say which folder is the
+ * brain: from an unrelated folder, sync would treat that folder as the brain repo (Git init, a baseline commit of
+ * everything in it, an import of its markdown). Refused before any Git probe, cost estimate or import.
+ */
+export function syncAnchorRelativeError(sourceId: string | undefined, anchor: string): OperationError {
+ const why = `A relative path names whatever directory gbrain runs from (now ${process.cwd()}), not a fixed folder, so it cannot prove which folder is the brain; syncing it from an unrelated folder would Git-initialize that folder, commit everything in it and import its markdown. Nothing was changed.`;
+ if (!sourceId) {
+ return opError('sync_anchor_relative', `Sync refused: sync.repo_path is the relative path "${anchor}".`,
+ 'Ask the user which directory holds the brain repo, then set it as an absolute path: gbrain config set sync.repo_path <absolute-directory>.',
+ { why, fix: { argv: ['gbrain', 'config', 'set', 'sync.repo_path', '<dir>'], consent: [], actor: 'user', ask_user: true, requires_exclusive: false,
+ inputs: [{ name: 'dir', how: 'The absolute path of the brain repo, from the user; never the current directory by default.' }],
+ user_message: `gbrain's brain repo setting (sync.repo_path) is the relative path "${anchor}", so sync cannot tell which folder is the brain. Which directory holds your brain repo?`,
+ why: 'Points sync.repo_path at an absolute directory; no file or page changes.', verify: { argv: ['gbrain', 'config', 'get', 'sync.repo_path'] } } });
+ }
+ return opError('sync_anchor_relative', `Sync refused: source "${sourceId}" has the relative local_path "${anchor}".`,
+ `Ask the user which directory holds this source's files and run gbrain sources set-path ${sourceId} <absolute-directory>, or clear the pointer with gbrain sources set-path ${sourceId} --clear.`,
+ { why, fix: { argv: ['gbrain', 'sources', 'set-path', sourceId, '--clear'], consent: [], actor: 'user', ask_user: true, requires_exclusive: false,
+ user_message: `Source "${sourceId}" has the relative path "${anchor}" as its directory, so sync cannot tell which folder it belongs to and refused. Clear the pointer (gbrain sources set-path ${sourceId} --clear), or tell me the absolute directory that holds its files (gbrain sources set-path ${sourceId} <absolute-directory>).`,
+ why: 'Clears only the relative pointer: no file or page changes. Sync of this source then refuses until gbrain sources set-path names an absolute directory.',
+ verify: { argv: ['gbrain', 'sources', 'status', sourceId, '--json'] } } });
+}
+
+/** #7630: refuse a sync whose root would be a relative stored anchor (an explicit absolute or different `repoPath` passes). */
+export async function assertSyncAnchorAbsolute(engine: BrainEngine, opts: { sourceId?: string; repoPath?: string }): Promise<void> {
+ if (opts.repoPath && isAbsolute(opts.repoPath)) return;
+ const anchor = await readSyncAnchor(engine, opts.sourceId, 'repo_path');
+ if (!anchor || isAbsolute(anchor) || (opts.repoPath && opts.repoPath !== anchor)) return;
+ throw syncAnchorRelativeError(opts.sourceId, anchor);
+}
+
/** Refuse a sync whose root is a gbrain-owned content directory (no-op when sync applies). */
export async function assertSyncApplicable(engine: BrainEngine, opts: { sourceId?: string; repoPath?: string }): Promise<void> {
+ await assertSyncAnchorAbsolute(engine, opts);
const dir = await syncContentDirectory(engine, opts);
if (dir) throw syncNotApplicableError(dir);
}
diff --git a/test/e2e/sync-relative-anchor-refusal-7630-postgres.test.ts b/test/e2e/sync-relative-anchor-refusal-7630-postgres.test.ts
new file mode 100644
index 0000000000..7828ca9fdc
--- /dev/null
+++ b/test/e2e/sync-relative-anchor-refusal-7630-postgres.test.ts
@@ -0,0 +1,3 @@
+import { registerPostgresTests } from '../helpers/test-backends.ts';
+
+await registerPostgresTests(() => import('../sync-relative-anchor-refusal-7630.test.ts'));
diff --git a/test/sync-relative-anchor-refusal-7630.test.ts b/test/sync-relative-anchor-refusal-7630.test.ts
new file mode 100644
index 0000000000..ba5062b1ef
--- /dev/null
+++ b/test/sync-relative-anchor-refusal-7630.test.ts
@@ -0,0 +1,140 @@
+/**
+ * #7630: a relative stored sync anchor (a legacy `sources.local_path` of ".") must never make sync treat the directory
+ * it runs from as the brain.
+ *
+ * Before the fix, `gbrain sync --source default` (or `--all`) run from an unrelated folder resolved "." to that folder,
+ * `isAnchorOwnedSyncPath` compared realpath(".") with realpath(cwd) (always equal), and preflight Git-initialized the
+ * folder, committed everything in it as a baseline and imported its markdown. A foreground write that ended
+ * `preparation_stalled` meanwhile got a receipt telling the user to run exactly that sync.
+ *
+ * Protects:
+ * - sync refuses `sync_anchor_relative` (exit 3, a fix naming `gbrain sources set-path <id> --clear`) for a relative
+ * `local_path` reached by `--source` (the anchor read) or by `--all` (the row's path passed through), and for a relative
+ * legacy `sync.repo_path`; the folder gets no `.git` and nothing is imported;
+ * - a relative anchor never proves ownership, so even an explicit absolute path to the cwd is not auto-initialized;
+ * - `gbrain sources set-path <id> --clear` clears a relative filesystem path without SQL, and still refuses an absolute one;
+ * - doctor's `default_source_local_path` warns on a relative path;
+ * - a stalled foreground write's diagnosis inspects the writer and says to resubmit with a new request_id, while a
+ * recorded sync fault keeps its sync retry.
+ *
+ * PGLite always; Postgres when DATABASE_URL is set (test/e2e/sync-relative-anchor-refusal-7630-postgres.test.ts).
+ */
+import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
+import { existsSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import type { BrainEngine } from '../src/core/engine.ts';
+import { isAnchorOwnedSyncPath } from '../src/core/sync-anchor.ts';
+import { clearConnectorLocalPath } from '../src/core/persistence/connector-path.ts';
+import { defaultSourceLocalPathCheck } from '../src/commands/doctor/checks/default-source-path.ts';
+import { classifyRecordedFault, classifyTerminal } from '../src/core/persistence/terminal-classify.ts';
+import { renderAction } from '../src/core/agent-output.ts';
+import { isolatedSharedSkillsEngine } from './helpers/shared-skills-engine.ts';
+import { requirePostgresTestDatabase, testBackends } from './helpers/test-backends.ts';
+import { withEnv } from './helpers/with-env.ts';
+
+const SYNC = { noPull: true, noEmbed: true, noExtract: true, full: true };
+
+for (const backend of testBackends()) {
+ const databaseUrl = backend === 'postgres' ? requirePostgresTestDatabase() : undefined;
+
+ describe(`#7630 [${backend}]: a relative stored anchor never makes the cwd the brain`, () => {
+ let engine: BrainEngine, close: () => Promise<void>, home: string, folder: string, previousCwd: string;
+
+ beforeEach(async () => {
+ home = mkdtempSync(join(tmpdir(), 'gbrain-7630-home-'));
+ folder = realpathSync(mkdtempSync(join(tmpdir(), 'gbrain-7630-unrelated-')));
+ writeFileSync(join(folder, 'notes.md'), '---\ntype: note\ntitle: Notes\n---\n\nA note that is not part of any brain.\n');
+ writeFileSync(join(folder, 'private.txt'), 'not for any brain\n');
+ ({ engine, close } = await isolatedSharedSkillsEngine(databaseUrl));
+ previousCwd = process.cwd();
+ process.chdir(folder);
+ }, 120_000);
+
+ afterEach(async () => {
+ process.chdir(previousCwd);
+ await close();
+ rmSync(folder, { recursive: true, force: true });
+ rmSync(home, { recursive: true, force: true });
+ });
+
+ const pageCount = async () => (await engine.executeRaw<{ n: number }>('SELECT count(*)::int AS n FROM pages'))[0]!.n;
+ const sync = async (opts: Record<string, unknown>) => withEnv({ GBRAIN_HOME: home }, async () => {
+ const { performSync } = await import('../src/commands/sync.ts');
+ return performSync(engine, { ...SYNC, ...opts }).then(() => null, (error: unknown) => error as { code?: string; fix?: { argv?: string[]; ask_user?: boolean } });
+ });
+
+ test('--source default with local_path "." refuses sync_anchor_relative: no .git, no commit, no import', async () => {
+ await engine.executeRaw("UPDATE sources SET local_path='.' WHERE id='default'");
+ const before = await pageCount();
+ const refused = await sync({ sourceId: 'default' });
+ expect(refused?.code).toBe('sync_anchor_relative');
+ expect(refused?.fix?.argv).toEqual(['gbrain', 'sources', 'set-path', 'default', '--clear']);
+ expect(refused?.fix?.ask_user).toBe(true);
+ expect(existsSync(join(folder, '.git'))).toBe(false);
+ expect(await pageCount()).toBe(before);
+ }, 120_000);
+
+ test('--all passes the row\'s "." through as repoPath: refused the same way', async () => {
+ await engine.executeRaw("UPDATE sources SET local_path='.' WHERE id='default'");
+ const refused = await sync({ sourceId: 'default', repoPath: '.' });
+ expect(refused?.code).toBe('sync_anchor_relative');
+ expect(existsSync(join(folder, '.git'))).toBe(false);
+ }, 120_000);
+
+ test('a relative legacy sync.repo_path refuses with the config fix', async () => {
+ await engine.setConfig('sync.repo_path', '.');
+ const refused = await sync({});
+ expect(refused?.code).toBe('sync_anchor_relative');
+ expect(refused?.fix?.argv).toEqual(['gbrain', 'config', 'set', 'sync.repo_path', '<dir>']);
+ expect(existsSync(join(folder, '.git'))).toBe(false);
+ }, 120_000);
+
+ test('a relative anchor proves no ownership: an explicit absolute path to the cwd is not auto-initialized', async () => {
+ await engine.executeRaw("UPDATE sources SET local_path='.' WHERE id='default'");
+ expect(await isAnchorOwnedSyncPath(engine, { sourceId: 'default' } as never, folder)).toBe(false);
+ const failed = await sync({ sourceId: 'default', repoPath: folder });
+ expect(failed).not.toBeNull();
+ expect(existsSync(join(folder, '.git'))).toBe(false);
+ await engine.executeRaw("UPDATE sources SET local_path=$1 WHERE id='default'", [folder]);
+ expect(await isAnchorOwnedSyncPath(engine, { sourceId: 'default' } as never, folder)).toBe(true);
+ }, 120_000);
+
+ test('sources set-path --clear clears a relative filesystem path without SQL; an absolute one stays refused', async () => {
+ await engine.executeRaw("UPDATE sources SET local_path='.' WHERE id='default'");
+ expect(await clearConnectorLocalPath(engine, 'default')).toEqual({ prior: '.', connector: false });
+ expect((await engine.executeRaw<{ local_path: string | null }>("SELECT local_path FROM sources WHERE id='default'"))[0]!.local_path).toBeNull();
+ await engine.executeRaw("UPDATE sources SET local_path=$1 WHERE id='default'", [folder]);
+ expect((await clearConnectorLocalPath(engine, 'default').catch(error => error)).code).toBe('invalid_params');
+ expect((await engine.executeRaw<{ local_path: string | null }>("SELECT local_path FROM sources WHERE id='default'"))[0]!.local_path).toBe(folder);
+ }, 120_000);
+
+ test('doctor default_source_local_path warns on a relative path and names the fix', async () => {
+ await engine.executeRaw("UPDATE sources SET local_path='.' WHERE id='default'");
+ const check = await defaultSourceLocalPathCheck(engine);
+ expect(check?.status).toBe('warn');
+ expect(check?.message).toContain('gbrain sources set-path default --clear');
+ }, 120_000);
+ });
+}
+
+describe('#7630: a stalled write\'s diagnosis matches its operation', () => {
+ const receipt = (operation: string) => classifyTerminal({ request_id: '11111111-2222-4333-8444-555555555555', source_id: 'default', slug: 'notes/example',
+ operation, state: 'failed', error_code: 'preparation_stalled', error_detail: null, recovery: null, blocked_reason: null, compacted: false, intent_kind: null })!;
+ const mcp = { transport: 'stdio' as const, isCallable: () => false, preapproved: () => false };
+
+ for (const operation of ['remember', 'put_page']) {
+ test(`a foreground ${operation} that ended preparation_stalled inspects the writer and resubmits, never a sync`, () => {
+ const verdict = receipt(operation);
+ expect(verdict.action.argv).toEqual(['gbrain', 'sources', 'writer', 'status', '--source', 'default', '--json']);
+ expect(verdict.action.why).toContain('new request_id');
+ const rendered = renderAction(verdict.action, mcp);
+ expect(rendered.command).not.toContain('gbrain sync');
+ });
+ }
+
+ test('a recorded sync fault and a sync page receipt keep the sync retry', () => {
+ expect(classifyRecordedFault({ source_id: 'default', code: 'preparation_stalled' }).action.argv?.slice(0, 2)).toEqual(['gbrain', 'sync']);
+ expect(receipt('submit_job').action.argv?.slice(0, 2)).toEqual(['gbrain', 'sync']);
+ });
+});