Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
chore(release): unstamp onto master v0.60.708.0; versions are written at release
garrytana8f72ee8959b
diff --git a/behavior-changes.d/code_rechunk_module_elixir_8128.md b/behavior-changes.d/code_rechunk_module_elixir_8128.mdnew file mode 100644index 0000000000..17303ac592--- /dev/null+++ b/behavior-changes.d/code_rechunk_module_elixir_8128.md@@ -0,0 +1 @@+Code sync re-chunks TypeScript, TSX, JavaScript, Python, Ruby and Elixir files once (a per-language chunker revision): top-level code with no named definition (anonymous default exports, top-level `if`/`for`/`try`, Python's `__main__` block) becomes `<file>::__module__` chunks with call edges, and Elixir modules and functions become named definitions that `code-def` and `code-callers` find. The sync cost gate prices only those files.diff --git a/behavior-changes.d/db_link_child_folder_6983.md b/behavior-changes.d/db_link_child_folder_6983.mdnew file mode 100644index 0000000000..074bda34e9--- /dev/null+++ b/behavior-changes.d/db_link_child_folder_6983.md@@ -0,0 +1 @@+On the DB link path (`gbrain extract links --source db` and automatic link backfills), a `.md` link with a folder and no `./` or `../` prefix (`[x](notes/a.md)`) now resolves against the linking page's folder first, then its parent folders, then the brain root, matching `--source fs`. Where both a child page and a root page exist, the edge now points at the child.diff --git a/behavior-changes.d/github_item_webhook_backlog_8799.md b/behavior-changes.d/github_item_webhook_backlog_8799.mdnew file mode 100644index 0000000000..79bc13e741--- /dev/null+++ b/behavior-changes.d/github_item_webhook_backlog_8799.md@@ -0,0 +1 @@+A GitHub webhook for an item event (issue, pull request, comment, review, check) now answers HTTP 429 `webhook_backlog_full` with `Retry-After: 30` when 50 item jobs are already waiting for that source and none of them covers the event; it used to answer 202 with another item's job while the event was dropped. GitHub does not redeliver a 429 on its own: redeliver it from the webhook's Recent Deliveries, or let the next sweep or `gbrain sync --source <id>` catch it.diff --git a/behavior-changes.d/physical_root_moved_8625.md b/behavior-changes.d/physical_root_moved_8625.mdnew file mode 100644index 0000000000..04006a7e67--- /dev/null+++ b/behavior-changes.d/physical_root_moved_8625.md@@ -0,0 +1 @@+On a managed brain, a checkout moved to a new path (or whose parent folder was renamed) is now named: `gbrain sources add`, `gbrain sources set-path` and `gbrain sources writer claim` refuse with `recovery_required`, detail `physical_root_moved`, naming the recorded path, the worktree and the commands that bring it back, instead of a generic identity error (add, claim) or detail-less `source_checkout_missing` (set-path). Their `--dry-run` now refuses as the real run does: before, the add, claim and set-path dry runs of a moved checkout, the add and claim dry runs of a folder holding a copied ownership stamp, and the set-path dry run of a missing checkout exited 0. Nothing about ownership changed; the dry runs still write nothing.diff --git a/behavior-changes.d/remote_think_host_model_gbra437.md b/behavior-changes.d/remote_think_host_model_gbra437.mdnew file mode 100644index 0000000000..5a7421a2a1--- /dev/null+++ b/behavior-changes.d/remote_think_host_model_gbra437.md@@ -0,0 +1 @@+A remote `think` (MCP, HTTP or a thin client) now runs on the brain host's think model (`models.think`, then `models.default`) unless the host lists the requested `model` in the new `think.remote_models` key (comma-separated, empty by default). An unlisted model, or a listed one the host cannot run, no longer fails the call with the explicit-model error: the host model answers, `warnings` carries `MODEL_OVERRIDE_IGNORED:not_allowed` or `:unusable`, and the result carries a `model_override_ignored` notice. Remote `rounds` runs one round. The local CLI `--model` is unchanged, and a keyless brain answers as before.diff --git a/behavior-changes.d/webhook_capture_no_default_fallback_gst2113.md b/behavior-changes.d/webhook_capture_no_default_fallback_gst2113.mdnew file mode 100644index 0000000000..c397bd52f7--- /dev/null+++ b/behavior-changes.d/webhook_capture_no_default_fallback_gst2113.md@@ -0,0 +1 @@+A webhook capture (`POST /ingest` and its `ingest_capture` job) whose credential's write source is archived, unregistered or removed before the capture lands now fails the job with `source_changed` (`detail: webhook_source_unavailable`) and writes nothing. Before, it was written under `default`, a source the credential may not be granted, and could replace a page there. Restore the source and run `gbrain jobs retry` on the job. Captures that do not come from a webhook keep the `default` fallback.diff --git a/changelog.d/gbra414-train-c.md b/changelog.d/gbra414-train-c.mdnew file mode 100644index 0000000000..dd388fc370--- /dev/null+++ b/changelog.d/gbra414-train-c.md@@ -0,0 +1,166 @@+**Gmail threads you purged stay purged, forwarded emails keep their body, live facts stay in recall, the MCP request log can be capped without losing its totals, a remote `think` runs on the host's own model, a moved brain folder names its way back, and more fixes across connectors, transcripts, facts, takes, links and code search.**++Gmail's change feed reports a thread whenever anything on it changes, a label or a read flag, however old the mail is. gbrain imported every one of them, so a mailbox set to 90 days of history could gain years of old threads. Those threads now stay out, the same way the first backfill keeps them out. A purged Gmail thread that the change feed delivers again no longer writes its subject and quoted text back into open loops, on managed and unmanaged sources alike. Forwarded emails used to be saved with only the note typed above the "Forwarded message" line, or empty, because that line was read as the start of a quoted reply. The forwarded message is now kept. Two unmanaged Google cases that ended as held items only a person could clear now sync cleanly. One is a page whose checkout file was missing only gbrain's Facts table after one of its facts was forgotten, and the other is an item whose page the owner purged while Google kept listing it (it is skipped and stays purged).++On a GitHub source with a webhook, a refresh waiting for one issue swallowed the event for any other issue of the same source, and deleting an issue right after editing it refetched the page instead of removing it. Each item event now gets its own refresh or delete.++Fact extraction and capture now record who said what, and where a page came from, more faithfully. Lines you quote with `>` in a turn are no longer saved as your own facts, a Claude Code Remote Control session is yours rather than an agent's, facts that open with a log word ("Notes from", "Watched") link to the one entity they name, a facts batch refused for a stale embedding config lands once the write owner restarts with the fixed config, `transcripts ingest --facts --json` reports a budget stop instead of reading complete, a remote timeline entry, link or tag no longer overwrites how its page entered the brain, and a live fact whose context note happens to read "superseded by #N" is no longer hidden as superseded. The speaker labels "User" and "Assistant" no longer block a fact from linking to the person it names.++Paging through takes no longer repeats or skips takes that were written together, and rebuilding takes from a page keeps the "superseded by" link on struck takes. `gbrain takes propose --accept` no longer needs `--dir` and prints the accepted claim, and accepting a proposal that supersedes a fact works on a segmented entity page. `gbrain reconcile-links --source <id>` now links the pages of that source instead of reporting `ok` with no edges on a brain with named sources, and a write failure other than a missing code page now fails the run. Timeline entries built from inline `[Source: …]` citations keep the filenames, IDs and hashes written in backticks. Old timeline rows that an earlier parser split at a hyphen (`foo-bar.de` stored as `foo` / `bar.de`) are now removed by sync and `gbrain extract timeline --prune-orphans` instead of sitting next to the correct row forever. One "portfolio" in a Facts fence or Timeline row no longer types every person-to-company link on the page as an investment.++Hermes transcript snapshots no longer fail while Hermes is writing, and `gbrain transcripts ingest --all` keeps each file's discovered format. A managed `gbrain import` with `sync.write_through` off refuses once before admitting anything, `gbrain connectors sync --dry-run` writes no state, and a connector re-render keeps the `trust_tier` marker that `gbrain repair provenance` stamped, so doctor stops listing those pages again after every import. Open loops no longer gain a twin when the model rewords a loop's text over the same quoted line, `withheld_noise` lists every sender in JSON, more no-reply sender spellings count as noise, and `gbrain google status` probes Contacts with a call the read-only Contacts permission covers. Doctor's `atom_provenance_drift` no longer flags an edit that left the page body unchanged.++Ten contributor bug fixes from community wave 1 (#8149) and the #8128 follow-up waves A (#8323) and C (#8328) are rebuilt on current master: atoms follow a renamed origin page, a tombstone purge never removes a root sync metafile, nested config credentials stay hidden, a very long tag gets a clear refusal, the DB link path keeps links to child pages, and code search finds top-level callers and Elixir definitions. Each fix keeps its regression test, and the contributor credits stay with the people who found and diagnosed each problem.++**You can now cap the MCP request log's size without losing the dashboard's totals or the audit trail.** `gbrain serve --http` writes one `mcp_request_log` row for every call, `tools/list` included, and nothing ever deleted them, so a busy brain's log grew without limit. Retention is opt-in and off by default, so nothing changes until you run `gbrain config set cycle.purge.mcp_request_log_retention_days 90` (30 to 3650 days; 1 to 29 is refused because the built-in usage reports look back 30 days). Then the nightly cycle deletes request rows older than the window, and a PGLite brain held by a live `gbrain serve` prunes itself once an hour in short batches. The `surface_change`, `memory_setting_change` and `access_admin` audit rows are never deleted, and each pruned row is counted per client first, so the Agents page's total requests and last-used times stay exact. A usage report whose window reaches back past deleted history says so: `gbrain auth clients --usage` names the `--days` that is complete, the advisor skips its "starter op unused for 90 days" half, and `scripts/derive-starter-ops.ts` refuses. Deleted request detail cannot be restored. `gbrain doctor` reports the log's size and suggests turning retention on once it passes about 1M rows or 1 GiB, asking you first. Proposed and first implemented by @lubosxyz (#6770).++**A remote `think` now runs on the brain host's own think model unless the host allows the model the caller asked for.** Every `think` answer is a paid call on the host's key, and before this change any MCP or HTTP client (or a thin-client `gbrain think --model`) could pick the most expensive model the host could reach. Now the requested `model` runs only when it is the host's think model (`models.think`, then `models.default`) or the host lists it in the new `think.remote_models` key (comma-separated, empty by default). Any other model, or a listed one the host cannot run (no key for its provider, or no chat support), no longer fails the call: the host model answers, `warnings` carries `MODEL_OVERRIDE_IGNORED:not_allowed` or `MODEL_OVERRIDE_IGNORED:unusable`, and the result carries a `model_override_ignored` notice that says how the owner can allow it. Remote `rounds` runs one round. The local CLI `--model` is unchanged and still exits 1 on an unusable model. A keyless brain answers a remote think the same way with or without `model`.++**Moved your brain folder? gbrain now tells you how to bring it back.** When a managed checkout was moved to a new path, or a folder above it was renamed, `gbrain sources set-path` and `gbrain sources add` used to refuse with a generic "identity changed" or "checkout missing" error that offered no way out, and their `--dry-run` said everything was fine. Now the preview and the real command refuse the same way, name where gbrain recorded the folder and where it is now, and give the exact commands that get you back without losing the folder's ownership or Git history. Nothing new can rebind ownership. The commands are the ones that already worked, and gbrain still checks everything they do.++### A moved brain folder: how to get it back++Run the command you were going to run, with `--dry-run`:++```bash+gbrain sources set-path notes /Users/alice-example/Brain --dry-run+```++The refusal (`recovery_required`, detail `physical_root_moved`) carries its exit as a `fix` the agent asks you about first, because it moves your folders:++| What happened | The exit it names |+|---|---|+| Folder moved, its source still registered | `ln -s <new> <old>`, `gbrain sources set-path <source> <new>`, `rm <old>` |+| Folder moved after `gbrain sources remove` | `mv <new> <old>`, then `gbrain sources add <id> --path <old>`, which reattaches the folder's history |+| A parent folder renamed | the same, on the parent folder |+| Copied to another disk and the original deleted | restore the original, or switch to classic mode (`gbrain sources writer deactivate --dry-run`); a copy cannot be reattached |++### Things to watch++- Existing pages of forwarded emails keep their cut body until the thread changes again. Nothing is rewritten on upgrade.+- Old Gmail threads already imported through the change feed stay in the brain and keep updating when they change. Shrinking the window or a full sync does not remove them.+- At 50 waiting item jobs for one GitHub source, a GitHub webhook for an item event that no waiting job covers now gets HTTP 429 `webhook_backlog_full` (`Retry-After: 30`), where it used to get 202 while the event was dropped. GitHub does not redeliver a 429 on its own: redeliver it from the webhook's Recent Deliveries, or let the next sweep or `gbrain sync --source <id>` catch it.+- A live fact row an older build linked as superseded is cleared by a full reconcile (`gbrain dream --phase extract_facts --source <id>`); the nightly cycle clears it only when the page changes.+- Duplicate open loops written before this change and person-to-company links already typed from a machine-written section stay as they are until their thread or page is processed again.+- `gbrain takes list --status <x>` used to be ignored silently and now exits 1, pointing to `--expired` and `gbrain takes propose --json`.+- A `POST /ingest` capture whose credential's write source is archived or removed before the capture lands now fails its job with `source_changed` (`detail: webhook_source_unavailable`) and writes nothing, where it used to be written under `default`, a source the credential may not be granted. Restore the source and run `gbrain jobs retry` on the job. Captures that do not come from a webhook keep the `default` fallback.+- TypeScript, TSX, JavaScript, Python, Ruby and Elixir code files re-chunk once on the next sync (#5001, #7080). On a brain with an embedding provider that is one paid re-embedding pass over their changed chunks; `gbrain embed --stale --dry-run` counts them first.+- MCP request log retention is off until you set `cycle.purge.mcp_request_log_retention_days`. A remote `think` that asks for a model the host has not listed in `think.remote_models` now gets the host model and a `model_override_ignored` notice instead of the model it asked for.+- A moved brain folder: `gbrain sources add --dry-run` and `gbrain sources writer claim --dry-run` now refuse a folder that holds a copied ownership stamp, and `gbrain sources set-path --dry-run` refuses a missing checkout, as their real runs always did. They still write nothing.+- A moved brain folder: a remote agent whose page write reaches such a folder sees only the detail, never a path.+- A moved brain folder: a brain without a Git repository is unaffected, and the default keyless brain's `gbrain sources set-path` stays a plain path update.++### Itemized changes++#### Connectors (#8941)++- `src/core/google/google-source.ts`: `processThread` takes a `cutoffMs`; the history delta and held-thread retries pass `now - g_history_days`, and a thread whose newest message is older is settled without a page and without a hold unless it already has a page, which keeps updating (#8482). Reported and first fixed by @Masashi-Ono0611.+- `src/core/google/google-render.ts`: `trimQuotedReply` keeps the whole body when a Gmail `---------- Forwarded message ----------` or Apple Mail `Begin forwarded message:` line comes before any reply marker; reply trimming, including a forward quoted inside a reply, is unchanged (#8719). Reported and first fixed by @javieraldape.+- `src/commands/serve-http-webhooks.ts`: the item idempotency key carries `delete` or `refresh`, the per-source waiting cap is 50 (was 1), and a cap hit answers 429 `webhook_backlog_full` with `Retry-After: 30` unless the waiting job it returns covers the event (the same item and intent, or an explicit source-wide sync for an edit; an automatic freshness sync, which can skip, covers nothing). In `src/core/minions/handlers/sync.ts` an item job that finds another sync of its source running is deferred 30 s at a time without burning an attempt, instead of completing as a source-wide skip, so its refresh or deletion is not lost (#8799). Reported and first fixed by @javieraldape.+- `src/core/facts/file-body-guard.ts`, `src/core/google/sweep-shared.ts`: `replaceableFile`'s `alsoHeldAs` receives each stored state, so the connector puts back that state's own Facts fence (the live row without the withdrawal overlay, versions with it) (#8645). Reported and first fixed by @Masashi-Ono0611.+- `src/core/google/sweep-shared.ts`: the unmanaged `importRendered` screens the render against page purge tombstones (`intentCarriesPurgedContent`) before any drift check or temporary write and skips a match with one log line naming `gbrain pages unpurge`; it returns no slug, so the Gmail sweep runs no loop detection or extraction on that thread and drops its grace hold (#8644). Reported and first fixed by @javieraldape.+- `src/core/persistence/connector-sync.ts`, `src/core/google/sweep-shared.ts`: on a managed source, an import the connector session skips as purged content returns `purged: true` on its `skipped` result, and `importRendered` returns no slug for it, so the same Gmail early return applies there (#8938).+- Docs: `docs/guides/github-source.md` (backlog refusal, busy-source retry), `docs/architecture/key-files/google-and-loops.md`, new `docs/architecture/key-files/google-sweeps.md`.+- Tests: `test/google-gmail-delta-window-8482.test.ts`, `test/google-render-forward-8719.test.ts`, `test/serve-http-github-items-8799.test.ts`, `test/google-withdrawn-fence-carry-8645.test.ts`, `test/google-classic-purged-item-8644.test.ts`, `test/sync-handler-github-item-busy-8799.test.ts`.++#### Facts and capture (#8971)++- `src/core/facts/writeback-gate.ts`: an accepted ambient-writeback turn is banked and hashed without its `>` quote lines outside backtick or tilde fences (a line like `>90% of traffic` is still yours); the quoted-material check recognizes tilde fences too. Reported and first fixed by @Masashi-Ono0611 (#8410, #8412).+- `src/core/persistence/facts-maintenance.ts`: a page-triggered or input-keyed facts batch refused `embedding_configuration` by the write owner's consumer is re-admitted from its retained facts (no new model call, retained visibility, unattributed facts included) once no full consumer that was running at the refusal is still live; until then a retry replays the stored refusal and spends nothing, a claim forgotten in the meantime stays forgotten, and a real model change still admits nothing. Reported and first fixed by @babyspectrum (#8526, #8554).+- `src/core/facts/subject-infer.ts`: capture-stream openers (captured, watched, reviewed, logged; notes, capture, log, review, watch as labels) no longer veto subject inference as a competing name. Reported and first fixed by @mgunnin (#8656).+- `src/core/transcripts/ingest-facts.ts`, `src/commands/transcripts.ts`: `transcripts ingest --facts` returns `budgetExhausted`, `budgetReason`, `pagesSkippedTooLarge` and `pagesLockSkipped` in `--json` and prints a line for each in the human summary. Reported and first fixed by @harjothkhara (#8722, #8757).+- `src/core/context/session-speaker.ts`: a headless session that a `claude remote-control` server (or its `rc`, `remote`, `sync`, `bridge` aliases) hosts over `--sdk-url` is the owner's; a worker that session launches is still agent-launched. Existing speaker sidecars keep their first record. Reported and first fixed by @exGeni (#8080, #8892).+- `src/core/persistence/page-mutations.ts`: only remote writes that supply page text (put_page, edit_page, append_page, capture) stamp `mcp:<operation>` provenance; other remote page writes keep the stored `source_kind`, `ingested_via` and `ingested_at`. Reported and first fixed by @zsimovanforgeops (#8667).+- `src/core/facts-fence.ts`: only a struck (`~~claim~~`) row takes a `superseded by #N` link from its context cell, the way only a struck row reads `forgotten:`; a live row keeps the text as context and stays in recall. A live row an older build linked is cleared by a full reconcile, which `gbrain dream --phase extract_facts --source <id>` runs; the nightly cycle clears it only when the page changes, and on a managed brain an earlier reconcile receipt for an unchanged page can replay until then. Reported and first fixed by @alanshurafa (#9069, #9073).+- Docs: `docs/guides/ambient-writeback.md` (Remote Control sessions under automatic detection), `docs/guides/fence-format.md` (the `context` column) and the KEY_FILES entries for the touched files.+- Tests: `test/facts/writeback-gate.test.ts`, `test/facts-embedding-refusal-heal-8526.test.ts` (PGLite and Postgres), `test/facts-subject-infer.test.ts`, `test/extract-conversation-facts.test.ts`, `test/agent-session-speaker-8064.serial.test.ts`, `test/put-page-provenance.test.ts`, `test/facts-fence.test.ts`, `test/extract-facts-phase.test.ts`, `test/fence-write.test.ts`.++#### Takes, timelines and links (#8936)++- `src/core/engine-sql/takes.ts`: `listTakes` ends its ORDER BY with `t.id DESC`, so LIMIT/OFFSET pages over takes sharing `created_at` are stable. Test: `test/list-takes-tie-order.test.ts`. Reported and first fixed by @Masashi-Ono0611 (#8883).+- `src/core/cycle/extract-takes.ts`: the reconcile and rebuild walks write rows with `takesPreparation.toCanonicalBatchInput`, the projection page writes already use, so an inactive fence row citing `superseded by #N` keeps `superseded_by = N`. Test: `test/takes-reconcile-superseded-pointer.test.ts`. Reported and first fixed by @Masashi-Ono0611 (#8391).+- `src/commands/reconcile-links.ts`: the CLI resolves one source (`--source`, then `GBRAIN_SOURCE`, `.gbrain-source`, the registered path and the brain default); the markdown scan, page reads and both edge directions stay in it; `__all__` is refused (`invalid_params`); an `addLink` failure other than a missing target rethrows. Help line updated. Test: `test/reconcile-links-source-scope.test.ts`. Reported and first fixed by @babyspectrum (#8532).+- `src/core/timeline-citations.ts`: a citation summary keeps the text of each same-line inline code span (backticks dropped, never emphasis-unwrapped); fenced code and spans holding citation or comment markup stay out. `supersededInlineCitationEntries` also returns the code-blanking reading, so rows stored by it are retired on reconcile. Test: `test/timeline-citations-inline-code.test.ts`. Reported and first fixed by @Masashi-Ono0611 (#8895).+- `src/core/timeline-extract.ts`: `supersededTimelineReadings` (renamed from `supersededCitationTimeline`; `persistence/canonical-projections.ts` follows) adds the pre-#3280 bullet split, read by a linear scan, so `retractRemovedTimelineEntries` and the managed projection retire those rows when their detail is extractor-written. Test: `test/timeline-legacy-split-7949.test.ts`. Reported and first fixed by @Masashi-Ono0611 (#7955).++#### Transcripts, import, connectors, loops, facts and doctor (#8319, #8332)++- `src/core/transcripts/hermes.ts`: when the store has both WAL sidecars, the Hermes adapter opens it read-only and runs `VACUUM INTO` a temporary file, so a checkpoint during the copy no longer tears the snapshot (`SQLITE_IOERR_SHORT_READ`) (#7067). A store at rest, or one in a directory gbrain cannot write, is copied into the temporary directory as before, and nothing is created beside the store. Any other snapshot error, a busy writer included, is reported instead of falling back to a copy that could tear. Tests: `test/hermes-snapshot-7067.serial.test.ts`, `test/hermes-snapshot-readonly-dir.test.ts`, `test/hermes-snapshot-busy-rethrow.test.ts`.+- `src/core/transcripts/ingest.ts`, `src/commands/transcripts.ts`: `transcripts ingest --all` carries each file's discovered format instead of detecting it again, which failed on Claude Code logs whose first record is over 2 MiB; an explicit `--format` still wins (#7700). Test: `test/transcripts-all-discovered-format-7700.test.ts`.+- `src/commands/import.ts`, `src/core/persistence/import-mutations.ts`: a managed import with `sync.write_through` off refuses `owner_unavailable` (`detail: disabled_by_config`) once, before admitting any file, and names the supported path (commit, then `gbrain sync --source <id>`) (#7085). Tests: `test/import-write-through-off-7085.test.ts`, `test/e2e/import-write-through-off-7085-postgres.test.ts`.+- `src/core/connectors/sync.ts`: `connectors sync --dry-run` writes neither `last_sync_at` nor `auth_error_at`, and a preview whose listing stopped early returns `partial` with `listComplete: false` and `wouldFetch` (#7689, part 2). Test: `test/connectors-dry-run-7689.test.ts`.+- `src/core/persistence/connector-sync.ts`, `src/core/frontmatter-recovery.ts`: a connector re-render carries the stored `trust_tier` marker forward only when it equals the tier the import assigns (`external_untrusted`), and `trust_tier` is a protected frontmatter key, so a marker can never raise trust (#8052). Tests: `test/connector-trust-marker-8052.test.ts`, `test/e2e/connector-trust-marker-8052.test.ts`.+- `src/core/google/loops-extract.ts`: the extracted-loop dedup key is thread, direction and the normalized verbatim quote, and same-quote items in one response collapse; rows written earlier keep their key when their quote matches (#7289). Test: `test/loops-extract-run.serial.test.ts`.+- `src/core/ops/loops.ts`, `src/commands/loops.ts`: `withheld_noise` returns every sender in JSON; only the human render caps at 10 and points to `gbrain waiting --json` (#7285).+- `src/core/google/api-access.ts`: the `google status` Contacts probe calls `people/me/connections?pageSize=1`, which `contacts.readonly` covers; no scopes are added (#7490). Test: `test/google-status-contacts-probe-7490.test.ts`.+- `src/core/google/google-render.ts`: `isNoiseSender` matches separator and localized no-reply local parts (`no_reply`, `no.reply`, `do_not_reply`, `noresponder`, `notificaciones`, `notificacoes`, `ne-pas-repondre`, `keine-antwort`) on the part before the @ only (#7856). Test: `test/loops-noise-5012.test.ts`.+- `src/core/facts/subject-infer.ts`: the extractor's speaker labels no longer count as competing names, and names that start or end with a digit count only when they resolve to an existing page (#7827, items 1 and 3). Tests: `test/facts-subject-infer-7827.test.ts`, `test/e2e/facts-subject-infer-7827-postgres.test.ts`.+- `src/commands/takes.ts`, `src/core/take-proposals.ts`: `takes propose --accept` resolves its own root (repo-less brains accept through the database) and prints the accepted claim; `takes list --status` exits 1 (#7271). Tests: `test/takes-propose-cli-7271.test.ts`, `test/e2e/takes-propose-cli-7271-postgres.test.ts`.+- `src/core/facts/proposal-supersede.ts`: the managed `decide_proposal` preparer reads through `wholeBodySnapshot`, so a `supersede_fact` proposal on a segmented entity page within `PAGE_MAX_BYTES` no longer refuses `page_body_segmented` (#8060). Tests: `test/trust-supersede-segmented-8060.test.ts`, `test/e2e/trust-supersede-segmented-8060-postgres.test.ts`.+- `src/core/machine-sections.ts`, `src/core/link-extraction.ts`, `src/core/page-body/segment-links.ts`: `roleTriggerText` drops the ranges `rolePriorSuppressedRanges` already excludes, for inline and segmented extraction; no extractor or pipeline version bump (#7882). Test: `test/link-role-prior-trigger-7882.test.ts`.+- `src/core/mentions/pass.ts`: on a belief-covered source the mention pass locks the page keys and journals its link writes through `unmanagedBeliefPoint(..., 'mention_pass')`, so the drift check no longer reconciles a freshly published page as drift (#7031). Tests: `test/belief-stale-links-7031.test.ts`, `test/e2e/belief-stale-links-7031-postgres.test.ts`.+- `src/commands/doctor/checks/atom-body-recheck.ts` (new), `src/commands/doctor/checks/extraction-sync.ts`: `atom_provenance_drift` finds the `page_versions` edition whose hash matches the atom's `source_hash` and compares its body with the live body, fences removed; equal bodies count under a new `body_unchanged` detail (at most 200 groups, 20 versions each). The doctor JSON goldens gain `"body_unchanged": 0`, and `scripts/page-body-readers-baseline.tsv` gains three INLINE rows for the re-check's body reads (#6825). Test: `test/doctor-atom-provenance-drift-6825.test.ts`.++#### Webhook captures++- `src/core/minions/handlers/ingest-capture.ts`: a webhook capture (`untrusted_payload`, `source_kind: webhook`) whose write source is archived, unregistered or removed mid-write refuses `source_changed` (`detail: webhook_source_unavailable`) instead of writing under `default`, on managed and unmanaged brains. Test: `test/ingest-capture-no-default-fallback.test.ts`.+- `src/core/minions/handlers/ingest-capture.ts`: the job normalizes its slug once (`validateSlug`) before its snapshot, applied-record and writer lookups, so a mixed-case `X-Gbrain-Slug` naming an existing page on a managed brain replaces that page instead of dead-lettering with `revision_required`. A trusted local tombstone for a mixed-case slug now deletes the lowercase page instead of skipping it. Test: `test/ingest-capture-mixed-case-slug.test.ts`.++#### Ingest and facts salvage wave (#8921)++- **Atoms follow a renamed origin page, and the privacy filter follows it too (#7462).** After a sync rename, stale-atom repair, provenance drift, derived visibility, the private-visibility filter and visibility repair used to treat an atom's origin page as gone. They now follow the rename alias. An atom is private when either the old or the renamed page is private, so this only tightens; `source_slug` is never rewritten.+- **A tombstone purge never removes a root sync metafile (#7613).** AGENTS.md and the other sync metafiles at the root of a checkout could match a tombstone and be deleted.+- **A second `extract_atoms` run of the same origin waits instead of failing (#7923),** and the atom session waits out the previous batch's Git effects instead of failing on a holder about to release (#7461).+- **An interrupted conversation-facts backfill keeps its committed counts (#7068),** and doctor's timeline_history recount shares the run deadline (#7038).+- **Claude Sonnet 5.5 and Haiku 5.5 get thinking-off controls they accept (#7567).** Sonnet 5.5 rejected `disabled` with a 400. Opus 5.5 is tracked separately in #8317.+- **Credentials nested in config objects stay hidden (#7346).** `gbrain config get` and `config show` used to print an S3 secret key inside the `storage` object in clear text, and even `config get storage.secretAccessKey` did. Both are redacted now, and `--raw` still prints the value. `files upload-raw` reports the storage backend it actually used, and on a managed brain it refuses before uploading instead of leaving an unrecorded object behind. The v0.9.0 migration guide shows how to configure S3, R2 and MinIO storage in `~/.gbrain/config.json`.+- **`gbrain agent run` refuses a value flag written after the prompt (#7672).** `gbrain agent run "do X" --tools read` used to treat `--tools read` as prompt text and run the job with every tool. Write the flag before the prompt, or put `--` before the prompt to keep it as text. `gbrain edge-proposals accept --limit=5 12` and its sibling subcommands now say to drop the flag, instead of advising `--limit 5`, which would have acted on proposal 5.+- **`--flag value` and `--flag=value` mean the same thing in more places (#7624).** `gbrain doctor --scope brain` and `gbrain models doctor --skip <provider>` work with a space as well as with `=`, an unknown scope is an error, and `gbrain jobs watch --refresh-ms 250` changes the refresh rate instead of being ignored.+- **A very long tag gets a clear refusal (#7052).** A tag over 2688 bytes used to fail a page write with a confusing `storage_error`. `put_page`, `add_tag`, capture and import now refuse it as `tag_too_long`, naming the tag and its size, and sync holds the file and keeps going.+- **`gbrain extract links --source db` keeps links to child pages (#6983).** A markdown link like `[note](notes/first.md)` resolves from the linking page's own folder first, then its parent folders, the way `--source fs` does. If no page exists at that path, gbrain still falls back to the root-relative page, and the write-time link check agrees with the graph.+- **`code-callers` finds calls from top-level code (#5001), and Elixir works with `code-def`, `code-callers` and `code-callees` (#7080).** TypeScript, TSX, JavaScript, Python, Ruby and Elixir files re-chunk once on the next sync. On a brain with an embedding provider that re-embeds the changed chunks of those code files once, so a brain with large code sources pays one embedding pass over them; `gbrain embed --stale --dry-run` counts them first.+- **Runtime and storage fixes.** `gbrain jobs supervisor start --detach` works with the compiled binary (#7532). Supabase Storage sends publishable and secret keys only in the `apikey` header (#7205). `gbrain brainstorm` and `gbrain lsd` cache the slug-prefix list in memory instead of in the config table that every command reads (#7838).+- **Advisors and repair give advice that works (#7281, #7282, #7137).** The stale-sync advisor skips archived sources. The timeline-coverage advisor counts meeting, conversation and calendar pages by their own date. An auto-tier `gbrain db-repair --yes` that can't reach a database that keeps refusing connections tells you to check the database server instead of running the same repair again.+- **Smaller fixes.** Link reads count hidden former relationships in SQL instead of fetching them (#7075). Autopilot logs `auto_drain_window_clamped` when it shortens an atom drain (#7076). `loops list` and `open_loops` say when a list was cut short and how many matched (#7291). A null `api_error_status` counts as no status in the Claude CLI output-cap match (#7273). The Hermes turn rule names gbrain's tools `mcp__gbrain__recall` (#8068). `gbrain init --help` names starter as the default registration surface (#7983). The 0.53.0 migration's refusal for an unclaimed or inactive source names the preview to run first (#7915). The ci:local runner installs curl (#7765). Docs: the topologies guide (#7733) and the AlphaClaw/OpenClaw onboarding known issue (#7965).++#### Request log retention (#8952, from #9145)++- `src/core/mcp-request-log-retention.ts` (new): `pruneMcpRequestLog` deletes rows past the cutoff in batches of 2,000 (at most 200 per run, 400,000 rows), each batch one statement that picks the oldest rows in `created_at` order with `FOR UPDATE SKIP LOCKED`, skips `AUDIT_LOG_OPERATIONS`, deletes them and adds them to `mcp_request_log_rollup`, so a failed tally deletes nothing and two prunes at once never double-count. `runMcpLogRetention` reads `cycle.purge.mcp_request_log_retention_days` and records each run under `cycle.purge.mcp_request_log_last_prune`. `startMcpLogPruneTicker` is the hourly PGLite prune with a 3-second budget that yields between batches. `lifetimeUsage` adds kept rows and the tally.+- `access_admin`, the owner access administration audit row (GST-1094), is in `AUDIT_LOG_OPERATIONS` too, so retention never prunes it and usage reports never count it.+- Migration v308 (provisional; GBRA-108 assigns the number at the merge slot) adds `mcp_request_log_rollup` (`token_name`, `requests`, `last_used_at`, `pruned_through`) with RLS on. It copies and deletes nothing.+- `src/core/cycle.ts`: the `purge` phase runs the prune when retention is set and reports `purged_mcp_request_log_count` when it removed rows.+- `src/commands/serve.ts`: both `gbrain serve` and `gbrain serve --http` start the hourly prune on PGLite, paused while a delegated sync runs.+- `src/core/mcp-usage.ts`: `readClientOpUsageWithCoverage` returns each window's coverage (`truncated`, `covered_days`, `pruned_before`) and `truncatedWindowNote` the fix and recovery sentence; `AUDIT_LOG_OPERATIONS` names the never-pruned rows. `readClientOpUsage` is unchanged.+- `gbrain auth clients --usage` prints `window truncated: ...` with the complete `--days`; `--json` adds `window_truncated`, `covered_days`, `pruned_before` and `window_note`. `scripts/derive-starter-ops.ts` exits 1 with the note on stderr for a truncated window. The advisor's `mcp-client-fit` drift finding skips its unused-member half and says why.+- Admin dashboard: `/admin/api/agents` totals and OAuth last-used read the log plus the tally; `/admin/api/requests` adds `retention_days` and `pruned_before`, which the Request Log page shows.+- `gbrain config set cycle.purge.mcp_request_log_retention_days` refuses values other than 0, `off` or a whole number from 30 to 3650, and writes nothing.+- Doctor `mcp_request_log_retention` (new, ops): log rows and size; past about 1M rows or 1 GiB with retention off it warns, and its fix asks the user before turning retention on and is never a `doctor --remediate` step. With retention on it reports the last prune and the pruned-before date, and warns when no prune ran for 48 hours.+- Docs: `docs/mcp/ADMIN.md` ("Request log retention"), `docs/operations/mcp-surface-runbook.md`, `docs/architecture/system-of-record.md`.+- Tests: `test/mcp-request-log-retention.test.ts` (PGLite and Postgres, repo-less: off by default, every row class tallied exactly, audit rows kept, capped runs resume, a failed tally deletes nothing, a missing tally table skips, `config set` refusals, the PGLite ticker under a live `serve --http`, two prunes at once on Postgres), `test/serve-http-admin-request-log-retention.test.ts`, `test/doctor-mcp-request-log-retention.test.ts`, `test/mcp-request-log-retention-cli.serial.test.ts` (`auth clients` and `derive-starter-ops` through the real entry points), and new cases in `test/mcp-usage.test.ts` and `test/advisor-mcp-client-fit.test.ts`.++#### Remote `think` model (#9050, from #9145)++- `src/core/ops/takes.ts`: `remoteThinkModel` resolves the requested model, the host think model and each `think.remote_models` entry through the same alias resolution and normalization, then runs the requested model only when it is the host model, or when it is listed, passes `probeChatModel` and has its provider's key. For remote callers, the #1698 explicit-model error no longer applies and `rounds` is 1.+- `src/core/interop-notices.ts`, `src/core/error-registry.ts`: the `model_override_ignored` info notice (per session for each reason); for `not_allowed` its fix is `gbrain config set think.remote_models <models>` on the brain host (paid consent).+- `src/commands/think.ts`: the thin client turns the server's `MODEL_OVERRIDE_IGNORED:*` warning into the same notice, and `--model` help says what a thin client gets.+- `src/core/config-runtime-keys.ts`: `think.remote_models` is a registered key; no remote operation writes config, so only the host sets it.+- `src/core/behavior-change-notice.ts`: one row for the remote `think` model rule. Docs: `docs/guides/remote-mcp.md` security posture.+- Tests: `test/think-remote-model.test.ts` (PGLite and Postgres, remote MCP dispatch on a repo-less brain): an unlisted model, a listed model, a listed model the host cannot run, a listed model whose provider key the host lacks, the host model named explicitly, remote `rounds`, the local operation keeping #1698, and a keyless brain with and without `model`; `test/think-remote-model-thin-client.serial.test.ts`: the thin-client `--model` notice; `test/think-pipeline.test.ts` pins the #1698 error on the local caller and no error for a remote one.++#### A moved brain folder (#8950, from #9145)++- `src/core/persistence/physical-root-record.ts`: `describeMovedPhysicalRoot` (read-only file evidence: the stamp's recorded root is gone, and the reservation of that root, beside it or beside the new root after a parent rename, carries the stamp's token, brain and worktree; `sameDirectory` from device, inode and birth time), `physicalRootMovedError` (path-free) and `physicalRootMovedRefusal` (the local CLI refusal with an `ask_user` fix chain in argv form, paths shell-quoted in the prose). An ownership stamp other users can read at the new path now refuses `ownership_record_not_private` instead of the generic error.+- `src/core/persistence/physical-root.ts`: `movedPhysicalRoot` accepts the evidence only for this brain, a worktree this host owns and a host binding still at the recorded root; `reservePhysicalRoot` raises the path-free refusal on its copied-marker branch.+- `src/core/persistence/source-lifecycle.ts`, `topology-locks.ts`, `administration.ts`: `add`, `claim`, `rebind` and `writer claim` build the full refusal (never for the automatic first-write claim); their dry runs predict it, and a rebind dry run of a missing checkout refuses `source_checkout_missing` like the real run. When the automatic first-write claim finds a missing or moved checkout under the source's folder, it now refuses path-free too (`physical_root_moved`, or the path-free `source_checkout_missing`). Before this, a remote page write in that layout was told the checkout's host path.+- `src/core/persistence/verb-errors.ts`, `src/core/error-registry.ts`: the `physical_root_moved` reason and its explanation; `docs/guides/error-codes.md` regenerated.+- Docs: `docs/architecture/topologies.md#moved-root`, `docs/guides/write-refusals.md#moved-root`.+- Tests: `test/physical-root-moved-8625.test.ts` (PGLite and Postgres: leaf and parent moves, bound and removed sources, Git and plain directories, a copy on a new inode, two sources in one worktree, `writer claim --dry-run`, five lookalikes that keep the generic refusal, a readable stamp, the classic keyless set-path, and a remote `put_page` whose refusal carries no path or worktree id, before activation and on an activated brain with a moved checkout under the unbound source's folder).++Proposed and first implemented by @Kkkkkuro (#8625).++<!-- behavior-change: github_item_webhook_backlog_8799 -->+<!-- behavior-change: webhook_capture_no_default_fallback_gst2113 -->+<!-- behavior-change: code_rechunk_module_elixir_8128 -->+<!-- behavior-change: db_link_child_folder_6983 -->+<!-- behavior-change: remote_think_host_model_gbra437 -->+<!-- behavior-change: physical_root_moved_8625 -->diff --git a/src/core/persistence/physical-root-record.ts b/src/core/persistence/physical-root-record.tsindex 58bfbc2ca4..22e03b25e9 100644--- a/src/core/persistence/physical-root-record.ts+++ b/src/core/persistence/physical-root-record.ts@@ -343,6 +343,7 @@ export function physicalRootMovedRefusal(moved: MovedPhysicalRoot, exit: { sourcthen: user(`Re-registers source ${exit.sourceId} at the recorded path, which reattaches worktree ${worktreeId}.`, readd, `May I register source ${exit.sourceId} at ${recorded}?`,exit.operation === 'claim' ? { inputs: [{ name: 'admin_state', how: 'admin_state from gbrain sources writer status --json on the brain host' }] } : {}) });return error;+}const DIRECTORY_CHANGED_MESSAGE = 'The checkout directory at the recorded root is not the one this owner stamped (its inode or birth time changed) while the owner token, brain, worktree, root and device still match. '+ 'Inspect writer status and use the deliberate self-transfer that confirms a relocated root to re-stamp this same path.';/** A stored refusal message (a write receipt keeps code and message only) that is the #5914 directory-changed refusal. */diff --git a/src/core/schema-migrations/latest.generated.ts b/src/core/schema-migrations/latest.generated.tsindex a8708fc748..08a24ddaca 100644--- a/src/core/schema-migrations/latest.generated.ts+++ b/src/core/schema-migrations/latest.generated.ts@@ -4,4 +4,4 @@// The highest schema migration version (migrate.ts LATEST_VERSION), importable without// loading the migrations themselves.-export const LATEST_SCHEMA_VERSION = 309;+export const LATEST_SCHEMA_VERSION = 310;diff --git a/src/core/schema-migrations/registry.generated.ts b/src/core/schema-migrations/registry.generated.tsindex 35d858aeae..53e16c2c76 100644--- a/src/core/schema-migrations/registry.generated.ts+++ b/src/core/schema-migrations/registry.generated.ts@@ -310,6 +310,7 @@ import { v306 } from './v306-member-page-withdrawal-scope.ts';import { v307 } from './v307-page-label-guards.ts';import { v308 } from './v308-access-labelled-only.ts';import { v309 } from './v309-requester-scope.ts';+import { v310 } from './v310-mcp-request-log-rollup.ts';// Array order is historical (see HISTORICAL_ARRAY_ORDER in the generator); the// runner sorts by version before applying.@@ -618,4 +619,5 @@ export const MIGRATIONS: Migration[] = [v307,v308,v309,+ v310,];diff --git a/src/core/schema-migrations/v308-mcp-request-log-rollup.ts b/src/core/schema-migrations/v310-mcp-request-log-rollup.tssimilarity index 96%rename from src/core/schema-migrations/v308-mcp-request-log-rollup.tsrename to src/core/schema-migrations/v310-mcp-request-log-rollup.tsindex b67b7309bf..346a3bb282 100644--- a/src/core/schema-migrations/v308-mcp-request-log-rollup.ts+++ b/src/core/schema-migrations/v310-mcp-request-log-rollup.ts@@ -15,8 +15,8 @@ import type { Migration } from './types.ts';// RLS is enabled here (v275's list is frozen). No schema.sql mirror: like// v282-v301, it exists only through migrations. Provisional number:// renumbered at the merge slot.-export const v308: Migration = {- version: 308,+export const v310: Migration = {+ version: 310,name: 'mcp_request_log_rollup',idempotent: true,sql: `diff --git a/test/fixtures/goldens/migrations/records.json b/test/fixtures/goldens/migrations/records.jsonindex 48786036d5..07d65f2933 100644--- a/test/fixtures/goldens/migrations/records.json+++ b/test/fixtures/goldens/migrations/records.json@@ -1,6 +1,6 @@{"golden": {- "count": 304,+ "count": 305,"gaps": [17,18,@@ -103,7 +103,7 @@"widenIdentityIndex": "86a6176bd7637d964dbc1d3cd3b1bdfa3ca0161e1ee248c37d7380a1471282e6","withSchemaLockTimeout": "95605bd3004955e11e936c7a4aa6889319b401098abf9db18ef3e48da2c3fc59"},- "latest": 309,+ "latest": 310,"records": [{"handler": {@@ -5028,6 +5028,19 @@"transaction": "absent","verify": "absent","version": 309+ },+ {+ "handler": "absent",+ "idempotent": true,+ "name": "mcp_request_log_rollup",+ "sql": {+ "length": 415,+ "sha256": "fbbd86c93e5131171c0749954ad969cd518b0d08f0acd45743360f2dfd5b1210"+ },+ "sqlFor": "absent",+ "transaction": "absent",+ "verify": "absent",+ "version": 310}],"versions": [@@ -5334,7 +5347,8 @@306,307,308,- 309+ 309,+ 310]},"normalizer": "migrations-record-v1"