Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(notices): wave-11 breaking rows first and short enough to survive the 2,000-character notice cap

garrytan4f0abcbc8f0d
diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.ts
index 7507f79243..a249aae372 100644
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@ -260,15 +260,16 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText }
{ since: '0.60.99.0', text: 'Fixable facts and takes fences are now rewritten instead of held or refused: managed sync, put_page and the fact and take writers normalize a fence whose meaning is unambiguous (a missing end marker after the table, two-dash takes markers, zero or duplicate row numbers, header aliases, invented kinds and enum synonyms, assistant holders, percent confidences) without changing a claim or an existing row number, and managed sync commits the rewritten file. Results report `fences_normalized`; `gbrain sync --dry-run` lists `would_normalize`. `gbrain config set fences.normalize false` turns it off (such fences are then held or refused).' },
{ since: '0.60.100.0', text: '`gbrain doctor` has a new `fence_integrity` check: it counts malformed facts and takes fences still waiting (held files, stored pages, unsynced checkout files) by the tier that would fix them, and warns when a source had 20 or more fences normalized in 7 days. Each doctor run scans stored pages and source checkouts for up to 10 seconds (`GBRAIN_DOCTOR_FENCE_TIMEOUT_MS`) and resumes where it stopped; until a scan finishes the check reports partial instead of ok. New settings `fences.repair.max_usd_per_page` (0.05) and `fences.repair.max_usd_per_day` (1.00) cap model fence repair.' },
{ since: '0.60.102.0', text: `Malformed facts and takes fences are now repaired automatically: the maintenance run repairs held files and stored pages on the owner host, and its first run after upgrading repairs every malformed fence it finds in each source, rewriting and committing those files (\`gbrain doctor --only fence_integrity\` counts them; \`gbrain repair fences\` previews the plan). A fence only a rewrite can realign sends just its header and those rows, never the rest of the page, to the repair model, within $0.30 per page and $1.00 per day (\`fences.repair.max_usd_per_page\`, \`fences.repair.max_usd_per_day\`); every rewrite passes validation gates before it is written. With \`models.fence_repair\` unset, the repair model is the first model the fence-repair eval measured as accurate enough that has a provider key on the brain host (\`gbrain models\` names it); with none, model repair stays off until the user sets \`models.fence_repair\`. ${FENCE_REPAIR_MEASURED} \`gbrain config set fences.repair.llm false\` keeps fence rows away from the model; \`gbrain config set fences.repair.enabled false\` pauses automatic repair. On a managed source each repaired file is committed, so \`git revert\` undoes it (page history keeps the earlier version); turning these settings off stops future repairs and does not undo past ones.` },
+ { since: '0.0.0-wave11', text: '`gbrain pages purge-deleted`, `cache clear|prune`, `schema use|downgrade|init|remove-*`, `integrity auto|reset-progress` and `search modes --reset` refuse an argument they would ignore (exit 2), and `--help` never runs them; preview with `gbrain pages purge-deleted --dry-run --json`.' },
+ { since: '0.0.0-wave11', text: '`gbrain pages purge-deleted` asks first: without a terminal it exits 3 with an ask_user payload naming the `--yes` command.' },
+ { since: '0.0.0-wave11', text: '`gbrain apply-migrations` exits 1 (`migrations_pending`) when it leaves the schema behind; run `gbrain apply-migrations --yes`, then `gbrain doctor --json` if that fails.' },
+ { since: '0.0.0-wave11', text: 'Remote put_page and put_pages content with no Timeline section is refused (`timeline_rows_would_be_removed`) when it would delete dated rows; keep the section or pass `drop_timeline: true`.' },
+ { since: '0.0.0-wave11', text: '`gbrain schema active --json` exits nonzero on `unknown_source` or `database_error`; check `gbrain sources list --json`.' },
+ { since: '0.0.0-wave11', text: '`gbrain waiting --json` and `open_loops`: loops with no counterparty move to `no_counterparty`, and each group lists at most 5 loops (`loops_omitted` counts the rest).' },
{ since: '0.0.0-wave11', text: 'Frontmatter validation and `--fix` no longer flag or rewrite valid YAML (a block-scalar line shaped like `Key: "a", then "b"`); a file an earlier `gbrain frontmatter validate --fix` rewrote can be restored from its backup under ~/.gbrain/backups/frontmatter/.' },
{ since: '0.0.0-wave11', text: 'Facts the sweep extracts from a saved session file are dated when the file was written, not when the sweep ran; facts saved earlier keep their dates.' },
- { since: '0.0.0-wave11', text: '`gbrain waiting --json` and MCP `open_loops` changed shape: loops that name no counterparty are no longer ranked as the person "unknown" but returned in `no_counterparty`, and each group lists at most 5 loops with `loops_omitted` counting the rest (`loop_count` stays the total).' },
{ since: '0.0.0-wave11', text: 'Link extraction no longer types a link to a person, meeting or calendar page as `works_at` (or a meeting/calendar link as `founded`/`invested_in`) from a nearby role phrase; it becomes `mentions`. Existing edges change on re-extraction: `gbrain extract --stale`.' },
{ since: '0.0.0-wave11', text: 'In-cycle dream patterns runs are sized to the cycle budget from the last run\'s recorded cost (`dream.patterns.last_run`): a first run submits at most 25 reflections, and a run that cannot fit `min_evidence` reflections is skipped as `insufficient_cycle_budget` before any spend; `gbrain dream --phase patterns` still runs at full size.' },
- { since: '0.0.0-wave11', text: '`gbrain pages purge-deleted`, `cache clear|prune`, `schema use|downgrade|init|remove-*`, `integrity auto|reset-progress` and `search modes --reset` refuse an argument they would ignore (exit 2) instead of running; `pages purge-deleted --source <id>` used to purge every source. Preview with `gbrain pages purge-deleted --dry-run --json`.' },
- { since: '0.0.0-wave11', text: '`gbrain apply-migrations` now exits 1 (`migrations_pending`) whenever it leaves the schema behind, which most runs used to report as exit 0; run `gbrain apply-migrations --yes`, or after a failed `--yes` run, `gbrain doctor --json`.' },
- { since: '0.0.0-wave11', text: '`gbrain schema active --json` now exits nonzero on `unknown_source` (an unregistered `--source`) or a degraded read (`database_error`: the brain database could not be read, so only the config.json answer is shown); check sources with `gbrain sources list --json` and the database with `gbrain doctor --json`.' },
- { since: '0.0.0-wave11', text: '`gbrain pages purge-deleted` asks before a hard purge: without a terminal it exits 3 with the consent payload, and the `--yes` command it names runs only after the user agrees. The autopilot purge is unchanged.' },
{ since: '0.0.0-wave11', text: 'An explicit `memory.auto_writeback off` now stops every ambient capture lane: the compaction harvest (PreCompact segments and OpenClaw compactions) and SessionEnd transcripts stop extracting too, and session text banked under off is never extracted later, even after writeback is turned back on. Unset keeps both lanes running. An unreadable, drifted or unrecognized setting now holds them instead of extracting. Restart `gbrain serve`, cron or autopilot sweeps and OpenClaw gateways started on an older version; `gbrain bootstrap harness --remove` stops the hooks from banking session text at all.' },
{ since: '0.0.0-wave11', text: 'On a managed canonical worktree the session hooks no longer start `gbrain sources push` (it refuses there; heartbeat reason `push_managed_coordinator`), backup check no longer counts gbrain\'s `.gbrain-owner.json` as uncommitted work and points managed roots at `gbrain sources writer status --probe --json`, a root with no origin remote reads `no_remote` even after a recorded push refusal, and doctor `bootstrap_push_health` reports ok once a recorded push failure\'s tree matches its origin branch.' },
{ since: '0.0.0-wave11', text: 'The MCP initialize instructions are reordered so harnesses that read only the first 2,048 characters (Claude Code) get the essentials: with ambient writeback on, a one-line writeback contract now sits in the memory clause (the full rules stay last), the error protocol follows the data-not-instructions clause in a shorter form, and the forget caveat moved after the scope clause.' },
@@ -277,7 +278,6 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText }
{ since: '0.0.0-wave11', text: '`gbrain bootstrap harness --remove` now also deletes Claude Code hook entries that lost their `_gbrain` marker when their command is exactly what this install wrote, and lists each one it removed; a lookalike it did not write is left in place and removal exits 1 with `harness_hook_unowned`. Re-running the install converges to one entry per event instead of adding a second set. `gbrain bootstrap harness --remove --dry-run` previews the removal without writing anything.' },
{ since: '0.0.0-wave11', text: '`gbrain repair <kind> --apply` and `gbrain doctor --remediate` now wait for each publication with the CLI write wait (`--wait`, `GBRAIN_WRITE_WAIT_MS`, `persistence.write_wait_ms`, else 30 s) instead of 5 s, so one run repairs a slow source; `--wait 0` stops at the first pending write and the rerun resumes.' },
{ since: '0.0.0-wave11', text: '`gbrain sources reconcile` now identifies a private fact row by its row number and claim, so a page whose world row shares a private row\'s claim publishes instead of being refused; it now also refuses a world row that copies a stored private row\'s context (24 or more characters) verbatim, naming only the row number.' },
- { since: '0.0.0-wave11', text: 'A remote put_page or put_pages entry whose content has no Timeline section is now refused with `timeline_rows_would_be_removed` when it would delete the page\'s dated entries; keep the section (get_page include_content:true) or pass `drop_timeline: true`. A local `gbrain put` without an expected revision keeps those rows; an explicitly empty `## Timeline` still deletes them, and every write that deletes rows reports `timeline_rows_removed` (count and dates).' },
{ since: '0.0.0-wave11', text: '`gbrain repair failed-writes` now replays subagent and restricted-namespace writes (they were all refused "via subagent requires ctx.subagentId"), under the original writer\'s stored authority re-checked against its live grant; replayed writes are attributed to that original writer.' },
{ since: '0.0.0-wave11', text: 'Inline `[Source: ..., date]` citations no longer file an adjacent HTML comment (such as `<!-- AUTO:slack END -->`) as a timeline entry, and a timeline row carrying comment markup is never written back into a page (it would duplicate a section END marker); `gbrain repair timeline-comments --source <id>` previews and cleans rows and bullets stored before this release.' },
{ since: '0.0.0-wave11', text: 'On a managed brain, `gbrain files upload-raw` of a small file now refuses before creating anything (it used to leave an empty `.raw/` directory); configure a storage backend and use `gbrain files upload <file> --page <slug>`.' },
diff --git a/test/behavior-change-notice.test.ts b/test/behavior-change-notice.test.ts
index 523a5f7369..529fe2cdfa 100644
--- a/test/behavior-change-notice.test.ts
+++ b/test/behavior-change-notice.test.ts
@@ -38,6 +38,7 @@ import {
takeHttpBehaviorNotice,
takeLocalBehaviorNotice,
} from '../src/core/behavior-change-notice.ts';
+import { cliRenderContext, renderNotice } from '../src/core/agent-output.ts';
import { VERSION } from '../src/version.ts';
import { checkBehaviorChanges } from '../src/commands/doctor/checks/behavior-changes.ts';
import { dispatchToolCall } from '../src/mcp/dispatch.ts';
@@ -468,3 +469,26 @@ describe('fence rows (#6188 D25, D26)', () => {
});
});
});
+
+describe('fix wave 11 rows inside the notice length cap', () => {
+ const BREAKING = [
+ 'gbrain pages purge-deleted --dry-run --json',
+ 'exits 3 with an ask_user payload',
+ 'gbrain apply-migrations --yes',
+ 'drop_timeline: true',
+ 'gbrain sources list --json',
+ 'no_counterparty',
+ ];
+
+ test('an upgrade into the wave sees every breaking row and its replacement command within the rendered 2,000 characters', () => {
+ const first = BEHAVIOR_CHANGES.findIndex(c => typeof c.text === 'string' && c.text.includes(BREAKING[0]!));
+ expect(first).toBeGreaterThan(0);
+ const after = BEHAVIOR_CHANGES[first - 1]!.since;
+ const notice = behaviorChangesNotice(null, { after });
+ expect(notice).not.toBeNull();
+ const rendered = renderNotice(notice!, cliRenderContext()).why;
+ expect(rendered.length).toBeLessThanOrEqual(2_000);
+ for (const command of BREAKING) expect(rendered).toContain(command);
+ expect(notice!.why).toContain('gbrain doctor --only behavior_changes shows this again.');
+ });
+});