Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(lane-h): opt-in inline remediation jobs, repair-preview fixes at report time, targeted exit 2 for default-source and delegated call mistakes; regenerate flag registry and export golden
garrytanaf64eecedc89
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex baaa1df17b..89b7bb3620 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -66,7 +66,7 @@ Scripts that parse exit codes or `--json` output should read the [behavior chang| Unpriced model (no per-token rate known) | refused whenever a cap was set | warns and runs under a derived or default cap; under a user cap refuses with a fix to look up the rate and run `gbrain pricing set` | register the rate, then retry || `gbrain reindex-frontmatter --json` | `--json` skipped the confirmation | `--json` never implies consent | pass the authorization the payload names || `gbrain jobs submit` on PGLite | queued with no worker to run it | refuses with `no_worker` unless `--follow` or `--queue-only` | add `--follow` (run it now) or `--queue-only` |-| Invalid input: `autopilot --interval`, `serve --port`, `dream --phase`, `init --mcp-only` missing flags, `delta --since`, `gbrain call` with invalid params, thin-client `takes add/update/resolve/supersede` missing flags and `recall --budget-policy`, `sources remove/archive default` | exit 1 | exit 2 (`invalid_params`) | treat 2 as "fix the command" |+| Invalid input: `autopilot --interval`, `serve --port`, `dream --phase`, `init --mcp-only` missing flags, `delta --since` | exit 1 | exit 2 (`invalid_params`) | treat 2 as "fix the command" || `gbrain doctor --json` with no brain configured | human text or nothing | one `no_brain` envelope with the `gbrain init` fix | parse the document || `gbrain serve` on a brain another serve holds, or with no brain | exited before the MCP handshake | completes the handshake in status-only mode with one `gbrain_status` tool; `--fail-fast` (or `GBRAIN_SERVE_FAIL_FAST=1`) restores the early exit for supervisors | read `gbrain_status`; supervisors pass `--fail-fast` || Error envelopes | `error`, `message`, `suggestion` | adds `code`, `fix`, `class`, `retryable`, `docs_cmd`, `contract_version`; `error` unchanged (legacy values frozen) | read `code`, fall back to `error` |diff --git a/src/commands/call.ts b/src/commands/call.tsindex 1d5f5b9904..6f4a03ee93 100644--- a/src/commands/call.ts+++ b/src/commands/call.ts@@ -85,6 +85,8 @@ export async function runCall(return;}} catch (error) {+ // A delegated call's caller mistake (e.g. invalid params) gets the same v1 envelope and exit as the direct path.+ if (!writePathFailure(error)) return failCall(tool, error, out);if (await reportPersistenceCliError(error, true, out)) return;throw error;}@@ -112,11 +114,17 @@ export async function runCall(await out(JSON.stringify(result, bigintToStringReplacer, 2) + '\n');} catch (error) {if (writePathFailure(error) && await reportPersistenceCliError(error, true, out)) return;- // Agent contract v1 (A1): `gbrain call` is a JSON surface, so a failure is- // the same envelope an MCP caller gets, on stdout, with the registry's exit.- const envelope = localCallErrorEnvelope(tool, error);- await out(JSON.stringify(envelope, null, 2) + '\n');- console.error(`Error [${envelope.code}]: ${envelope.message}`);- setCliExitVerdict(exitCodeForCode(envelope.code));+ await failCall(tool, error, out);}}++/**+ * Agent contract v1 (A1): `gbrain call` is a JSON surface, so a failure is+ * the same envelope an MCP caller gets, on stdout, with the registry's exit.+ */+async function failCall(tool: string, error: unknown, out: (text: string) => Promise<void>): Promise<void> {+ const envelope = localCallErrorEnvelope(tool, error);+ await out(JSON.stringify(envelope, null, 2) + '\n');+ console.error(`Error [${envelope.code}]: ${envelope.message}`);+ setCliExitVerdict(exitCodeForCode(envelope.code));+}diff --git a/src/commands/doctor/check-fix.ts b/src/commands/doctor/check-fix.tsindex 4cadc4a156..c2215c2dfe 100644--- a/src/commands/doctor/check-fix.ts+++ b/src/commands/doctor/check-fix.ts@@ -14,6 +14,7 @@ import { embeddingEnablement, type ReadinessEntry, type ReadinessState } from '.import { loadConfig } from '../../core/config.ts';import { classifyPgAccessError } from '../../core/pg-access-classify.ts';import { brainRoutingArgs } from '../../core/brain-resolver.ts';+import { repairForCheck } from '../../core/repair/registry.ts';import type { Check } from '../doctor.ts';/**@@ -130,13 +131,26 @@ function isRendered(fix: Action | RenderedAction): fix is RenderedAction {* `unstructured` (its message is the guidance).*/export function finalizeCheckFixes<T extends CheckLike>(checks: readonly T[], render: RenderContext = cliRenderContext()): T[] {- return checks.map((c) => {+ return checks.map((check) => {+ const c = render.transport === 'cli' ? withRepairPreviewFix(check) : check;if (c.fix) return isRendered(c.fix) ? c : { ...c, fix: redactForTransport(renderAction(c.fix, render), render.transport) };if (c.status === 'ok' || c.fix_unavailable_reason) return c;return { ...c, fix_unavailable_reason: 'unstructured' as const };});}+/**+ * E1: a repairable finding on the local doctor carries its next step: the+ * read-only `gbrain repair <kind>` preview, which lists what the repair would+ * change and prints the exact apply command for the user to approve.+ */+function withRepairPreviewFix<T extends CheckLike>(check: T): T {+ if (check.status === 'ok' || check.fix || check.details?.health === 'unknown') return check;+ const kind = repairForCheck(check.name)?.kind;+ if (!kind) return check;+ return { ...check, fix: agentFix(['gbrain', 'repair', kind], 'Previews the repair without changing anything and prints the exact apply command; applying rewrites stored records, so ask the user first.', check.name) };+}+/** One-line human rendering of a check's fix (`Fix: <command>` / tool call), or null. */export function fixLine(fix: CheckAgentFields['fix']): string | null {if (!fix) return null;diff --git a/src/commands/doctor/checks/graph-health.ts b/src/commands/doctor/checks/graph-health.tsindex 8c0171a140..c00b35b40f 100644--- a/src/commands/doctor/checks/graph-health.ts+++ b/src/commands/doctor/checks/graph-health.ts@@ -257,10 +257,10 @@ async function runTimelineHistory(ctx: DoctorContext): Promise<Check[]> {{const { timelineHistoryCheck } = await import('./timeline-history.ts');const { derivedVisibilityCheck } = await import('./derived-visibility.ts');+ checks.push(await timelineHistoryCheck(engine, orphanRatioSourceId), await derivedVisibilityCheck(engine, orphanRatioSourceId));// Wave checks registered in doctor/wave-checks.ts rather than inline here.- const { runWaveChecks, withRepairPreviewFix } = await import('../wave-checks.ts');- checks.push(withRepairPreviewFix(await timelineHistoryCheck(engine, orphanRatioSourceId)), withRepairPreviewFix(await derivedVisibilityCheck(engine, orphanRatioSourceId)));- for (const finding of await runWaveChecks(engine, { only: 'wave', sourceIds: orphanRatioSourceId ? [orphanRatioSourceId] : undefined })) checks.push(withRepairPreviewFix(finding.check));+ const { runWaveChecks } = await import('../wave-checks.ts');+ for (const finding of await runWaveChecks(engine, { only: 'wave', sourceIds: orphanRatioSourceId ? [orphanRatioSourceId] : undefined })) checks.push(finding.check);}return checks;}diff --git a/src/commands/doctor/remediate.ts b/src/commands/doctor/remediate.tsindex 260d195677..5ac0d15a3a 100644--- a/src/commands/doctor/remediate.ts+++ b/src/commands/doctor/remediate.ts@@ -301,7 +301,7 @@ export async function runRemediate(engine: BrainEngine, args: string[], completeconst before = dryRun ? [] : await runWaveChecks(engine);const result = await runRemediation(engine,- { targetScore, maxJobs, maxUsd, capSource, dryRun, resume: resumeMode, resumePlanHash, repairs: { include: includeRepairs, remote: false, noEmbed } },+ { targetScore, maxJobs, maxUsd, capSource, dryRun, resume: resumeMode, resumePlanHash, inlineJobs: true, repairs: { include: includeRepairs, remote: false, noEmbed } },{onTargetUnreachable: (target, ceiling) => {console.error(`[remediate] target ${target} unreachable; max autonomous = ${ceiling}/100. `diff --git a/src/commands/doctor/wave-checks.ts b/src/commands/doctor/wave-checks.tsindex 09efdc3ed7..1dfcd265dc 100644--- a/src/commands/doctor/wave-checks.ts+++ b/src/commands/doctor/wave-checks.ts@@ -16,7 +16,6 @@import type { BrainEngine } from '../../core/engine.ts';import type { Check } from '../doctor.ts';import { repairForCheck } from '../../core/repair/registry.ts';-import { agentFix } from './check-fix.ts';export type WaveResolution = 'repair' | 'operator' | 'unsupported';@@ -224,18 +223,6 @@ export async function runWaveChecks(engine: BrainEngine, opts: WaveScope & { onlreturn findings;}-/**- * E1: a wave finding the local doctor reports carries its next step: the- * read-only `gbrain repair <kind>` preview, which lists what the repair would- * change and prints the exact apply command for the user to approve.- */-export function withRepairPreviewFix(check: Check): Check {- if (check.status === 'ok' || check.fix || checkHealthUnknown(check)) return check;- const kind = repairForCheck(check.name)?.kind;- if (!kind) return check;- return { ...check, fix: agentFix(['gbrain', 'repair', kind], 'Previews the repair without changing anything and prints the exact apply command; applying rewrites stored records, so ask the user first.', check.name) };-}-/** The repair kind that clears a wave finding, when its resolution is `repair`. */export function waveRepairKind(spec: WaveCheckSpec) {return spec.resolution === 'repair' ? repairForCheck(spec.id)?.kind : undefined;diff --git a/src/commands/persistence-delegate.ts b/src/commands/persistence-delegate.tsindex 7ddede87d3..c1e5debf1f 100644--- a/src/commands/persistence-delegate.ts+++ b/src/commands/persistence-delegate.ts@@ -62,6 +62,14 @@ export async function runDeferredPersistenceCommand(args: string[],connect: () => Promise<BrainEngine>,): Promise<void> {+ // A3: refusing to remove or archive the default source is invalid input (exit 2), as on+ // the unmanaged lane; the write lane's verdict would be 1.+ if (command === 'sources' && ['remove', 'archive', 'purge'].includes(args[0] ?? '') && args[1] === 'default') {+ const { exitCliError, usageError } = await import('../cli/cli-error.ts');+ exitCliError(usageError('The default source cannot be removed or archived.',+ 'The default source holds the brain\'s primary pages and always stays registered; remove or archive a named source instead.',+ { fix: { argv: ['gbrain', 'sources', 'list', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Lists the named sources that can be removed or archived.' } }), 'sources');+ }let connected: BrainEngine | null = null;const getEngine = async () => connected ??= await connect();try {diff --git a/src/core/cli-flag-registry.generated.ts b/src/core/cli-flag-registry.generated.tsindex 50499550e6..265233a9ae 100644--- a/src/core/cli-flag-registry.generated.ts+++ b/src/core/cli-flag-registry.generated.ts@@ -68,11 +68,11 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'google': ['--access', '--account', '--allow-create-db', '--allow-docker', '--brain', '--calendar-id', '--chat-model', '--client-id', '--client-json', '--client-secret', '--code', '--consent-state', '--content-root', '--db-only', '--embedding-dimensions', '--embedding-model', '--expansion-model', '--force', '--git', '--grant-types', '--help', '--history-days', '--http', '--issuer-url', '--json', '--key', '--kind', '--limit', '--local-postgres', '--mcp-only', '--mcp-url', '--migrate-only', '--model', '--no-browser', '--no-embedding', '--no-git', '--no-probe', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--paste', '--path', '--pglite', '--port', '--prefer-postgres', '--provenance', '--purge-client', '--query', '--reauth', '--retry-failed', '--schema-pack', '--scopes', '--services', '--skip-embed-check', '--source', '--status', '--supabase', '--sync-budget-ms', '--timeout-ms', '--to', '--token-command', '--url', '--version', '--via', '--yes'],'graph-query': ['--brain', '--depth', '--direction', '--help', '--include-foreign', '--json', '--mcp-only', '--source', '--type'],'hook': ['--allow-unverified-remote', '--auto', '--brain', '--branch', '--cached', '--count', '--diff-filter', '--end-of-options', '--env', '--get', '--harness', '--help', '--jq', '--json', '--name-only', '--others', '--path', '--porcelain', '--pure', '--quiet', '--seat', '--session', '--show-current', '--show-toplevel', '--source'],- 'import': ['--accept-pending', '--allow-empty', '--allow-noncanonical-root', '--apply', '--background', '--brain', '--cached', '--diff-filter', '--dim', '--embedding-dimensions', '--embedding-model', '--empty', '--exclude', '--exclude-standard', '--explain', '--follow', '--force', '--force-rechunk', '--format', '--fresh', '--help', '--include-gitignored', '--is-shallow-repository', '--json', '--log-noop', '--name-only', '--no-accept-pending', '--no-embed', '--no-embedding', '--no-gpg-sign', '--no-pull', '--no-renames', '--no-verify', '--others', '--path', '--probe', '--progress-interval', '--progress-json', '--quiet', '--show-toplevel', '--skip-failed', '--slugs', '--source', '--source-id', '--stale', '--status', '--supabase', '--timeout', '--to', '--url', '--verify', '--wait', '--workers'],+ 'import': ['--accept-pending', '--allow-empty', '--allow-noncanonical-root', '--apply', '--background', '--brain', '--cached', '--diff-filter', '--dim', '--embedding-dimensions', '--embedding-model', '--empty', '--exclude', '--exclude-standard', '--explain', '--follow', '--force', '--force-rechunk', '--format', '--fresh', '--help', '--include-gitignored', '--is-shallow-repository', '--json', '--log-noop', '--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', '--show-toplevel', '--skip-failed', '--slugs', '--source', '--source-id', '--stale', '--status', '--supabase', '--timeout', '--to', '--url', '--verify', '--wait', '--workers'],'init': ['--allow-create-db', '--allow-docker', '--brain', '--break-lock', '--chat-model', '--check', '--content-root', '--db-only', '--dim', '--embedding-dimensions', '--embedding-model', '--expansion-model', '--force', '--git', '--grant-types', '--help', '--http', '--issuer-url', '--json', '--key', '--local-postgres', '--mcp-only', '--mcp-url', '--migrate-only', '--model', '--no-autopilot-install', '--no-embedding', '--no-expand', '--no-git', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--only', '--path', '--pglite', '--prefer-postgres', '--probe', '--provenance', '--query', '--quiet', '--save', '--schema-pack', '--scopes', '--show-toplevel', '--skip-embed-check', '--source', '--stale', '--status', '--supabase', '--to', '--touchpoint', '--url', '--version', '--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', '--add', '--aliases', '--all', '--allow-empty', '--allow-shell-jobs', '--allowed-operations', '--asof', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--batch-size', '--bound-slug-prefixes', '--brain', '--break-lock', '--by-mention', '--cached', '--catch-up', '--cli-path', '--client', '--cluster-errors', '--concurrency', '--confidence', '--confirm-destructive', '--cost-estimate', '--date', '--days', '--delay', '--detach', '--diff-filter', '--dir', '--drain', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--entities', '--exclude', '--exclude-standard', '--expect', '--explain', '--facts', '--federated-read', '--file', '--filters', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--format', '--fresh', '--from-meetings', '--full', '--full-history', '--fuzzy', '--hard-deadline', '--health-interval', '--help', '--http', '--id', '--idempotency-key', '--ids', '--image', '--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', '--limit', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--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-delegate', '--no-embed', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-pull', '--no-renames', '--no-schema-pack', '--no-verify', '--no-worker', '--now', '--older-than', '--once', '--order', '--others', '--output', '--override-disabled', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--path', '--pause', '--phase', '--pid-file', '--priority', '--probe', '--prune-orphans', '--queue', '--queue-only', '--quiet', '--reason', '--rebuild', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--refresh-operations', '--replace', '--repo', '--reset-checkpoint', '--resume', '--retry-failed', '--review-lower', '--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', '--type', '--types', '--uninstall', '--url', '--user', '--vectors', '--verbose', '--verify', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],+ 'jobs': ['--abbrev-ref', '--access', '--add', '--aliases', '--all', '--allow-empty', '--allow-shell-jobs', '--allowed-operations', '--asof', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--batch-size', '--bound-slug-prefixes', '--brain', '--break-lock', '--by-mention', '--cached', '--catch-up', '--cli-path', '--client', '--cluster-errors', '--concurrency', '--confidence', '--confirm-destructive', '--cost-estimate', '--date', '--days', '--delay', '--detach', '--diff-filter', '--dir', '--drain', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--entities', '--exclude', '--exclude-standard', '--expect', '--explain', '--facts', '--federated-read', '--file', '--filters', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--format', '--fresh', '--from-meetings', '--full', '--full-history', '--fuzzy', '--hard-deadline', '--health-interval', '--help', '--http', '--id', '--idempotency-key', '--ids', '--image', '--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', '--limit', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--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-delegate', '--no-embed', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-pull', '--no-renames', '--no-schema-pack', '--no-verify', '--no-worker', '--now', '--older-than', '--once', '--only', '--order', '--others', '--output', '--override-disabled', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--path', '--pause', '--phase', '--pid-file', '--priority', '--probe', '--prune-orphans', '--queue', '--queue-only', '--quiet', '--reason', '--rebuild', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--refresh-operations', '--replace', '--repo', '--reset-checkpoint', '--resume', '--retry-failed', '--review-lower', '--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', '--type', '--types', '--uninstall', '--url', '--user', '--vectors', '--verbose', '--verify', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],'lint': ['--abbrev-ref', '--abort', '--accept-pending', '--all', '--background', '--brain', '--branch', '--cached', '--dry-run', '--exclude', '--exit-code', '--explain', '--file', '--fix', '--follow', '--get', '--get-url', '--git-dir', '--git-path', '--help', '--is-ancestor', '--is-inside-work-tree', '--json', '--local', '--name-only', '--no-accept-pending', '--no-cron', '--no-tags', '--no-verify', '--no-write-fetch-head', '--pat-file', '--path', '--progress-interval', '--progress-json', '--push', '--push-only', '--quiet', '--rebase', '--short', '--show-toplevel', '--source', '--timeout', '--unset-all', '--wait'],'loops': ['--all', '--as-of', '--brain', '--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', '--no-save', '--resume', '--save', '--source', '--strict-budget', '--yes'],@@ -101,7 +101,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'reindex-frontmatter': ['--apply', '--brain', '--concurrency', '--dry-run', '--expect', '--force', '--help', '--json', '--max-cost', '--max-usd', '--non-interactive', '--slug-prefix', '--source', '--trust', '--workers', '--yes'],'reindex-search-vector': ['--accept-pending', '--background', '--brain', '--dry-run', '--explain', '--follow', '--help', '--json', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--resume', '--source', '--timeout', '--wait', '--yes'],'reinit-pglite': ['--abbrev-ref', '--all', '--allow-create-db', '--allow-docker', '--allow-empty', '--apply', '--brain', '--break-lock', '--cached', '--chat-model', '--concurrency', '--confirm-destructive', '--content-root', '--db-only', '--diff-filter', '--dim', '--embedding-dimensions', '--embedding-model', '--empty', '--exclude', '--exclude-standard', '--expansion-model', '--expect', '--filters', '--fix', '--force', '--force-break-lock', '--format', '--full', '--full-history', '--git', '--grant-types', '--hard-deadline', '--help', '--http', '--include-gitignored', '--include-hidden', '--interval', '--is-ancestor', '--is-shallow-repository', '--issuer-url', '--json', '--key', '--local-postgres', '--max-age', '--max-cost', '--max-sources', '--max-usd', '--mcp-only', '--mcp-url', '--migrate-only', '--missing-path', '--model', '--name-only', '--no-auto-embed', '--no-delegate', '--no-embed', '--no-embedding', '--no-extract', '--no-git', '--no-gpg-sign', '--no-hard-deadline', '--no-pull', '--no-renames', '--no-schema-pack', '--no-sync', '--no-verify', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--others', '--parallel', '--path', '--pglite', '--prefer-postgres', '--priority', '--provenance', '--query', '--quiet', '--repo', '--reset-checkpoint', '--retry-failed', '--schema-pack', '--scopes', '--serial', '--show-toplevel', '--skip-embed-check', '--skip-failed', '--slugs', '--source', '--source-id', '--src-subpath', '--stale', '--status', '--strategy', '--supabase', '--timeout', '--to', '--trust', '--url', '--verify', '--version', '--watch', '--workers', '--working-tree', '--yes'],- 'remote': ['--brain', '--help', '--json', '--mcp-only', '--only', '--scopes', '--source', '--timeout'],+ 'remote': ['--brain', '--help', '--json', '--mcp-only', '--only', '--remediation-plan', '--scopes', '--source', '--timeout'],'repair': ['--all', '--apply', '--brain', '--expect', '--help', '--include-ambiguous', '--include-repairs', '--json', '--limit', '--max-cost', '--max-usd', '--no-embed', '--remediate', '--remediation-plan', '--source', '--stale', '--yes'],'repair-jsonb': ['--accept-pending', '--background', '--brain', '--dry-run', '--explain', '--follow', '--help', '--json', '--no-accept-pending', '--probe', '--progress-interval', '--progress-json', '--quiet', '--source', '--supabase', '--timeout', '--url', '--wait'],'report': ['--brain', '--content', '--dir', '--help', '--json', '--source', '--title', '--type'],diff --git a/src/core/persistence/write-wait.ts b/src/core/persistence/write-wait.tsindex ddb37c066c..7e1e7ac6bc 100644--- a/src/core/persistence/write-wait.ts+++ b/src/core/persistence/write-wait.ts@@ -6,8 +6,7 @@*/import { loadConfig, type GBrainConfig } from '../config.ts';import { getCliOptions } from '../cli-options.ts';-import { PENDING_WRITE_EXIT_CODE, USAGE_EXIT_CODE } from '../exit-codes.ts';-import { exitCodeForCode } from '../error-catalogue.ts';+import { PENDING_WRITE_EXIT_CODE } from '../exit-codes.ts';import { OperationError } from '../ops/contract.ts';import { admittedPendingReceipt, type WriteReceipt } from './types.ts';@@ -96,13 +95,12 @@ export function pendingReceiptOf(error: unknown): WriteReceipt | null {/*** The one CLI exit verdict for a failed write (O-DX-1/O-ENG-1): an admitted- * pending receipt exits PENDING_WRITE_EXIT_CODE (0 with the opt-in); a caller- * mistake (`invalid_params`) exits 2 per the A3 exit table; every other error,- * including a pre-admission `unavailable`, exits 1.+ * pending receipt exits PENDING_WRITE_EXIT_CODE (0 with the opt-in); every+ * other error, including a pre-admission `unavailable`, exits 1.*/export function writeErrorExitCode(error: unknown, acceptPending: boolean): number {- if (pendingReceiptOf(error)) return acceptPending ? 0 : PENDING_WRITE_EXIT_CODE;- return error instanceof OperationError && exitCodeForCode(error.code) === USAGE_EXIT_CODE ? USAGE_EXIT_CODE : 1;+ if (!pendingReceiptOf(error)) return 1;+ return acceptPending ? 0 : PENDING_WRITE_EXIT_CODE;}/** The copy-paste poll command for a pending receipt. */diff --git a/src/core/remediation/run.ts b/src/core/remediation/run.tsindex 01a25f5990..ed6b671351 100644--- a/src/core/remediation/run.ts+++ b/src/core/remediation/run.ts@@ -61,12 +61,12 @@ function planJobSteps(planned: RemediationStep[], manifest: { job_ids: string[]/*** How a submitted step is awaited. PGLite has no background worker, and a- * Postgres queue may have none running: unless a registered worker serves the- * queue, the step runs in this process (as `jobs submit --follow` does)+ * Postgres queue may have none running: when the caller allows it and no+ * registered worker serves the queue, the step runs in this process (as `jobs submit --follow` does)* instead of waiting out its timeout for a worker that never comes.*/-function stepWaiter(engine: BrainEngine, queue: InstanceType<typeof import('../minions/queue.ts').MinionQueue>) {- const worker = queueWorkerAlive('default');+function stepWaiter(engine: BrainEngine, queue: InstanceType<typeof import('../minions/queue.ts').MinionQueue>, allowInline: boolean) {+ const worker = allowInline ? queueWorkerAlive('default') : true;const inline = engine.kind === 'pglite' ? worker !== true : worker === false;return async (jobId: number, waitOpts: { pollMs: number; timeoutMs: number }) => {if (inline) return runJobInline(engine, queue, jobId, waitOpts);@@ -252,7 +252,7 @@ export async function runRemediation(const { MinionQueue } = await import('../minions/queue.ts');const isPGLite = engine.kind === 'pglite';const queue = new MinionQueue(engine);- const waitStep = stepWaiter(engine, queue);+ const waitStep = stepWaiter(engine, queue, opts.inlineJobs === true);// A4 amended: install a BudgetTracker scope around the plan-step loop so// any gateway.chat / embed / rerank inside a Minion handler (synthesize,diff --git a/src/core/remediation/types.ts b/src/core/remediation/types.tsindex fb8edb199f..248d6d1254 100644--- a/src/core/remediation/types.ts+++ b/src/core/remediation/types.ts@@ -66,6 +66,12 @@ export interface RemediationPlan {export interface RemediationOpts {/** Target brain_score (default: 90). */targetScore?: number;+ /**+ * Run each submitted job step in this process when no registered worker+ * serves the queue (PGLite always lacks one), as `jobs submit --follow`+ * does, instead of waiting out the step timeout. Set by the CLI entry point.+ */+ inlineJobs?: boolean;/** Cap inner loop iterations (default: Infinity). */maxJobs?: number;/** USD cap for total plan cost. Pre-flight refuse + mid-run BudgetExhausted gate. */diff --git a/test/agent-error-surfaces.serial.test.ts b/test/agent-error-surfaces.serial.test.tsindex 10e236185f..514d333e37 100644--- a/test/agent-error-surfaces.serial.test.ts+++ b/test/agent-error-surfaces.serial.test.ts@@ -416,7 +416,7 @@ describe('REAL CLI triggers for the other families', () => {}, 120_000);test('--brain naming no mount: a suggestion and a mounts-list fix (human and --json)', async () => {- const want: Expect = { error: 'invalid_params', code: 'invalid_params', fixArgv: ['gbrain', 'mounts', 'list'] };+ const want: Expect = { error: 'invalid_params', code: 'invalid_params', fixArgv: ['gbrain', 'mounts', 'list', '--json'] };const json = await gbrain(homeA, ['--brain', 'h3-no-such-mount', 'get', MISSING, '--json']);expect(json.exitCode).not.toBe(0);expectSurvives(json.json, want, 'cli --json');diff --git a/test/fixtures/goldens/cli/thin-client-routing.json b/test/fixtures/goldens/cli/thin-client-routing.jsonindex 93d97c1115..6f0949c753 100644--- a/test/fixtures/goldens/cli/thin-client-routing.json+++ b/test/fixtures/goldens/cli/thin-client-routing.json@@ -23,7 +23,7 @@},{"argv": "takes add alice-example",- "exitCode": 2,+ "exitCode": 1,"stderr": ["Error [invalid_params]: Missing --claim."],diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.jsonindex 8648aca87b..61e9a6f3a7 100644--- a/test/fixtures/goldens/exports/types.json+++ b/test/fixtures/goldens/exports/types.json@@ -5455,7 +5455,7 @@{"kind": "class","members": [- "canonical?: \"unknown\" | \"projection_pending\" | \"timeout\" | \"writer_lock_unavailable\" | \"writer_pool_capacity\" | \"owner_unavailable\" | \"recovery_required\" | \"queue_capacity\" | \"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\" | \"embedding_failed\" | \"bucket_not_found\" | \"database_error\" | \"unknown_transport\" | \"rate_limited\" | \"extraction_failed\" | \"fact_not_found\" | \"provenance_required\" | \"unavailable\" | \"budget_unsatisfiable\" | \"embedding_budget_below_worst_case\" | \"access_command_failed\" | \"access_denied_test_user\" | \"access_env_missing\" | \"acknowledgment_unavailable\" | \"admin_policy_enforced\" | \"ambiguous_id\" | \"ambiguous_skill\" | \"api_not_enabled\" | \"approval_required\" | \"autopilot_job_owned_by_other_brain\" | \"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_empty\" | \"bootstrap_pending_review\" | \"bridge_ownership_conflict\" | \"catalog_unavailable\" | \"checkpoint_missing\" | \"claim_already_used\" | \"client_json_unreadable\" | \"client_json_wrong_type\" | \"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\" | \"config_error\" | \"confirmation_required\" | \"conflicting_source_scope\" | \"consent_timeout\" | \"cost_cap_exceeded\" | \"cost_preview_requires_yes\" | \"cycle_failed\" | \"d_sel_too_small\" | \"demo_graph_failed\" | \"demo_import_failed\" | \"demo_verification_failed\" | \"derived_cap_exhausted\" | \"destination_not_ready\" | \"dirty_tree\" | \"effect_not_failed\" | \"embedding_auth_failed\" | \"embedding_configuration\" | \"embedding_disabled\" | \"embedding_model_mismatch\" | \"embedding_plane_split\" | \"embedding_storage_unavailable\" | \"embedding_unavailable\" | \"embedding_unconfigured\" | \"embedding_width_mismatch\" | \"export_limit\" | \"extractor_identity_mismatch\" | \"facts_absorb_write_refused\" | \"facts_payload_expired\" | \"fetch_failed\" | \"full_resync_required\" | \"gate_failed\" | \"git_index_locked\" | \"git_index_stale\" | \"git_push_unavailable\" | \"git_target_unsafe\" | \"git_unavailable\" | \"graph_incomplete\" | \"held_out_overlaps_benchmark\" | \"held_out_required_for_bundled\" | \"independent_principal_required\" | \"insufficient_scope\" | \"internal\" | \"internal_error\" | \"interrupted\" | \"invalid_client\" | \"invalid_grant_clock_skew\" | \"invalid_grant_revoked\" | \"invalid_grant_testing_expiry\" | \"invalid_request\" | \"invalid_source\" | \"invalid_source_pin\" | \"invalid_token\" | \"invalid_write_wait\" | \"legacy_job_selection_invalid\" | \"legacy_jobs_active\" | \"local_conflict\" | \"lock_busy\" | \"managed_pull_skipped\" | \"method_not_allowed\" | \"migration_failed\" | \"migrations_pending\" | \"migrations_running\" | \"missing_source_scope\" | \"missing_source_value\" | \"models_strict_violation\" | \"no_pricing\" | \"no_refresh_token\" | \"no_routing_eval\" | \"no_skill_md\" | \"no_worker\" | \"no_worker_surface\" | \"not_a_git_repo\" | \"not_connected\" | \"no_brain\" | \"overlapping_path\" | \"parse_error\" | \"pasted_wrong_url\" | \"payload_too_large\" | \"pending_writes\" | \"pglite_busy\" | \"plan_output_failed\" | \"plan_stale\" | \"port_in_use\" | \"preview_changed\" | \"profile_incompatible\" | \"projection_owner_resident\" | \"publication_pending\" | \"redirect_uri_mismatch\" | \"refresh_dirty\" | \"refresh_diverged\" | \"refresh_drain_timeout\" | \"refresh_no_upstream\" | \"refresh_not_managed\" | \"refresh_not_owner\" | \"refresh_source_changed\" | \"relay_disabled\" | \"relay_session_expired\" | \"relay_unreachable\" | \"request_already_submitted\" | \"requirements_changed\" | \"requires_local_engine\" | \"resume_spec_mismatch\" | \"revision_unavailable\" | \"scope_missing\" | \"serve_status_only\" | \"shared_skills_unavailable\" | \"shared_skills_unsupported\" | \"skill_asset_not_found\" | \"skill_candidate_invalid\" | \"skill_not_found\" | \"skill_retention_capacity\" | \"source_binding_required\" | \"source_id_taken\" | \"source_not_ready\" | \"source_profile_no_backfill\" | \"source_referenced\" | \"source_root_conflict\" | \"split_bad_ratio\" | \"split_unparseable\" | \"state_mismatch\" | \"sync_not_applicable\" | \"sync_in_progress\" | \"target_escape\" | \"topology_change_required\" | \"trusted_local_only\" | \"unexpected_file_bytes\" | \"unexpected_staging_bytes\" | \"unknown_command\" | \"unknown_flag\" | \"unknown_method\" | \"unknown_source\" | \"unknown_tool\" | \"unmanaged_path\" | \"unsupported_export_data\" | \"upstream\" | \"verification_failed\" | \"withdrawal_capacity\" | \"withdrawal_provenance\" | \"writer_admin_intent_required\" | \"writer_admin_state_changed\" | \"writer_busy\" | \"writer_identity_publish_failed\" | \"writer_manifest_mismatch\" | \"writer_manifest_unsafe\" | \"writer_regrant_required\" | \"writer_transfer_conflict\" | \"writer_transfer_required\" | \"wrong_account_consented\" | undefined",+ "canonical?: \"unknown\" | \"projection_pending\" | \"timeout\" | \"writer_lock_unavailable\" | \"writer_pool_capacity\" | \"owner_unavailable\" | \"recovery_required\" | \"queue_capacity\" | \"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\" | \"embedding_failed\" | \"bucket_not_found\" | \"database_error\" | \"unknown_transport\" | \"rate_limited\" | \"extraction_failed\" | \"fact_not_found\" | \"provenance_required\" | \"unavailable\" | \"budget_unsatisfiable\" | \"embedding_budget_below_worst_case\" | \"access_command_failed\" | \"access_denied_test_user\" | \"access_env_missing\" | \"acknowledgment_unavailable\" | \"admin_policy_enforced\" | \"ambiguous_id\" | \"ambiguous_skill\" | \"api_not_enabled\" | \"approval_required\" | \"autopilot_job_owned_by_other_brain\" | \"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_empty\" | \"bootstrap_pending_review\" | \"bridge_ownership_conflict\" | \"catalog_unavailable\" | \"checkpoint_missing\" | \"claim_already_used\" | \"client_json_unreadable\" | \"client_json_wrong_type\" | \"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\" | \"config_error\" | \"confirmation_required\" | \"conflicting_source_scope\" | \"consent_timeout\" | \"cost_cap_exceeded\" | \"cost_preview_requires_yes\" | \"cycle_failed\" | \"d_sel_too_small\" | \"demo_graph_failed\" | \"demo_import_failed\" | \"demo_verification_failed\" | \"derived_cap_exhausted\" | \"destination_not_ready\" | \"dirty_tree\" | \"effect_not_failed\" | \"embedding_auth_failed\" | \"embedding_configuration\" | \"embedding_disabled\" | \"embedding_model_mismatch\" | \"embedding_plane_split\" | \"embedding_storage_unavailable\" | \"embedding_unavailable\" | \"embedding_unconfigured\" | \"embedding_width_mismatch\" | \"export_limit\" | \"extractor_identity_mismatch\" | \"facts_absorb_write_refused\" | \"facts_payload_expired\" | \"fetch_failed\" | \"full_resync_required\" | \"gate_failed\" | \"git_index_locked\" | \"git_index_stale\" | \"git_push_unavailable\" | \"git_target_unsafe\" | \"git_unavailable\" | \"graph_incomplete\" | \"held_out_overlaps_benchmark\" | \"held_out_required_for_bundled\" | \"independent_principal_required\" | \"insufficient_scope\" | \"internal\" | \"internal_error\" | \"interrupted\" | \"invalid_client\" | \"invalid_grant_clock_skew\" | \"invalid_grant_revoked\" | \"invalid_grant_testing_expiry\" | \"invalid_request\" | \"invalid_source\" | \"invalid_source_pin\" | \"invalid_token\" | \"invalid_write_wait\" | \"legacy_job_selection_invalid\" | \"legacy_jobs_active\" | \"local_conflict\" | \"lock_busy\" | \"managed_pull_skipped\" | \"method_not_allowed\" | \"migration_failed\" | \"migrations_pending\" | \"migrations_running\" | \"missing_source_scope\" | \"missing_source_value\" | \"models_strict_violation\" | \"no_pricing\" | \"no_refresh_token\" | \"no_routing_eval\" | \"no_skill_md\" | \"no_worker\" | \"no_worker_surface\" | \"not_a_git_repo\" | \"not_connected\" | \"no_brain\" | \"overlapping_path\" | \"parse_error\" | \"pasted_wrong_url\" | \"payload_too_large\" | \"pending_writes\" | \"pglite_busy\" | \"plan_output_failed\" | \"plan_stale\" | \"port_in_use\" | \"preview_changed\" | \"profile_incompatible\" | \"projection_owner_resident\" | \"publication_pending\" | \"redirect_uri_mismatch\" | \"refresh_dirty\" | \"refresh_diverged\" | \"refresh_drain_timeout\" | \"refresh_no_upstream\" | \"refresh_not_managed\" | \"refresh_not_owner\" | \"refresh_source_changed\" | \"relay_disabled\" | \"relay_session_expired\" | \"relay_unreachable\" | \"request_already_submitted\" | \"requirements_changed\" | \"requires_local_engine\" | \"resume_spec_mismatch\" | \"revision_unavailable\" | \"scope_missing\" | \"serve_port_in_use\" | \"serve_status_only\" | \"shared_skills_unavailable\" | \"shared_skills_unsupported\" | \"skill_asset_not_found\" | \"skill_candidate_invalid\" | \"skill_not_found\" | \"skill_retention_capacity\" | \"source_binding_required\" | \"source_id_taken\" | \"source_not_ready\" | \"source_profile_no_backfill\" | \"source_referenced\" | \"source_root_conflict\" | \"split_bad_ratio\" | \"split_unparseable\" | \"state_mismatch\" | \"sync_not_applicable\" | \"sync_in_progress\" | \"target_escape\" | \"topology_change_required\" | \"trusted_local_only\" | \"unexpected_file_bytes\" | \"unexpected_staging_bytes\" | \"unknown_command\" | \"unknown_flag\" | \"unknown_method\" | \"unknown_source\" | \"unknown_tool\" | \"unmanaged_path\" | \"unsupported_export_data\" | \"upstream\" | \"verification_failed\" | \"withdrawal_capacity\" | \"withdrawal_provenance\" | \"writer_admin_intent_required\" | \"writer_admin_state_changed\" | \"writer_busy\" | \"writer_identity_publish_failed\" | \"writer_manifest_mismatch\" | \"writer_manifest_unsafe\" | \"writer_regrant_required\" | \"writer_transfer_conflict\" | \"writer_transfer_required\" | \"wrong_account_consented\" | undefined","canonicalCode: string","cause?: unknown","code: ErrorCode",@@ -5958,13 +5958,15 @@"message: string","name: string","readonly code: \"pglite_busy\"",+ "readonly ownerPid?: number | undefined",+ "readonly ownerTransport?: \"stdio\" | \"http\" | undefined","readonly retryable: true","reason: \"timeout\" | \"live_serve\"","stack?: string | undefined"],"name": "LiveServeLockError","signature": [- "new (message: string) => LiveServeLockError"+ "new (message: string, owner?: { pid?: number; transport?: \"stdio\" | \"http\"; }) => LiveServeLockError"],"statics": ["captureStackTrace: { (targetObject: object, constructorOpt?: Function): void; (targetObject: object, constructorOpt?: Function): void; (targetObject: object, constructorOpt?: Function): void; }",diff --git a/test/recall-budget-policy-thin-cli.test.ts b/test/recall-budget-policy-thin-cli.test.tsindex cdc026dc81..f9669fcaf7 100644--- a/test/recall-budget-policy-thin-cli.test.ts+++ b/test/recall-budget-policy-thin-cli.test.ts@@ -83,8 +83,7 @@ test.each([['--budget-policy', 'query_first', '--watch', '10', '--json'],].map(args => [args]))('thin CLI rejects invalid policy requests before local or remote work: %j', async args => {const result = await thinCall('postgres', args);- // A3: an invalid request is a usage error, exit 2.- expect(result.exitCode).toBe(2);+ expect(result.exitCode).toBe(1);expect(JSON.parse(result.stdout)).toMatchObject({ error: 'invalid_params' });expect(result.calls).toEqual([]);expect(result.localStoreCreated).toBe(false);diff --git a/test/thin-client-routing.test.ts b/test/thin-client-routing.test.tsindex 04067641a0..b49cb7bf9d 100644--- a/test/thin-client-routing.test.ts+++ b/test/thin-client-routing.test.ts@@ -218,7 +218,7 @@ describe('routeThinClientCommand — (b) host-bound forms return false', () => {}});-describe('routeThinClientCommand — (c) malformed routable forms print usage and exit non-zero (2 for invalid_params)', () => {+describe('routeThinClientCommand — (c) malformed routable forms print usage + exit 1', () => {async function expectUsageExit(command: string, args: string[]): Promise<void> {const exitSpy = spyOn(process, 'exit').mockImplementation(((code?: number) => {throw new Error(`EXIT:${code}`);@@ -234,8 +234,7 @@ describe('routeThinClientCommand — (c) malformed routable forms print usage an}if (command === 'takes' && ['add', 'update', 'resolve', 'supersede'].includes(args[0])) {expect(exited).toBeNull();- // A3: invalid_params is a usage error, exit 2 (the persistence write lane used to return 1).- expect(currentExitCode()).toBe(2);+ expect(currentExitCode()).toBe(1);expect(errs.join('\n')).toContain('Error [invalid_params]');} else {expect(exited).toBe('EXIT:1');