Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

docs: post-release audit for the v0.47.6.0 community fix wave (#4701 follow-up) (#4703)

Garry Tan7b7921d86141
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75fc20c745..93eaa8e313 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -65,6 +65,9 @@ contributor fixes land with full credit.**
- **`gbrain models` now reports the dream extract-atoms route**
(`models.dream.extract_atoms`) with the same narrow resolver the runtime
uses, so the dashboard can't disagree with actual routing.
+- **The conversation-parser nightly probe reports the real blocker.** When no
+ chat model is available it says so, instead of misreporting a missing
+ Anthropic key (thanks @ruiwang20010702, #4639).
- **Dead-reranker latency removed ahead of the provider sunset.** The default
hosted reranker's provider shuts down on 2026-09-04; past that date the
search path skips the dead call entirely (no more multi-second timeout per
diff --git a/TODOS.md b/TODOS.md
index 241c84b564..295ceb7102 100644
--- a/TODOS.md
+++ b/TODOS.md
@@ -4196,7 +4196,11 @@ follow-ups, captured here so v0.42 starts informed.
`embedding_coverage`. Requires repro of the original 890K embed failure
on current code FIRST to confirm whether it's batch-overflow vs
single-oversized-chunk vs token-estimate-miss. Effort: human ~2 days /
- CC ~3 hours.
+ CC ~3 hours. SCOPE NARROWED (v0.47.x fix wave): the single-oversized-chunk
+ branch is now healed in place by `src/core/embed-oversize-heal.ts`
+ (split-on-detect, shared by CLI embed + embed --stale), so that case no
+ longer perma-fails a stale sweep; remaining scope is batch-overflow /
+ token-estimate-miss + `TokenLimitError` quarantine.
- [ ] **v0.42 P1 — Source-repo remediation surface.** Codex r1 #7
caught: cleanup CLI that deletes DB rows doesn't fix source of truth
diff --git a/docs/architecture/KEY_FILES.md b/docs/architecture/KEY_FILES.md
index 1a04361402..d0ea4727ed 100644
--- a/docs/architecture/KEY_FILES.md
+++ b/docs/architecture/KEY_FILES.md
@@ -306,6 +306,7 @@ per-release `**vX.Y.Z:**` narration — CI enforces this
- `src/core/minions/handlers/subagent-audit.ts` — JSONL audit + heartbeat writer at `~/.gbrain/audit/subagent-jobs-YYYY-Www.jsonl`. Events: `submission` (one per submit) + `heartbeat` (per turn boundary: `llm_call_started | llm_call_completed | tool_called | tool_result | tool_failed`, plus the oneshot markers `oneshot_fallback | oneshot_timeout`; oneshot-path events carry `mode: 'oneshot'` and fallback events a `reason` — both rendered by `gbrain agent logs`). Never logs prompts or tool inputs. `readSubagentAuditForJob(jobId, {sinceIso})` is the readback for `gbrain agent logs`.
- `src/core/minions/rate-leases.ts` — lease-based concurrency cap for outbound providers (default key `anthropic:messages`, max via `GBRAIN_ANTHROPIC_MAX_INFLIGHT`). Owner-tagged rows with `expires_at` auto-prune on acquire; `pg_advisory_xact_lock` guards check-then-insert; CASCADE on owning job deletion. `renewLeaseWithBackoff` retries 3x (250/500/1000ms). Canonical home of `RateLeaseUnavailableError` (thrown when acquire finds no slot; the worker and the inline dream drain both recognize it and requeue WITHOUT burning an attempt — lease-full is a scheduling condition, not a failure; `subagent.ts` re-exports it for compatibility) and `leaseFullBackoffMs()` (the shared 1–3s jittered lease-full requeue backoff `worker.ts` and `inline-drain.ts` both use, so the two curves cannot silently desync).
- `src/core/minions/handlers/contextual-reindex-per-chunk.ts` — per-page contextual re-embed handler. Resolves `models.contextual_synopsis` once and isolates cross-worker leases by the full resolved model id. `GBRAIN_CONTEXTUAL_SYNOPSIS_RPM` controls the cap; `GBRAIN_CONTEXTUAL_HAIKU_RPM` is the compatibility alias.
+- `src/core/minions/handlers/embed-backfill.ts` — `embed-backfill` job handler (the deferred lane behind sync's cost gate). Cap ladder for `embed.backfill_max_usd`: a present-but-invalid value (`0`, negative, garbage) is `misconfigured` and FAILS CLOSED to the $10 default, which is never dropped; only the IMPLICIT default cap is lifted (uncapped-with-warning to stderr) when the embedding model is unpriceable via `isModelPriceable` + `pricing.overrides`; the off tokens (`off`/`unlimited`/`none`) remove the ceiling. Single-flights via the same per-source lock key as CLI `embed --stale` (`embed-backfill-lock.ts`). Carries the progress-keyed stall watchdog arm: progress = banked `embedded + chunksProcessed`; a stall aborts the drain and throws `stall_timeout` so the queue fails the job and the resumable cursor re-runs.
- `src/core/minions/wait-for-completion.ts` — poll-until-terminal helper for CLI callers. `TimeoutError` does NOT cancel the job; `AbortSignal` exits without throwing. Default `pollMs`: 1000 on Postgres, 250 on PGLite inline.
- `src/core/minions/transcript.ts` — renders `subagent_messages` + `subagent_tool_executions` to markdown. Tool rows splice under their owning assistant `tool_use` by `(message_idx, tool_use_id)` — raw provider tool ids may repeat across turns, so `tool_use_id` alone is not an identity; echoed `tool_result` blocks check ownership against the nearest preceding assistant turn's key. UTF-8-safe truncation; unknown block types fall through to fenced JSON.
- `src/core/minions/plugin-loader.ts` — `GBRAIN_PLUGIN_PATH` discovery. Absolute paths only, left-wins collision, `gbrain.plugin.json` with `plugin_version: "gbrain-plugin-v1"`, plugins ship DEFS only (no new tools), `allowed_tools:` validated at load time against the derived registry.
@@ -537,7 +538,8 @@ unresolvable+true|false, pre-v80 NULL/NULL rows survive).
- `src/core/think/prompt.ts` — anti-bias rewrite. `withCalibration` option on `buildThinkSystemPrompt` adds anti-bias rules. `buildCalibrationBlock()` emits the `<calibration>` XML. `buildThinkUserMessage` has TWO shapes: default (question first), and with-calibration (retrieval → calibration → question) when opt-in. Wired into `runThink` via `opts.withCalibration` + `opts.calibrationHolder`.
- `src/commands/calibration.ts` — CLI: `gbrain calibration` (read + print), `--regenerate`, `--undo-wave <ver>`, `ab-report`. MCP op `get_calibration_profile` (scope: read) backs the same data path. Source-scoped via `sourceScopeOpts(ctx)`.
- `src/core/owner-holder.ts` — single source of truth for "the brain owner" holder string. `DEFAULT_OWNER_HOLDER = 'self'` (matches the consolidate facts→takes writer + `docs/takes-vs-facts.md`); `resolveOwnerHolder({override, configValue})` returns override > `emotional_weight.user_holder` config > `'self'`. Consumed by the calibration_profile cycle phase, `gbrain calibration` CLI, the `get_calibration_profile` op, `think`'s calibration block, `emotional-weight`'s `DEFAULT_USER_HOLDER`, and doctor's `calibration_freshness`. Pure; unit-tested in `test/owner-holder.test.ts`. Does NOT unify owner-identity fragmentation (`self`/`brain`/`people-<owner>`) — tracked separately.
-- `src/commands/takes.ts` — `gbrain takes revisit <slug>` opens $EDITOR on the source page with a `<!-- gbrain:revisit -->` cursor marker.
+- `src/commands/takes.ts` — the full `gbrain takes` subcommand dispatcher (list/search/embed/add/update/supersede/resolve/propose/scorecard/calibration/extract/revisit). `takes list --limit N --offset N` validates integers at the CLI; the engine clamps limit (default 100, cap 500) and floors offset at 0. `takes revisit <slug>` opens $EDITOR on the source page with a `<!-- gbrain:revisit -->` cursor marker.
+- `src/core/take-proposals.ts` — owns the `take_proposals` queue's row contract. `normalizeTakeProposalRow` coerces Postgres driver BigInt/string values (`id`, `weight`, `promoted_row_num`) to numbers at the query boundary so both engines return the same numeric row shape.
- `admin/src/pages/Calibration.tsx` — Calibration tab. Single-column layout. `<TrustedSVG>` wrapper handles `dangerouslySetInnerHTML` for the server-rendered SVG.
- `admin/src/index.css` — `--text-muted: #777` (WCAG AA contrast bump to ~5.5 on the #0a0a0f bg).
- `test/fixtures/calibration/extract-takes-corpus/` — synthetic prompt-tuning corpus. Ships 5 representative pages; full 50-page + 10-page holdout generated by `gbrain calibration build-corpus`. All anonymized per CLAUDE.md placeholder list.
diff --git a/docs/architecture/RETRIEVAL.md b/docs/architecture/RETRIEVAL.md
index 3aeb8bded8..4077aeb88a 100644
--- a/docs/architecture/RETRIEVAL.md
+++ b/docs/architecture/RETRIEVAL.md
@@ -58,7 +58,7 @@ Hybrid search applies a source-factor CASE expression at the SQL layer (lives in
`archive/` is deliberately NOT hard-excluded (issue #1777): it holds high-signal historical content users expect to find, so it is demoted (`0.5x` in `DEFAULT_SOURCE_BOOSTS`), not hidden. The demote is a prior applied in the outer SQL re-rank; the cross-encoder reranker (balanced/tokenmax modes) can still PROMOTE an archive page that survives the demote into the rerank candidate window — it is not an unconditional suppression. `gbrain doctor`'s `hidden_by_search_policy` check reports how many chunked pages remain hidden by the surviving exclude prefixes.
-The boost map is configurable via `GBRAIN_SOURCE_BOOST` env var or per-call `SearchOpts.exclude_slug_prefixes`. Temporal queries (`detail: 'high'`) bypass the boost so chat pages re-surface for time-sensitive lookups.
+The boost map is configurable via the `GBRAIN_SOURCE_BOOST` env var. Hard exclusions are separate: the exclusion set is defaults ∪ `GBRAIN_SEARCH_EXCLUDE` (env, comma-separated prefixes) ∪ per-call `SearchOpts.exclude_slug_prefixes`. Temporal queries (`detail: 'high'`) bypass the boost so chat pages re-surface for time-sensitive lookups.
## Named-thing retrieval (per-page pool + title + alias + evidence)
diff --git a/docs/operations/spend-controls.md b/docs/operations/spend-controls.md
index 8b5e615e1c..2770a5848c 100644
--- a/docs/operations/spend-controls.md
+++ b/docs/operations/spend-controls.md
@@ -44,7 +44,8 @@ The USD-limit knobs accept `off`, `unlimited`, or `none` (case-insensitive) to m
`embed.backfill_max_usd` specifically, any present-but-invalid value (`0`, a
negative, garbage text) is treated as a typo'd cap: the $10 default applies and is
**never dropped**, even for unpriced models (see "Default caps vs unpriced models"
- below). Only `off` removes that ceiling.
+ below). Only the off tokens (`off`/`unlimited`/`none`, case-insensitive) remove
+ that ceiling.
- Internally "no limit" is the string `unlimited` in any printed/JSON output and "no
cap" inside the budget tracker — never a raw `Infinity` (which would serialize to
`null` in ledger rows).
@@ -85,9 +86,12 @@ underestimate an explicit working-tree run.
Behavior above the floor:
- **TTY:** prompts `[y/N]`.
-- **Non-interactive (cron/agent):** **auto-defers** embeds to capped backfill jobs and
- exits 0 — it never wedges the pipeline. The backlog drains via the jobs worker or
- `gbrain embed --stale`. Pass `--yes` to embed inline instead.
+- **Non-interactive (cron/agent):** **auto-defers** embeds (rows stay stale; exits 0 —
+ it never wedges the pipeline). A capped backfill job is submitted only when a
+ worker-backed surface exists; otherwise the result reports
+ `manual_drain_required` (`reason: no_worker_surface` on PGLite/no-worker setups, or
+ `auto_submit_disabled`) with the paste-ready drain command. The backlog drains via
+ the jobs worker or `gbrain embed --stale`. Pass `--yes` to embed inline instead.
Output format splits on the explicit `--json` flag: `--json` emits a structured
envelope; otherwise human text. Every gate message carries paste-ready knobs.
diff --git a/skills/migrations/v0.46.3.0.md b/skills/migrations/v0.46.3.0.md
index 19b81d1119..f6dc27848f 100644
--- a/skills/migrations/v0.46.3.0.md
+++ b/skills/migrations/v0.46.3.0.md
@@ -153,7 +153,9 @@ writes each to its right plane; you only need to know this when doing it by
hand.
Without a working reranker, reranking fails open after the shutdown date —
-search still works, ordering quality drops, and each search pays the timeout.
+search still works, ordering quality drops. Past the shutdown date gbrain
+skips the rerank call entirely (one-time stderr notice + a
+`sunset_short_circuit` audit row), so searches pay no timeout.
## Step 4 — custom embedding columns (rare)
diff --git a/skills/skills.lock.json b/skills/skills.lock.json
index 94eaf01ff1..b755ae5737 100644
--- a/skills/skills.lock.json
+++ b/skills/skills.lock.json
@@ -131,7 +131,7 @@
"migrations/v0.40.3.0.md": "5f500f8c543c2b6f41778b0bd3beedada68f7284f7933ad8b769322b433a8fe9",
"migrations/v0.40.5.md": "b9837d52a030517698dfb31c439f562cde60a1015ae488dab09be2c16ff182e5",
"migrations/v0.41.11.0.md": "5c6873ab969d14def4a450d792f070f1259d08b3aca43bc7825d0a9114b2b36b",
- "migrations/v0.46.3.0.md": "0438f52f423b8f99832d0098fde94188af38eff603a956c67014e5e9bb8572f6",
+ "migrations/v0.46.3.0.md": "e00cb0609d4bee53749c6cbf4d7f17606649b99688c4a452e5054e8e7b67c00a",
"migrations/v0.46.35.0.md": "145c841d89c4b6b6f7089126354fae272df7db6ceaf9cfcec2797d3301cdab57",
"migrations/v0.5.0.md": "5e0dabc451595295c4d971e19bcb33c258a127223d25859d8321cb7e1ce60711",
"migrations/v0.7.0.md": "97c2740445a10b1c5c7123c17dbd625fa27a94095b85d27c2b278da756c4c59a",