Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge remote-tracking branch 'origin/capy/fix-6524' into capy/fix-6529

garrytanae17b932aedc
diff --cc CHANGELOG.md
index 470f79f241,dfea9b68ae..9fa7fc2345
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -10,17 -10,18 +10,29 @@@ credits are retained; no result has bee
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [0.60.182.0] - 2026-10-12
+
+**Image pages on a managed multimodal brain get their image vector (#6529).** With `GBRAIN_EMBEDDING_MULTIMODAL=true`, a managed `gbrain sync` now imports image files through the coordinated image importer instead of holding every one as `managed_image_sync_unsupported`, so the page is created with its OCR text, its image vector and its `source_path` in the same publication; holds from earlier syncs are re-screened and imported on the next `gbrain sync --source <id> --no-pull`. `gbrain embed --stale --images` works on a managed brain (it used to be refused by the legacy writer), finds the image pages whose `source_path` was never recorded through their slug, and a plain `gbrain embed --stale` runs that sweep first on a multimodal install. Doctor's new `image_embedding_coverage` check reports the image pages search cannot see, which `embed_coverage_pct` counted as embedded. No migration; the image vector and OCR text are the paid calls the importer already made for `gbrain import`, now also made at sync and sweep time. Image pages whose file is no longer in the checkout are not re-imported: every sweep names the first path it tried, and the explicit `--images` sweep exits non-zero when it could rebuild nothing.
+
+### Itemized changes
+
+- **Managed sync imports images when multimodal embedding is on.** `freezeEntry` freezes an image entry as its bytes in base64 (binary-safe reads through `readPinnedBytes` / `readBlobBytes`; `rawHash` stays the file sha256, so the working-tree check and the hash no-op are unchanged; an oversize image takes the `file_too_large` hold), `prepareManagedSyncMutation` routes it to `src/core/persistence/sync-image.ts`, and `prepareManagedSyncImage` runs `importImageFile` with `prepare`, the same coordinated path `gbrain import` uses: the importer decides the hash no-op before any provider call, OCRs and embeds otherwise, `--no-embed` skips both, a company plan refuses, a Git rename publishes the new slug and retires the old page. A screening preparation never pays for an image: the no-op waiver and `unchangedManagedImport` leave image paths to the admitted request, and identical bytes are a no-op by hash. `holdRescreenDue` re-screens a `managed_image_sync_unsupported` hold whenever multimodal embedding is on; with it off the hold's message, fix and the runbook row now say images are held while multimodal embedding is off and name the switch. Tests: `test/managed-sync-images-5493.test.ts` (PGLite and Postgres).
+- **`gbrain embed --stale --images` works on managed brains and reports honestly.** On a managed brain the sweep imports through `importManagedFile` (the coordinated importer), only files inside the source root; a page with a NULL `source_path` is located by its slug (the lower-cased repo-relative path) and the import records the path (`missingSourcePath` in the result). The result carries `missing_samples` (up to 5 `source:slug: no file at <path tried>` lines, the first printed to stderr), and an explicit `--images` sweep whose every candidate lacks a file and that rebuilt nothing counts them as failures, so it exits non-zero instead of 0. Plain `gbrain embed --stale` (no `--slugs`) runs the sweep first on a multimodal install, inside the same cost cap, and folds it into the result as `images`: image import failures count, while fileless image pages are reported (`images.missingFile`, one stderr line naming the first path tried) and leave the exit code to the text run, so a routine `embed --stale` stays green over an out-of-scope backlog of fileless pages; the blocked-projection hint points at that sweep's samples, or at `GBRAIN_EMBEDDING_MULTIMODAL=true` on a text-only install. Tests: `test/embed-stale-images-managed-6529.test.ts`.
+- **Doctor `image_embedding_coverage`.** Counts live image pages, those without an `embedding_image` chunk, those with no recorded `source_path`, and the `managed_image_sync_unsupported` holds; ok with no image pages or with multimodal embedding off (informational), warns on a multimodal install with the counts and the `embed --stale --images` / `sync --no-pull` fix. Read-only. Test: `test/doctor-image-embedding-coverage.test.ts`.
+- **Every image import records `source_path`.** The legacy importer's hash-skip path (`importImageFile` on an unchanged, complete image) now refreshes `source_path` the way the Markdown path does, so a re-import of an older page records the origin it never had. Pages imported before this release keep a NULL `source_path` until the sweep or a sync writes it.
+
+ ## [0.60.181.0] - 2026-10-12
+
+ **`gbrain capture` works again on a brain with a running `gbrain serve` and on every thin client (#6524).** Since v0.60.162.0 (#5970) every capture through those two transports refused `invalid_params: 3 unknown parameters not declared in the capture tool schema (write operations always reject unknown parameters; nothing was written)`, and nothing was written. The CLI has stamped its own provenance on each capture since #5622 (`source_kind: capture-cli`, `source_uri: stdin|cli-positional`, `ingested_via: capture-cli`); the capture op never declared those three fields, and #5970 made dispatch reject any undeclared key on a write. A CLI with no serve running (and every Postgres brain) calls the handler directly, bypassing dispatch, which is why the breakage never reproduced on a developer's own machine while every CLI call delegated to a resident PGLite owner and every thin-client call went through dispatch and failed. The three fields are now declared on the op as trusted-local-CLI provenance; nothing else changes, so the trust posture holds: a trusted local caller's values reach the row as before, and a remote caller's are still replaced with the server-stamped `mcp:capture` at submission. No migration, no paid call.
+
+ ### Itemized changes
+
+ - **The capture op declares the CLI's provenance fields.** `source_kind`, `source_uri` and `ingested_via` are optional strings on `capture` (`CAPTURE_CLI_PROVENANCE_PARAMS` in `src/core/persistence/params.ts`), `fullSurfaceOnly` like `content_origin`: dispatch admits them on every transport, the full surface advertises them, and the starter tool list does not carry them, so its size budget is unchanged (`test/mcp-schema-budget.test.ts`). The operation manifest and the `--tools-json` golden (`test/fixtures/goldens/cli/tools-json.json`, the three new full-surface fields) are regenerated.
+ - **A thin client sends no provenance.** `gbrain capture` builds its parameters in one place (`captureParams`) and attaches the trio only on a local install; a thin client never claimed trusted provenance that the owner would replace anyway, and an older host that predates this release no longer rejects its captures for sending it.
+ - Tests, each failing on the previous release with the exact refusal above: `test/capture-dispatch-provenance-6524.test.ts` dispatches the CLI's shape as a trusted local caller (row keeps `capture-cli` / `cli-positional`) and as a remote caller (row is `mcp:capture`), on PGLite and Postgres; `test/capture-cli-params-contract-6524.test.ts` checks every CLI shape (positional, `--stdin`, `--file` local, `--file` and positional on a thin client) against the server's own unknown-parameter check and pins the full-surface-only declaration; `test/capture-live-transports-6524.test.ts` runs the real `gbrain capture` subprocess against a running stdio `gbrain serve` (resident PGLite owner, delegated over IPC) and from a thin-client home against a running `gbrain serve --http`.
+
+ Fixes #6524. Diagnosis by @james810408, whose report named both sides of the drift and the `fullSurfaceOnly` shape.
+
## [0.60.180.0] - 2026-10-12
**When `remember` refuses a forgotten claim, the refusal now says when and how widely it was forgotten.** An agent that re-saves a claim the user forgot gets `fact_withdrawn` as before, and the refusal now carries `withdrawn: { at, subject, visibility }`, where `subject` is the entity the claim was forgotten for or `all_entities`. The agent can tell the user "you asked me to forget that on <date>" instead of retrying. The object rides the immediate refusal, the batch item error, the failed write receipt and `get_write_request`. It covers the exact claim only, the message, code and suggestion are unchanged, and nothing is ever restored.
diff --cc src/core/behavior-change-notice.ts
index f2e57de0c8,bc34ae7ce0..0555429bbd
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@@ -470,9 -470,6 +470,9 @@@ export const BEHAVIOR_CHANGES: Readonly
{ since: '0.60.180.0', text: 'A `remember` refused with `fact_withdrawn` now carries an additive `withdrawn` object (`at`, `subject`: the entity slug or `all_entities`, `visibility`) on the immediate refusal, the batch item error, the failed write receipt and `get_write_request`, so an agent can tell the user when and how widely the exact claim was forgotten instead of retrying. The message, code and suggestion are unchanged; the object is absent when the caller cannot read the forgotten rows.' },
{ since: '0.60.177.0', text: 'A brain whose persistence mode cannot be read (no `persistence_brain` row, more than one, or an `enabled` value that is not a boolean) now refuses every write, sync, connector run, activation and maintenance step that depends on it with `storage_error` (`detail: persistence_mode_unknown`, fix: `gbrain sources writer status --probe --json`) instead of treating the brain as unmanaged and writing around the owner; only a well-formed `enabled: false` row selects the unmanaged path. A managed `gbrain sync --full` tree walk no longer soft-deletes a page it imported from an untracked working-tree file: a page whose stored import provenance is the working tree, or is unknown, is kept while its file is still present (`working_tree_kept` in the result), and a page imported from a Git blob still follows Git. A soft deletion is not harmless (recall stops at once and the purge lifecycle follows), so this applies on the next sync without opt-in. A first sync, a `--full` sync or one commit that alone exceeds the 100,000-entry / 16 MiB cursor bound now completes in path slices (every import slice, then bounded deletion slices, pinned at one target; the slice cursor is checkpointed with each slice and `last_commit` moves only when the whole target settles) instead of refusing with `request_too_large`; a scheduled sync takes one slice per run and `gbrain sync --drain` takes them all. One file whose manifest entry alone exceeds the byte bound still refuses by name.' },
{ since: '0.60.179.0', text: 'A managed sync no longer parks forever on a pinned import whose canonical correction (a fixable fence, reflowed frontmatter) would rewrite a file that holds newer uncommitted bytes: the file is held `worktree_dirty` with the rest of the source synced, the cursor finishes, and committing the file (or `gbrain sync unblock --source <id> --apply`) imports it. Before, that refusal (`source_changed` / `pinned_git_worktree_conflict`, "Canonical sanitization cannot overwrite newer working-tree bytes.") blocked the cursor with no exit: `--retry-failed` replayed the same pin, `sources refresh` refused `sync_in_progress` and `--acknowledge-managed` refused `cursor_unfinished`. A cursor an older release left blocked this way converts on its next `--retry-failed` run. Working-tree bytes that already are the correction (gbrain\'s own writeback, published before its request settled) import without a second write.' },
- // #6529 (GBRA-79). `since` is provisional: stamped at the current VERSION because a `since` past VERSION discloses on every fresh brain (goldens, notice tests); the integrator restamps both rows to the release (0.60.180.0 placeholder) at the merge slot.
- { since: '0.60.178.0', text: 'With `GBRAIN_EMBEDDING_MULTIMODAL=true`, managed sync now imports image files through the coordinated image importer (OCR text, image vector and `source_path` at import) instead of holding them as `managed_image_sync_unsupported`; existing image holds are re-screened and imported on the next `gbrain sync --source <id> --no-pull`. With it off, images stay held as before.' },
- { since: '0.60.178.0', text: 'On a multimodal install, plain `gbrain embed --stale` now runs the image sweep (`--images`) before its text pass and reports it as `images` in `--json`; `gbrain embed --stale --images` works on managed brains, finds an image page with no recorded `source_path` by its slug, and exits non-zero naming the path it tried when no candidate has a file (it used to exit 0); the folded sweep only reports fileless pages. Doctor gains `image_embedding_coverage`.' },
++ // #6529 (GBRA-79). `since` is provisional: stamped at the current VERSION because a `since` past VERSION discloses on every fresh brain (goldens, notice tests); the integrator restamps both rows to the release (0.60.182.0 placeholder) at the merge slot.
++ { since: '0.60.181.0', text: 'With `GBRAIN_EMBEDDING_MULTIMODAL=true`, managed sync now imports image files through the coordinated image importer (OCR text, image vector and `source_path` at import) instead of holding them as `managed_image_sync_unsupported`; existing image holds are re-screened and imported on the next `gbrain sync --source <id> --no-pull`. With it off, images stay held as before.' },
++ { since: '0.60.181.0', text: 'On a multimodal install, plain `gbrain embed --stale` now runs the image sweep (`--images`) before its text pass and reports it as `images` in `--json`; `gbrain embed --stale --images` works on managed brains, finds an image page with no recorded `source_path` by its slug, and exits non-zero naming the path it tried when no candidate has a file (it used to exit 0); the folded sweep only reports fileless pages. Doctor gains `image_embedding_coverage`.' },
];
/** The newest disclosed change's release: the notice id moves only when a release adds rows. */