Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(wave18b): gate fixes: sync_freshness stubs answer the adopted-pack query, the one-shot sender backfill leaves walk-covered threads to the walk, Postgres hot-check golden carries the #4960 outcome

garrytan78a45f11b47a
diff --git a/src/core/cli-flag-registry.generated.ts b/src/core/cli-flag-registry.generated.ts
index 6c8d0006fa..82d12fe860 100644
--- a/src/core/cli-flag-registry.generated.ts
+++ b/src/core/cli-flag-registry.generated.ts
@@ -47,7 +47,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'creds': ['--allow-create-db', '--allow-docker', '--brain', '--chat-model', '--content-root', '--db-only', '--embedding-dimensions', '--embedding-model', '--expansion-model', '--force', '--git', '--grant-types', '--help', '--http', '--ids', '--issuer-url', '--json', '--key', '--local-postgres', '--mcp-only', '--mcp-url', '--migrate-only', '--model', '--no-embedding', '--no-git', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--out', '--passphrase-env', '--path', '--pglite', '--plan', '--prefer-postgres', '--provenance', '--provider', '--query', '--schema-pack', '--scopes', '--search-mode', '--skip-embed-check', '--source', '--status', '--supabase', '--surface', '--to', '--url', '--version'],
'db-repair': ['--accept-pending', '--apply', '--apply-rewrites', '--background', '--brain', '--break-lock', '--db-url', '--dry-run', '--explain', '--filter', '--follow', '--force', '--force-retry', '--format', '--help', '--http', '--json', '--locks', '--name', '--no-accept-pending', '--path', '--prefer-postgres', '--probe', '--progress-interval', '--progress-json', '--quiet', '--remediate', '--restart', '--skip-verify', '--source', '--supabase', '--timeout', '--undo-last-rewrite', '--url', '--version', '--wait', '--yes'],
'decide': ['--accept-all', '--all', '--all-from', '--apply', '--brain', '--call-site', '--dataset', '--dry-run', '--egress', '--embedding-dimensions', '--embedding-model', '--expect', '--from', '--help', '--include-withdrawals', '--input', '--items-out', '--json', '--kind', '--limit', '--max-cost', '--max-usd', '--min', '--non-interactive', '--out', '--provenance', '--provider', '--query', '--rate', '--reason', '--reason-family', '--recommended', '--remove', '--shadow', '--since', '--slot', '--source', '--status', '--suite', '--target', '--threshold', '--trust', '--undo', '--uri-prefix', '--version', '--what-if-threshold', '--yes'],
- 'doctor': ['--abandon', '--abbrev-ref', '--accept-pending', '--access', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt', '--adopt-columns', '--adopt-permissions', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-shell-jobs', '--allow-unverified-remote', '--allowed-operations', '--apply', '--apply-rewrites', '--assign-corpus', '--audit', '--auto', '--auto-fix', '--autostash', '--background', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-usd', '--by-mention', '--cached', '--call-site', '--catch-up', '--check', '--class', '--client', '--concurrency', '--confidence', '--confirm', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--contacts-dir', '--content-audit', '--content-root', '--count', '--dataset', '--db-url', '--delegated-namespace', '--delegated-slug-prefixes', '--delete-brain', '--dest', '--detach', '--diff-filter', '--dim', '--dir', '--disable', '--drain', '--drain-timeout', '--dry-run', '--egress', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--env', '--error-unmatch', '--exclude', '--exclude-standard', '--expand', '--expect', '--expect-remote', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--federated-read', '--fetch-timeout-ms', '--ff-only', '--file', '--fix', '--follow', '--force', '--force-rechunk', '--force-retry', '--force-schema', '--format', '--fresh', '--from', '--from-meetings', '--from-pages', '--full', '--fuzzy', '--get', '--git-common-dir', '--git-dir', '--git-path', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--held', '--help', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--images', '--include-ambiguous', '--include-deleted', '--include-failures', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-pseudo', '--include-repairs', '--include-withdrawals', '--index-audit', '--init', '--input', '--install', '--is-ancestor', '--is-inside-work-tree', '--items-out', '--job-isolation', '--jq', '--json', '--keep', '--lanes', '--lang', '--left-right', '--limit', '--link-source', '--link-type', '--list', '--local', '--local-env-vars', '--locks', '--log-noop', '--manifest', '--markdown', '--max-cost', '--max-cost-usd', '--max-jobs', '--max-rss', '--max-runtime', '--max-usd', '--max-waiting', '--mcp-only', '--migrate-legacy', '--migrate-only', '--migration', '--min', '--mode', '--multimodal', '--name', '--name-only', '--nice', '--no-accept-pending', '--no-autopilot-install', '--no-autostash', '--no-capture', '--no-confirm', '--no-cron', '--no-delegate', '--no-edit', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-hooks', '--no-lanes', '--no-llm', '--no-migrate', '--no-pull', '--no-renames', '--no-repair', '--no-schema-pack', '--no-seat', '--no-tags', '--no-verify', '--non-interactive', '--now', '--older-than', '--once', '--only', '--operations', '--others', '--out', '--output', '--oversized', '--overwrite', '--page', '--parallel', '--params', '--pat-file', '--path', '--path-format', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--port', '--prefer', '--prefer-postgres', '--preset', '--preview', '--probe', '--probe-pglite', '--profile', '--progress-interval', '--progress-json', '--project', '--provider', '--providers', '--prune-orphans', '--public-url', '--pull', '--pure', '--purge', '--push-only', '--query', '--question', '--queue', '--quiet', '--rate', '--reauth', '--rebase', '--recommended', '--reference-date', '--refresh', '--refresh-operations', '--refresh-skills', '--regenerate', '--reissue', '--relative', '--relower', '--remediate', '--remediation-plan', '--remove', '--remove-core', '--repair', '--replace', '--repo', '--request', '--request-id', '--require-clean', '--reranker', '--reset', '--reset-checkpoint', '--reset-default', '--resolve', '--restore-only', '--resume', '--retry-failed', '--reverse', '--review-lower', '--revision', '--rollback-to-source', '--scope', '--scopes', '--search-mode', '--seat', '--section', '--select', '--self-transfer', '--session', '--set', '--set-upstream-to', '--shadow', '--short', '--show-current', '--show-prefix', '--show-token', '--show-toplevel', '--since', '--skills-dir', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--skip-verify', '--slot', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--staged', '--stale', '--state', '--status', '--stdin', '--strategy', '--strict', '--suite', '--supabase', '--surface', '--symbol-kind', '--symbolic-full-name', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--to', '--token', '--token-ttl', '--top-k', '--trust', '--type', '--uninstall', '--unsafe-bypass-dream-guard', '--unset-all', '--untracked-files', '--url', '--url-env', '--user', '--vectors', '--verbose', '--verify', '--version', '--wait', '--wait-drain', '--warn-only', '--what-if-threshold', '--window', '--workers', '--working-tree', '--workspace', '--yes'],
+ 'doctor': ['--abandon', '--abbrev-ref', '--accept-pending', '--access', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt', '--adopt-columns', '--adopt-permissions', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-shell-jobs', '--allow-unverified-remote', '--allowed-operations', '--apply', '--apply-rewrites', '--assign-corpus', '--audit', '--auto', '--auto-fix', '--autostash', '--background', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-usd', '--by-mention', '--cached', '--call-site', '--catch-up', '--check', '--class', '--client', '--concurrency', '--confidence', '--confirm', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--contacts-dir', '--content-audit', '--content-root', '--count', '--dataset', '--db-url', '--delegated-namespace', '--delegated-slug-prefixes', '--delete-brain', '--dest', '--detach', '--diff-filter', '--dim', '--dir', '--disable', '--drain', '--drain-timeout', '--dry-run', '--egress', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--env', '--error-unmatch', '--exclude', '--exclude-standard', '--expand', '--expect', '--expect-remote', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--federated-read', '--fetch-timeout-ms', '--ff-only', '--file', '--fix', '--follow', '--force', '--force-rechunk', '--force-retry', '--force-schema', '--format', '--fresh', '--from', '--from-meetings', '--from-pages', '--full', '--fuzzy', '--get', '--git-common-dir', '--git-dir', '--git-path', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--held', '--help', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--images', '--include-ambiguous', '--include-deleted', '--include-failures', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-pseudo', '--include-repairs', '--include-withdrawals', '--index-audit', '--init', '--input', '--install', '--is-ancestor', '--is-inside-work-tree', '--items-out', '--job-isolation', '--jq', '--json', '--keep', '--lanes', '--lang', '--left-right', '--limit', '--link-source', '--link-type', '--list', '--local', '--local-env-vars', '--locks', '--log-noop', '--manifest', '--markdown', '--max-cost', '--max-cost-usd', '--max-jobs', '--max-rss', '--max-runtime', '--max-usd', '--max-waiting', '--mcp-only', '--migrate-legacy', '--migrate-only', '--migration', '--min', '--mode', '--multimodal', '--name', '--name-only', '--nice', '--no-accept-pending', '--no-autopilot-install', '--no-autostash', '--no-capture', '--no-confirm', '--no-cron', '--no-delegate', '--no-edit', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-hooks', '--no-lanes', '--no-llm', '--no-migrate', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-schema-pack', '--no-seat', '--no-tags', '--no-verify', '--non-interactive', '--now', '--older-than', '--once', '--only', '--operations', '--others', '--out', '--output', '--oversized', '--overwrite', '--page', '--parallel', '--params', '--pat-file', '--path', '--path-format', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--port', '--prefer', '--prefer-postgres', '--preset', '--preview', '--probe', '--probe-pglite', '--profile', '--progress-interval', '--progress-json', '--project', '--provider', '--providers', '--prune-orphans', '--public-url', '--pull', '--pure', '--purge', '--push-only', '--query', '--question', '--queue', '--quiet', '--rate', '--reauth', '--rebase', '--recommended', '--reference-date', '--refresh', '--refresh-operations', '--refresh-skills', '--regenerate', '--reissue', '--relative', '--relower', '--remediate', '--remediation-plan', '--remove', '--remove-core', '--repair', '--repair-unknown-markers', '--replace', '--repo', '--request', '--request-id', '--require-clean', '--reranker', '--reset', '--reset-checkpoint', '--reset-default', '--resolve', '--restore-only', '--resume', '--retry-failed', '--reverse', '--review-lower', '--revision', '--rollback-to-source', '--scope', '--scopes', '--search-mode', '--seat', '--section', '--select', '--self-transfer', '--semantic', '--session', '--set', '--set-upstream-to', '--shadow', '--short', '--show-current', '--show-prefix', '--show-token', '--show-toplevel', '--since', '--skills-dir', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--skip-verify', '--slot', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--staged', '--stale', '--state', '--status', '--stdin', '--strategy', '--strict', '--suite', '--supabase', '--surface', '--symbol-kind', '--symbolic-full-name', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--to', '--token', '--token-ttl', '--top-k', '--trust', '--type', '--uninstall', '--unsafe-bypass-dream-guard', '--unset-all', '--untracked-files', '--url', '--url-env', '--user', '--vectors', '--verbose', '--verify', '--version', '--wait', '--wait-drain', '--warn-only', '--what-if-threshold', '--window', '--workers', '--working-tree', '--workspace', '--yes'],
'dream': ['--audit-rejects', '--brain', '--cancel-unmatched', '--date', '--dir', '--drain', '--dry-run', '--eval-run', '--force', '--from', '--help', '--input', '--install', '--json', '--limit', '--list', '--max-usd', '--once', '--path', '--phase', '--pull', '--reconcile-queue', '--since', '--source', '--source-id', '--threshold', '--to', '--unsafe-bypass-dream-guard', '--window', '--yes'],
'edge-proposals': ['--access', '--add', '--all-applied', '--all-held', '--allowed-operations', '--asof', '--bound-slug-prefixes', '--brain', '--client', '--date', '--dated-since', '--days', '--entities', '--federated-read', '--from-index', '--full', '--fuzzy', '--help', '--http', '--id', '--include-deleted', '--json', '--kind', '--limit', '--max-usd', '--model', '--multimodal', '--no-autopilot-install', '--page', '--params', '--path', '--phase', '--purge', '--recent', '--refresh-operations', '--row', '--scopes', '--session', '--since', '--slugs', '--source', '--sources', '--stale', '--status', '--surface', '--to', '--updated-after', '--url', '--yes'],
'edges-backfill': ['--all-sources', '--brain', '--concurrency', '--help', '--json', '--max-chunks', '--source', '--workers'],
@@ -73,7 +73,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'graph-query': ['--brain', '--depth', '--direction', '--help', '--hop', '--include-foreign', '--json', '--mcp-only', '--source', '--type'],
'hook': ['--allow-unverified-remote', '--auto', '--brain', '--branch', '--cached', '--count', '--diff-filter', '--enable', '--end-of-options', '--env', '--get', '--harness', '--help', '--jq', '--json', '--limit', '--name-only', '--others', '--pat-file', '--path', '--porcelain', '--pure', '--quiet', '--remove', '--seat', '--session', '--show-current', '--show-toplevel', '--since', '--source', '--yes'],
'import': ['--accept-pending', '--admin-intent', '--allow-empty', '--allow-noncanonical-root', '--apply', '--background', '--brain', '--cached', '--confirm-relocated-root', '--diff-filter', '--dim', '--embedding-dimensions', '--embedding-model', '--empty', '--exclude', '--exclude-standard', '--expected-epoch', '--expected-state', '--explain', '--follow', '--force', '--force-rechunk', '--format', '--fresh', '--help', '--include-gitignored', '--is-shallow-repository', '--json', '--log-noop', '--manifest', '--name-only', '--no-accept-pending', '--no-embed', '--no-embedding', '--no-gpg-sign', '--no-pull', '--no-renames', '--no-verify', '--only', '--others', '--path', '--probe', '--progress-interval', '--progress-json', '--quiet', '--self-transfer', '--show-toplevel', '--skip-failed', '--slugs', '--source', '--source-id', '--stale', '--status', '--supabase', '--timeout', '--to', '--url', '--verify', '--wait', '--workers'],
- 'init': ['--access', '--acknowledge-managed', '--adopt', '--all', '--allow-create-db', '--allow-docker', '--apply', '--assign-corpus', '--audit', '--auto', '--background', '--bound-slug-prefixes', '--brain', '--break-lock', '--budget-ms', '--budget-usd', '--chat-model', '--check', '--confirm-relocated-root', '--conflicts', '--content-root', '--db-only', '--dest', '--detach', '--dim', '--disable', '--drain', '--embedding-dimensions', '--embedding-model', '--enable', '--expand', '--expansion-model', '--expect', '--expect-remote', '--facts', '--fast', '--fix', '--force', '--force-retry', '--from-meetings', '--full', '--git', '--grant-types', '--group-by', '--harness', '--held', '--help', '--http', '--id', '--images', '--include-frontmatter', '--include-gitignored', '--issuer-url', '--json', '--keep', '--key', '--lanes', '--limit', '--list', '--local-postgres', '--markdown', '--max-usd', '--mcp-only', '--mcp-url', '--migrate-only', '--migration', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-git', '--no-llm', '--no-pull', '--no-repair', '--no-schema-pack', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--once', '--only', '--oversized', '--page', '--params', '--pat-file', '--path', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--preview', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--query', '--question', '--quiet', '--rebase', '--reference-date', '--remediate', '--remove', '--reset', '--resolve', '--resume', '--retry-failed', '--save', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--self-transfer', '--show-toplevel', '--skip', '--skip-embed-check', '--skip-failed', '--slugs', '--source', '--source-id', '--stale', '--state', '--status', '--supabase', '--surface', '--tier', '--to', '--touchpoint', '--url', '--url-env', '--user', '--version', '--wait', '--warn-only', '--workspace', '--yes'],
+ 'init': ['--access', '--acknowledge-managed', '--adopt', '--all', '--allow-create-db', '--allow-docker', '--apply', '--assign-corpus', '--audit', '--auto', '--background', '--bound-slug-prefixes', '--brain', '--break-lock', '--budget-ms', '--budget-usd', '--chat-model', '--check', '--confirm-relocated-root', '--conflicts', '--content-root', '--db-only', '--dest', '--detach', '--dim', '--disable', '--drain', '--embedding-dimensions', '--embedding-model', '--enable', '--expand', '--expansion-model', '--expect', '--expect-remote', '--facts', '--fast', '--fix', '--force', '--force-retry', '--from-meetings', '--full', '--git', '--grant-types', '--group-by', '--harness', '--held', '--help', '--http', '--id', '--images', '--include-frontmatter', '--include-gitignored', '--issuer-url', '--json', '--keep', '--key', '--lanes', '--limit', '--list', '--local-postgres', '--markdown', '--max-usd', '--mcp-only', '--mcp-url', '--migrate-only', '--migration', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-git', '--no-llm', '--no-probe', '--no-pull', '--no-repair', '--no-schema-pack', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--once', '--only', '--oversized', '--page', '--params', '--pat-file', '--path', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--preview', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--query', '--question', '--quiet', '--rebase', '--reference-date', '--remediate', '--remove', '--repair-unknown-markers', '--reset', '--resolve', '--resume', '--retry-failed', '--save', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--self-transfer', '--semantic', '--show-toplevel', '--skip', '--skip-embed-check', '--skip-failed', '--slug', '--slugs', '--source', '--source-id', '--stale', '--state', '--status', '--supabase', '--surface', '--tier', '--to', '--token', '--touchpoint', '--url', '--url-env', '--user', '--version', '--wait', '--warn-only', '--workspace', '--yes'],
'integrations': ['--auto', '--brain', '--dry-run', '--help', '--json', '--overwrite', '--refresh', '--source', '--target'],
'integrity': ['--accept-pending', '--auto', '--backend', '--background', '--brain', '--confidence', '--cost', '--dry-run', '--explain', '--follow', '--fresh', '--help', '--json', '--limit', '--no-accept-pending', '--probe', '--progress-interval', '--progress-json', '--quiet', '--review-lower', '--skip-bare-tweet', '--skip-urls', '--source', '--supabase', '--timeout', '--type', '--url', '--wait'],
'jobs': ['--abbrev-ref', '--access', '--acknowledge-managed', '--add', '--admin-intent', '--aliases', '--all', '--allow-empty', '--allow-shell-jobs', '--allowed-operations', '--apply', '--asof', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--batch-size', '--bound-slug-prefixes', '--brain', '--break-lock', '--by-mention', '--cached', '--catch-up', '--check', '--cli-path', '--client', '--cluster-errors', '--concurrency', '--confidence', '--confirm-destructive', '--confirm-quiesced', '--cost-estimate', '--date', '--dated-since', '--days', '--delay', '--detach', '--diff-filter', '--dir', '--drain', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--entities', '--exclude', '--exclude-standard', '--expect', '--expected-state', '--explain', '--facts', '--federated-read', '--filters', '--fix', '--follow', '--force', '--force-break-lock', '--format', '--fresh', '--from-index', '--from-meetings', '--full', '--full-history', '--fuzzy', '--grammar-diagnostics', '--group', '--hard-deadline', '--health-interval', '--held', '--help', '--http', '--id', '--idempotency-key', '--ids', '--images', '--include-deleted', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-null-signature', '--infer-dates', '--inject-bootstrap', '--inline', '--input', '--install', '--interval', '--is-ancestor', '--is-shallow-repository', '--job-id', '--job-isolation', '--json', '--kind', '--lanes', '--limit', '--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', '--mcp-only', '--min-context', '--missing-path', '--model', '--multimodal', '--name-only', '--ner', '--nice', '--no-auto-embed', '--no-autopilot-install', '--no-bulk', '--no-confirm', '--no-delegate', '--no-embed', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-lanes', '--no-llm', '--no-pull', '--no-renames', '--no-repair', '--no-schema-pack', '--no-verify', '--no-worker', '--non-interactive', '--now', '--older-than', '--once', '--only', '--order', '--others', '--output', '--override-disabled', '--oversized', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--path', '--pause', '--phase', '--pid-file', '--priority', '--probe', '--prune-orphans', '--purge', '--queue', '--queue-only', '--quiet', '--reason', '--rebuild', '--recent', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--refresh-operations', '--replace', '--repo', '--reset-checkpoint', '--resume', '--retry-failed', '--retry-held', '--review-lower', '--row', '--scopes', '--segment-limit', '--select', '--serial', '--session', '--show-toplevel', '--sigkill-rescue', '--since', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--stale', '--status', '--strategy', '--surface', '--swap-only', '--target', '--thin', '--thin-threshold', '--timeout', '--timeout-ms', '--to', '--trust', '--type', '--types', '--uninstall', '--updated-after', '--url', '--user', '--vectors', '--verbose', '--verify', '--version', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],
diff --git a/src/core/google/google-source.ts b/src/core/google/google-source.ts
index 240cdf5cce..4989bba2f9 100644
--- a/src/core/google/google-source.ts
+++ b/src/core/google/google-source.ts
@@ -415,7 +415,7 @@ async function sweepGmail(g: GmailSweep, onCurrent?: () => Promise<void>): Promi
if (deps.opts.signal?.aborted) return false;
await attemptThread(g, tid, null);
}
- if (await settleGraceHolds(g) === 'aborted') return false;
+ if (await settleGraceHolds(g, cutoffMs) === 'aborted') return false;
const isCurrent = (): boolean => {
if (delta !== 'done' || state.gmail_gap_floor_ms != null) return false;
if (state.gmail_backfill_done) return true;
@@ -445,7 +445,7 @@ async function sweepGmail(g: GmailSweep, onCurrent?: () => Promise<void>): Promi
* A re-fetch goes straight through processThread (never the item holds), so
* a failed grace re-fetch keeps the grace hold and is not an item failure.
*/
-async function settleGraceHolds(g: GmailSweep): Promise<'aborted' | void> {
+async function settleGraceHolds(g: GmailSweep, cutoffMs: number): Promise<'aborted' | void> {
const { deps, state } = g;
try {
await seedGraceBackfill(deps.engine, deps.sourceId, state, deps.log);
@@ -454,7 +454,7 @@ async function settleGraceHolds(g: GmailSweep): Promise<'aborted' | void> {
deps.log(`[google] loop grace backfill failed (retried next sweep): ${e instanceof Error ? e.message : String(e)}`);
}
try {
- await seedLoopRechecks(deps.engine, deps.sourceId, state, deps.log);
+ await seedLoopRechecks(deps.engine, deps.sourceId, state, deps.log, Date.now(), state.gmail_backfill_done ? null : cutoffMs);
} catch (e) {
deps.log(`[google] loop re-check seeding failed (retried next sweep): ${e instanceof Error ? e.message : String(e)}`);
}
diff --git a/src/core/google/loop-catchup.ts b/src/core/google/loop-catchup.ts
index 4d4310ce7d..716b390f69 100644
--- a/src/core/google/loop-catchup.ts
+++ b/src/core/google/loop-catchup.ts
@@ -106,9 +106,12 @@ export async function seedGraceBackfill(engine: BrainEngine, sourceId: string, s
* with no spec). Every sweep: threads with loops an unmute queued for
* re-check. Once: the newest thread of each of the WITHHELD_BACKFILL_SENDERS
* senders with the most open reply-owed loops, so the withheld-senders record
- * covers loops opened before the automated-mail rule existed.
+ * covers loops opened before the automated-mail rule existed. `walkFromMs` is
+ * the lower bound of an unfinished backfill walk: that walk runs after the
+ * grace settle and fetches threads active since then itself, so they are not
+ * queued twice.
*/
-export async function seedLoopRechecks(engine: BrainEngine, sourceId: string, state: GoogleSourceState, log: Log, now = Date.now()): Promise<number> {
+export async function seedLoopRechecks(engine: BrainEngine, sourceId: string, state: GoogleSourceState, log: Log, now = Date.now(), walkFromMs: number | null = null): Promise<number> {
const holds = state.loop_grace_holds ??= {};
const seed = (rows: Array<{ thread_id: string; page_slug: string | null }>) => rows.reduce((n, r) => {
if (holds[r.thread_id]) return n;
@@ -119,15 +122,16 @@ export async function seedLoopRechecks(engine: BrainEngine, sourceId: string, st
let backfill = 0;
if (!state.loop_automated_backfill_done) {
backfill = seed(await engine.executeRaw<{ thread_id: string; page_slug: string | null }>(
- `SELECT DISTINCT ON (counterparty_email) thread_id, page_slug, n FROM (
+ `SELECT DISTINCT ON (counterparty_email) thread_id, page_slug, n, last_activity_at FROM (
SELECT counterparty_email, thread_id, page_slug, last_activity_at,
count(*) OVER (PARTITION BY counterparty_email) AS n
FROM open_loops
WHERE source_id = $1 AND status = 'open' AND loop_type = 'unanswered_inbound'
AND counterparty_email IS NOT NULL AND thread_id IS NOT NULL) l
ORDER BY counterparty_email, last_activity_at DESC`, [sourceId])
- .then((rows) => (rows as Array<{ thread_id: string; page_slug: string | null; n: number }>)
- .sort((a, b) => Number(b.n) - Number(a.n)).slice(0, WITHHELD_BACKFILL_SENDERS)));
+ .then((rows) => (rows as Array<{ thread_id: string; page_slug: string | null; n: number; last_activity_at: Date | string | null }>)
+ .sort((a, b) => Number(b.n) - Number(a.n)).slice(0, WITHHELD_BACKFILL_SENDERS)
+ .filter((r) => walkFromMs == null || r.last_activity_at == null || new Date(r.last_activity_at).getTime() < walkFromMs + DAY_MS)));
state.loop_automated_backfill_done = true;
}
pruneGraceHolds(holds, log);
diff --git a/test/doctor.test.ts b/test/doctor.test.ts
index 9a330d9a52..b73ee61e5b 100644
--- a/test/doctor.test.ts
+++ b/test/doctor.test.ts
@@ -825,7 +825,7 @@ describe('v0.32.4 — sync_freshness check', () => {
// Stub engine: only checkSyncFreshness's executeRaw matters. Per-case rows
// shape is `{id, name, local_path, last_sync_at}`.
function makeStubEngine(rows: any[], managed = false): any {
- return { executeRaw: async (sql: string) => (sql.includes('FROM persistence_brain') ? [{ enabled: managed }] : rows) };
+ return { executeRaw: async (sql: string) => (sql.includes('FROM persistence_brain') ? [{ enabled: managed }] : sql.includes('shared_skill_packs') ? [] : rows) };
}
function agoMs(ms: number): Date {
@@ -994,7 +994,7 @@ describe('v0.41.27.0 — sync_freshness git short-circuit', () => {
// Reuse the stub-engine pattern from v0.32.4 describe above. Row shape now
// includes last_commit + chunker_version (extended SELECT in v0.41.27.0).
function makeStubEngine(rows: any[]): any {
- return { executeRaw: async () => rows };
+ return { executeRaw: async (sql: string) => (sql.includes('shared_skill_packs') ? [] : rows) };
}
function agoMs(ms: number): Date {
return new Date(Date.now() - ms);
@@ -1252,7 +1252,7 @@ describe('v0.41.27.0 — sync_freshness git short-circuit', () => {
// ============================================================================
describe('v0.41.32.0 — commit-relative staleness', () => {
function makeStubEngine(rows: any[]): any {
- return { executeRaw: async () => rows };
+ return { executeRaw: async (sql: string) => (sql.includes('shared_skill_packs') ? [] : rows) };
}
function agoMs(ms: number): Date { return new Date(Date.now() - ms); }
let currentChunkerVersion: string;
@@ -1922,7 +1922,7 @@ describe('BUG 4 — in-progress sync via live lock, not stale freshness', () =>
// ============================================================================
describe('sync_freshness — clone-unavailable content-lag fallback', () => {
function makeStubEngine(rows: any[]): any {
- return { executeRaw: async () => rows };
+ return { executeRaw: async (sql: string) => (sql.includes('shared_skill_packs') ? [] : rows) };
}
function agoMs(ms: number): Date { return new Date(Date.now() - ms); }
const HOURS = 60 * 60 * 1000;
diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
index b4f02e4d35..e8f127bef4 100644
--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
@@ -2159,14 +2159,77 @@
{
"category": "brain",
"details": {
+ "code": "sync_no_successful_sync",
+ "no_successful_sync": [
+ {
+ "code": "sync_no_successful_sync",
+ "fix": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "sync",
+ "--source",
+ "plain",
+ "--no-pull"
+ ],
+ "consent": [],
+ "docs": "docs/guides/troubleshooting.md#sync-freshness-no-successful-sync",
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "doctor",
+ "--only",
+ "sync_freshness",
+ "--json"
+ ]
+ },
+ "why": "No successful sync of plain is recorded; this runs one and stamps last_sync_at when it succeeds."
+ },
+ "held": 0,
+ "job_id": null,
+ "last_attempt_at": null,
+ "reason": "no_attempt",
+ "result": null,
+ "source_id": "plain"
+ }
+ ],
"stale_count": 1,
"synced_recently_count": 1,
"unchanged_count": 0,
"writer_owned_count": 1
},
"elapsed_ms": "<volatile>",
- "fix_unavailable_reason": "unstructured",
- "message": "Source 'plain' has never been synced. Run `gbrain sync --source <id> --no-pull` for each stale source. 1 writer-owned canonical content source(s): upstream sync is not applicable; see canonical_content_writes for publication status",
+ "fix": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "sync",
+ "--source",
+ "plain",
+ "--no-pull",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain sync --source plain --no-pull --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#sync-freshness-no-successful-sync",
+ "next": "run",
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "doctor",
+ "--only",
+ "sync_freshness",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "No successful sync of plain is recorded; this runs one and stamps last_sync_at when it succeeds."
+ },
+ "message": "Source 'plain': no successful sync recorded; no attempt recorded; run `gbrain sync --source plain --no-pull`. 1 writer-owned canonical content source(s): upstream sync is not applicable; see canonical_content_writes for publication status",
"name": "sync_freshness",
"status": "fail"
},
@@ -3494,7 +3557,36 @@
"status": "unhealthy",
"top_issues": [
{
- "fix": "Source 'plain' has never been synced. Run `gbrain sync --source <id> --no-pull` for each stale source. 1 writer-owned canonical content source(s): upstream sync is not applicable; see canonical_content_writes for publication status",
+ "action": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "sync",
+ "--source",
+ "plain",
+ "--no-pull",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain sync --source plain --no-pull --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#sync-freshness-no-successful-sync",
+ "next": "run",
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "doctor",
+ "--only",
+ "sync_freshness",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "No successful sync of plain is recorded; this runs one and stamps last_sync_at when it succeeds."
+ },
+ "fix": "Source 'plain': no successful sync recorded; no attempt recorded; run `gbrain sync --source plain --no-pull`. 1 writer-owned canonical content source(s): upstream sync is not applicable; see canonical_content_writes for publication status",
"name": "sync_freshness",
"status": "fail",
"tier": "root"
@@ -5886,14 +5978,77 @@
{
"category": "brain",
"details": {
+ "code": "sync_no_successful_sync",
+ "no_successful_sync": [
+ {
+ "code": "sync_no_successful_sync",
+ "fix": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "sync",
+ "--source",
+ "plain",
+ "--no-pull"
+ ],
+ "consent": [],
+ "docs": "docs/guides/troubleshooting.md#sync-freshness-no-successful-sync",
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "doctor",
+ "--only",
+ "sync_freshness",
+ "--json"
+ ]
+ },
+ "why": "No successful sync of plain is recorded; this runs one and stamps last_sync_at when it succeeds."
+ },
+ "held": 0,
+ "job_id": null,
+ "last_attempt_at": null,
+ "reason": "no_attempt",
+ "result": null,
+ "source_id": "plain"
+ }
+ ],
"stale_count": 1,
"synced_recently_count": 1,
"unchanged_count": 0,
"writer_owned_count": 1
},
"elapsed_ms": "<volatile>",
- "fix_unavailable_reason": "unstructured",
- "message": "Source 'plain' has never been synced. Run `gbrain sync --source <id> --no-pull` for each stale source. 1 writer-owned canonical content source(s): upstream sync is not applicable; see canonical_content_writes for publication status",
+ "fix": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "sync",
+ "--source",
+ "plain",
+ "--no-pull",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain sync --source plain --no-pull --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#sync-freshness-no-successful-sync",
+ "next": "run",
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "doctor",
+ "--only",
+ "sync_freshness",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "No successful sync of plain is recorded; this runs one and stamps last_sync_at when it succeeds."
+ },
+ "message": "Source 'plain': no successful sync recorded; no attempt recorded; run `gbrain sync --source plain --no-pull`. 1 writer-owned canonical content source(s): upstream sync is not applicable; see canonical_content_writes for publication status",
"name": "sync_freshness",
"status": "fail"
},
@@ -7221,7 +7376,36 @@
"status": "unhealthy",
"top_issues": [
{
- "fix": "Source 'plain' has never been synced. Run `gbrain sync --source <id> --no-pull` for each stale source. 1 writer-owned canonical content source(s): upstream sync is not applicable; see canonical_content_writes for publication status",
+ "action": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "sync",
+ "--source",
+ "plain",
+ "--no-pull",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain sync --source plain --no-pull --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/troubleshooting.md#sync-freshness-no-successful-sync",
+ "next": "run",
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "doctor",
+ "--only",
+ "sync_freshness",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "No successful sync of plain is recorded; this runs one and stamps last_sync_at when it succeeds."
+ },
+ "fix": "Source 'plain': no successful sync recorded; no attempt recorded; run `gbrain sync --source plain --no-pull`. 1 writer-owned canonical content source(s): upstream sync is not applicable; see canonical_content_writes for publication status",
"name": "sync_freshness",
"status": "fail",
"tier": "root"
diff --git a/test/loops-noise-5012.test.ts b/test/loops-noise-5012.test.ts
index 62bb76ecfc..36e8a7925c 100644
--- a/test/loops-noise-5012.test.ts
+++ b/test/loops-noise-5012.test.ts
@@ -325,6 +325,16 @@ describe('gbrain waiting reports the loops the rule would not have opened', () =
expect(state.loop_automated_backfill_done).toBe(true);
expect(await catchup.seedLoopRechecks(engine, 'g1', { loop_automated_backfill_done: true } as GoogleSourceState, () => {}, NOW.getTime())).toBe(0);
});
+
+ test('the sender backfill leaves threads an unfinished backfill walk will fetch to that walk', async () => {
+ await upsertOpenLoop(engine, loop({ lastActivityAt: '2026-08-01T00:00:00Z' }));
+ await upsertOpenLoop(engine, loop({ threadId: '18c2f4a9b3d21e15', counterpartyEmail: '[email protected]', lastActivityAt: '2026-08-24T00:00:00Z' }));
+ const state = {} as GoogleSourceState;
+ const walkFromMs = Date.parse('2026-08-20T00:00:00Z');
+ expect(await catchup.seedLoopRechecks(engine, 'g1', state, () => {}, NOW.getTime(), walkFromMs)).toBe(1);
+ expect(Object.keys(state.loop_grace_holds ?? {})).toEqual(['18c2f4a9b3d21e07']);
+ expect(state.loop_automated_backfill_done).toBe(true);
+ });
});
describe('opt-in Updates reciprocity', () => {