Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(bootstrap): gate harness subcommand on --help / -h / help (#5488, #5782)

garrytanb34c06d6ddbb
diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsv
index d091d440c0..6d544473bb 100644
--- a/scripts/module-size-limits.tsv
+++ b/scripts/module-size-limits.tsv
@@ -28,7 +28,7 @@ src/core/minions/queue.ts 2522 ratchet grown #4078 + megawave probe-liveness unl
src/commands/init.ts 1932 ratchet grown v0.46.x keyless capability notices; grown db-availability loop: initPostgresCore typed-failure extraction + --prefer-postgres ladder hook + pgvector rethrow fix; +1 at megawave/wave-k merge; +master-merge true-up; wave-k: merge; #3753 --force re-init engine-preservation guard; +1 wave-k merge-union brace (--prefer-postgres close); +10 ambient-writeback WP8: runWritebackNudge consent ask in both engine epilogues (logic lives in core/onboard/writeback-nudge.ts); +4: v0.48.2 reranker readiness at init + test seam; +1: v0.48.2 provider normalization; +3: v0.48.2 review fixes; master integration: +2: preserve typed PGLite busy errors in schema-only init; shared-skills integration on company-ingestion base; retired provider integration removed; retain stored-vector identity on re-init
src/commands/integrations.ts 1739 ratchet grown v0.46.26.0 megawave (#4039 connector compat) + 1 nosemgrep dataflow annotation (path-traversal audit); wave-k: exported heartbeatPath seam (#3900)
src/core/minions/handlers/subagent.ts 1918 ratchet merged: master v131 settle rework + dream-wave C5 peel + C6 accounting + C7 lease heartbeats/lost-lease aborts + C9 oneshot dispatch + adversarial fix batches; grown by #4078 subagent-loop capability fix; +6 lines (reasoning-item replay: adaptContentBlocksToChatBlocks handles 'reasoning' blocks); +3 wave G #4514: Anthropic-via-OpenRouter allowed on the subagent loop; +36 lines (code review, same PR): isPromptTooLongError walks a bounded .cause chain so it still matches post-normalizeAIError() wrapping, plus extractPromptTooLongDetail so the dead-lettered job's error carries the matched provider detail instead of the generic normalizeAIError() wrapper text; master integration: harness support: boundary wiring to shared grants, isolated setup, withdrawal and delegated guards; #5105: +13 call-site wiring to shared tool-write-identity helper across fresh and replay dispatch
-src/commands/bootstrap.ts 2115 ratchet grandfathered at merge (grew past the 1500 cap on master); raised for #4066 HOME_WORKSPACE_GUARD_EXEMPT (status/uninstall/harness); +5 for the harnessDetect test seam (bulk lives in core/bootstrap/harness.ts); +23 for the contract subcommand dispatcher glue (#4105 absorb — bulk lives in core/bootstrap/contract.ts); +codex hooks-consent gate + mcp+hooks receipt registration + uninstall arm; +42 ambient-writeback WP8: interview-time SURFACE_MULTIUSER audience apply (pre-init ordering) + applyDeclaredAudienceFromInterview; +3 #4897 harness usage clause documenting --source ID semantics
+src/commands/bootstrap.ts 2126 ratchet grandfathered at merge (grew past the 1500 cap on master); raised for #4066 HOME_WORKSPACE_GUARD_EXEMPT (status/uninstall/harness); +5 for the harnessDetect test seam (bulk lives in core/bootstrap/harness.ts); +23 for the contract subcommand dispatcher glue (#4105 absorb — bulk lives in core/bootstrap/contract.ts); +codex hooks-consent gate + mcp+hooks receipt registration + uninstall arm; +42 ambient-writeback WP8: interview-time SURFACE_MULTIUSER audience apply (pre-init ordering) + applyDeclaredAudienceFromInterview; +3 #4897 harness usage clause documenting --source ID semantics; +11 #5488: SUBCOMMAND_HELP harness entry (gate on --help / -h / help) — CLI help line, cannot move
src/core/minions/worker.ts 1764 ratchet grandfathered at merge (grew past the 1500 cap on master, #4170); grown v0.46.11.0 five-issue wave; security: durable queued authority and confined filesystem dispatch; typed readiness, configuration-blocked lifecycle and bounded release; post-validation readiness publication and confirmed isolated-execution stop evidence; latch typed lock-renewal faults before generic retry
src/commands/sources.ts 2013 ratchet +6 fix wave 5 #5409: mirror-readonly/mirror-writable dispatch, help rows and the list --json mirror_read_only field (body in sources-mirror.ts); grown v0.46.22.0 phone wave: github source kind (#4104); +129 v0.47 gmail-loops: google source-kind flags + vault preflight + duplicate-account warn + access-mode validation; +8 set-path dispatch + help rows (#4739 — command body peeled to sources-set-path.ts); +29 #4698 adoption: --calendar-id flag + duplicate-account warn scoped to overlapping services; #5105: trusted writer administration route; company handlers and receipt status wiring; parsing stays in dedicated modules; canonical reconciliation: +5 engine-free sibling-command dispatch and help row, implementation remains in source-reconcile.ts; +4 fix wave 3 lane A: sources status connector recovery state and run counts (view lives in persistence/connector-status.ts); +3 fix wave 4 lane B: sources retry-held dispatch and help row (command body in sources-retry-held.ts) and the connector first-sync note on add; bodies in source-delete.ts and sources-set-path.ts)
src/core/link-extraction.ts 2143 ratchet grown v0.46.26.0 megawave: link-aware timeline split + delimiter-outside-links (#3957 #4062 #3737); +37 wave-k #3908 reimpl: isCrossSourceLinksEnabled config ladder; +10 wave #4277: parseTimelineEntries skips generated backlink receipts; +17 #4855: latin-fold in normalizeBasename + dir-hint step tries both slug grammars; +17: #4855 Latin stroke-letter fold; +5: #4873 ./-relative markdown links kept as live references; +34 wave review: `../y.md` sibling links resolve on the DB path + folded bare-wikilink grammar (#4873 class); +62 #4977: role-prior suppression in machine-list sections (rolePriorSuppressedRanges, EntityRef.index); +3 composed with #4985 (variation-selector strip) in the same wave; +4 #4995: markdown-link anchor strip + lowercase-candidate rationale comments; +6 pre-landing review: #4977 suppression on code-stripped content + truthful watermark/section-list comments; T2: source-qualified inference and atomic origin-scoped derived links; canonical attendance evidence, source-qualified orientation, strict attendee resolution, and relocated filesystem link scanner (command export preserved); +4: pack-owned fallback and ambiguous attendee guards Display-label attendance exclusion, indexed evidence membership, and bounded strict resolver caching; attendance-boundary review.; complete attendance resolution and fence-safe evidence traversal; frontmatter discovery, canonical basename admission and code-aware attendance comment masking; exclude inline HTML comment spans from admitted attendance ranges; +17 write-path wave: same-name rule for entity fuzzy matches + rename-alias fallback in makeResolver; +1 #5567: materialized marker ends bullet detail; +30 #5749: unique global-basename step before fuzzy and live keyword resolution (ResolveOptions, watermark note); #5765: bold **Attendees:** label accepted + LINK_EXTRACTOR_VERSION_TS bump note; +10 eval-wave N9-2/N9-3/N12-7: pack frontmatter mappings inherit FRONTMATTER_LINK_MAP direction, page-type-bound pack attended follows canonical attendance, LINK_EXTRACTOR_VERSION_TS bump note
diff --git a/src/commands/bootstrap.ts b/src/commands/bootstrap.ts
index b74ac80022..5ecef2a4b8 100644
--- a/src/commands/bootstrap.ts
+++ b/src/commands/bootstrap.ts
@@ -203,6 +203,17 @@ const SUBCOMMAND_HELP: Record<string, string> = {
interview:
'gbrain bootstrap interview --init | --set KEY "value" | --skip KEY | --status | --show | --confirm <hash>\n' +
' Create/record/read interview state. See `gbrain bootstrap --help` for the per-flag description.',
+ // #5488: `gbrain bootstrap harness --help` previously fell through into the
+ // real apply because harness was missing from SUBCOMMAND_HELP. Without this
+ // entry the dispatch's `Object.hasOwn(SUBCOMMAND_HELP, sub)` guard was
+ // false, so `--help` after the subcommand name ran the harness apply path.
+ harness:
+ 'gbrain bootstrap harness [--harness claude-code|codex|opencode|all] [--url U | --port N] [--source ID]\n' +
+ ' [--token-name NAME | --token TOK] [--name MCPNAME] [--project DIR]...\n' +
+ ' [--no-hooks] [--no-capture] [--force] [--status] [--remove] [--yes] [--json]\n' +
+ ' Wire framework-spawned Claude Code / Codex / opencode sessions to a RUNNING `gbrain serve --http`\n' +
+ ' on this box (#4043). Idempotent; --remove tears it down. (--local is an accepted no-op alias.)\n' +
+ ' See `gbrain bootstrap --help` for the per-flag description.',
};
/**
diff --git a/test/bootstrap-subcommand-help.serial.test.ts b/test/bootstrap-subcommand-help.serial.test.ts
index eaf3a4b759..56581b190c 100644
--- a/test/bootstrap-subcommand-help.serial.test.ts
+++ b/test/bootstrap-subcommand-help.serial.test.ts
@@ -206,6 +206,42 @@ describe('bootstrap <subcommand> --help/-h/help never runs the real operation',
expect(statSync(receiptPath(home)).mtimeMs).toBe(mtimeBefore);
});
+ // #5488: `harness` was missing from SUBCOMMAND_HELP, so the dispatch's
+ // `Object.hasOwn(SUBCOMMAND_HELP, sub)` guard was false and `--help` after
+ // `bootstrap harness` fell through into the real harness apply. The runner
+ // records every ExecRunner call an unguarded harness would make (claude /
+ // codex / opencode MCP registration, lifecycle hook install); on a clean
+ // fixture zero calls must land and the help text must print.
+ test('harness --help: usage text, exit 0, zero exec calls (#5488)', async () => {
+ const { runner, calls } = makeRunner();
+
+ const r = await capture(() => runBootstrap(['harness', '--workspace', ws, '--help'], { runner }));
+
+ expect(r.result).toBe(0);
+ expect(r.out).toContain('Wire framework-spawned');
+ expect(calls.length).toBe(0);
+ });
+
+ test('harness help (bare word, no dashes): usage text, exit 0, zero exec calls (#5488)', async () => {
+ const { runner, calls } = makeRunner();
+
+ const r = await capture(() => runBootstrap(['harness', '--workspace', ws, 'help'], { runner }));
+
+ expect(r.result).toBe(0);
+ expect(r.out).toContain('Wire framework-spawned');
+ expect(calls.length).toBe(0);
+ });
+
+ test('harness -h: same interception (#5488)', async () => {
+ const { runner, calls } = makeRunner();
+
+ const r = await capture(() => runBootstrap(['harness', '--workspace', ws, '-h'], { runner }));
+
+ expect(r.result).toBe(0);
+ expect(r.out).toContain('Wire framework-spawned');
+ expect(calls.length).toBe(0);
+ });
+
describe('uninstall --help (isolated home + a real receipt-tracked file that must survive)', () => {
function seedUninstallFixture(): { uninstallWs: string; isolatedHome: string; dummyCreatedPath: string } {
const uninstallWs = mkdtempSync(join(tmpdir(), 'gb-subhelp-uninstall-ws-'));