Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(qm): acting_user on a member-bound credential, recall max_chars, unknown-param warnings in _meta only (GST-900)
garrytan4be58347e06a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dafc92f4d6..204c52a603 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,22 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [Unreleased]++**A `memory_recall` that names sources reads as that scope, never as the attested person, so a shared turn can no longer recall one member's private facts into a shared channel.** `memory_recall` gains `source_id` and `source_ids`. Named, the read drops the person's own recent facts and every member-page fact, keeps restricted pages hidden and never relaxes `visibility: private`. The contract for it is the new `docs/contracts/qm-memory-provider/v2.json`; `v1.json` stays byte-identical and a test holds it there. Three smaller provider fixes ride along.++### What changed++| Situation | Before | Now |+|---|---|---|+| `memory_recall` with `source_id` / `source_ids` | the argument was ignored (`unknown_param`) and the call read as the person, own facts first | reads the named sources as their audience: no own facts, no member-page facts; a source outside the grant is `permission_denied`, `__all__` is `invalid_params` |+| `memory_recall` without sources | the person's read | unchanged |+| `acting_user` with no `x-qm-actor`, from a credential bound to a member | `argument_without_attestation` | its own member id (or a linked canonical id) is dropped and the call runs as the credential; any other value is `argument_mismatch` |+| `recall` with `max_chars` | unknown argument | 200-12000: whole facts, then results, that fit; `truncated` says if some were cut |+| A read that ignores an undeclared argument | a `[gbrain notice unknown_param]` text block in the result | only `_meta.warnings`, so a harness that stores tool output never stores it; writes still refuse |++QM clients that read v1 keep working unchanged. A shared-scope turn should name its sources and read the v2 contract.+## [0.60.555.0] - 2026-11-02**`gbrain query --limit N` without a token budget returns N rows again, a budgeted facts block takes at most N rows, the facts block never outscores the pages, and the CLI names fact rows instead of printing `undefined` (#8411).** Since the facts block went on by default (v0.60.491.0), it also ran on queries that passed no budget, because the shipped no-budget evidence plan carries an implicit 24,000-token budget. Its 22% share let up to 40 fact rows in ahead of the pages, so `--limit 3` could print more than a dozen fact rows before the 3 pages. Each block row was scored a hair above the top page, so they all showed the same score and outranked every hit, and the human CLI printed them as `[0.84xx] undefined -- …` because fact rows have no page slug.diff --git a/docs/contracts/qm-memory-provider/v2.json b/docs/contracts/qm-memory-provider/v2.jsonindex 7e2c5c29cd..c5cd903b8a 100644--- a/docs/contracts/qm-memory-provider/v2.json+++ b/docs/contracts/qm-memory-provider/v2.json@@ -273,7 +273,7 @@{"code": "actor_not_attested","class": "host_only",- "summary": "A call named the person it serves (the x-qm-actor header or the acting_user argument) in a way gbrain does not honour: the credential holds no attest right, the operation is not in its attested operations, the argument differs from the header or comes without an attested header, or the id is not 1-256 visible ASCII characters; or a write that saves only as an attested person (memory_write) named none; or the request carries x-qm-audience, a channel audience gbrain does not serve yet. Nothing was read or written.",+ "summary": "A call named the person it serves (the x-qm-actor header or the acting_user argument) in a way gbrain does not honour: the credential holds no attest right, the operation is not in its attested operations, the argument differs from the header, names anyone but a member-bound credential's own member, or comes without an attested header from a credential bound to no member, or the id is not 1-256 visible ASCII characters; or a write that saves only as an attested person (memory_write) named none; or the request carries x-qm-audience, a channel audience gbrain does not serve yet. Nothing was read or written.","suggestion": "Read reason: no_attest_right and op_not_attested are the brain operator's call (gbrain auth rescope --client <id> --attest-actor qm [--attest-ops <list>]); argument_mismatch, argument_without_attestation, invalid_actor_id, actor_required and audience_not_supported are fixed in the calling harness.","docs": "docs/guides/write-refusals.md#actor_not_attested","reasons": [diff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.mdindex 55b53c736c..7da1bd9182 100644--- a/docs/guides/error-codes.md+++ b/docs/guides/error-codes.md@@ -165,7 +165,7 @@ More: [docs/guides/write-refusals.md#access_rule_invalid](../../docs/guides/writ| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable ||---|---|---|---|---|---|---|-| A call named the person it serves (the x-qm-actor header or the acting_user argument) in a way gbrain does not honour: the credential holds no attest right, the operation is not in its attested operations, the argument differs from the header or comes without an attested header, or the id is not 1-256 visible ASCII characters; or a write that saves only as an attested person (memory_write) named none; or the request carries x-qm-audience, a channel audience gbrain does not serve yet. Nothing was read or written. | Naming a person decides whose notes are read and written as; only a credential the brain operator granted the attest right may do it, only for the operations it lists, and text in a conversation never chooses it. | Read reason: no_attest_right and op_not_attested are the brain operator's call (gbrain auth rescope --client <id> --attest-actor qm [--attest-ops <list>]); argument_mismatch, argument_without_attestation, invalid_actor_id, actor_required and audience_not_supported are fixed in the calling harness. | user | `gbrain doctor --json` | 1 | no |+| A call named the person it serves (the x-qm-actor header or the acting_user argument) in a way gbrain does not honour: the credential holds no attest right, the operation is not in its attested operations, the argument differs from the header, names anyone but a member-bound credential's own member, or comes without an attested header from a credential bound to no member, or the id is not 1-256 visible ASCII characters; or a write that saves only as an attested person (memory_write) named none; or the request carries x-qm-audience, a channel audience gbrain does not serve yet. Nothing was read or written. | Naming a person decides whose notes are read and written as; only a credential the brain operator granted the attest right may do it, only for the operations it lists, and text in a conversation never chooses it. | Read reason: no_attest_right and op_not_attested are the brain operator's call (gbrain auth rescope --client <id> --attest-actor qm [--attest-ops <list>]); argument_mismatch, argument_without_attestation, invalid_actor_id, actor_required and audience_not_supported are fixed in the calling harness. | user | `gbrain doctor --json` | 1 | no |Reasons: `no_attest_right`, `op_not_attested`, `argument_mismatch`, `argument_without_attestation`, `invalid_actor_id`, `actor_required`, `audience_not_supported`.diff --git a/docs/guides/multi-source-brains.md b/docs/guides/multi-source-brains.mdindex 279c02e27a..caf237412a 100644--- a/docs/guides/multi-source-brains.md+++ b/docs/guides/multi-source-brains.md@@ -169,7 +169,7 @@ grant.### Narrow one request with `source_ids`-`search`, `query`, `recall` and `list_pages` take `source_ids`, a list of+`search`, `query`, `recall`, `memory_recall` and `list_pages` take `source_ids`, a list ofsource ids (CLI: `--source-ids source-a,source-b`). The request reads onlythose sources:diff --git a/docs/guides/qm.md b/docs/guides/qm.mdindex f2f0859320..4e6dd33a18 100644--- a/docs/guides/qm.md+++ b/docs/guides/qm.md@@ -25,14 +25,18 @@ a repo exists, saved facts go through the same git-first writer door as `remembe## What the tools do-- `memory_recall {query, max_chars?}` answers plain text, one fact per line+- `memory_recall {query, max_chars?, source_id?, source_ids?}` answers plain text, one fact per line(`- <fact> (<date>; <kind>)`): the person's own facts from the last 24 hoursfirst, then the facts they may read ranked by `query`. Never page bodies. The textholds as many whole lines as fit, with no marker line (every line is one fact;`structuredContent.truncated` says some were left out), and never exceeds `max_chars`(a whole number of UTF-16 code units, 200-12000, default 6000). Each fact isone line: line breaks and control characters in it become spaces. Ranking is- keyword-only on a keyless brain.+ keyword-only on a keyless brain. A call that names sources (`source_id`,+ `source_ids`, narrowed inside the credential's grant) reads as that scope,+ never as the person: no own facts first and no fact from any member page.+ Name the shared scope on a shared turn; leave sources out only for the+ person's own conversations.- `memory_write {facts, idempotency_key}` saves 1-20 facts on`memory/members/<member>`, readable by that member alone, with provenance`qm:<id>; <provenance>`. `provenance` is one line that does not start withdiff --git a/docs/guides/write-refusals.md b/docs/guides/write-refusals.mdindex a8fdfa2b76..c9289e493e 100644--- a/docs/guides/write-refusals.md+++ b/docs/guides/write-refusals.md@@ -1006,7 +1006,7 @@ Links and the right live in the database, so they are the same on a repo-less br| Code | What happened | What to do ||---|---|---|-| <a id="actor_not_attested"></a>`actor_not_attested` | The call named a person in a way gbrain does not honour. `reason` says which: `no_attest_right` (the credential holds no attest right, or the token of an attest client was issued before the upgrade or by another grant: the message then says to take a new client-credentials token), `op_not_attested` (the operation is not in the credential's attested operations, or is not attestable yet: `list_write_conflicts`, `capture`, `extract_facts` and `takes_add|update|resolve|supersede`; also when a queued write or agent job tool call runs after its operation was removed from the list), `argument_mismatch` (the `acting_user` argument differs from the header), `argument_without_attestation` (`acting_user` came without an attested header), `invalid_actor_id` (the header or argument is not 1-256 visible ASCII characters), `actor_required` (`memory_write` named no attested person) or `audience_not_supported` (the request carries `x-qm-audience`, QM's channel audience, which is refused on every call until wave 2). Nothing was read or written. | `no_attest_right` and `op_not_attested` are the brain operator's call: `fix` carries `gbrain auth rescope --client <id> --attest-actor qm [--attest-ops <list>]`. The other five are fixed in the calling harness: send the canonical id unchanged in the header from the attest credential, the same value or nothing in `acting_user`, and no `x-qm-audience`. |+| <a id="actor_not_attested"></a>`actor_not_attested` | The call named a person in a way gbrain does not honour. `reason` says which: `no_attest_right` (the credential holds no attest right, or the token of an attest client was issued before the upgrade or by another grant: the message then says to take a new client-credentials token), `op_not_attested` (the operation is not in the credential's attested operations, or is not attestable yet: `list_write_conflicts`, `capture`, `extract_facts` and `takes_add|update|resolve|supersede`; also when a queued write or agent job tool call runs after its operation was removed from the list), `argument_mismatch` (the `acting_user` argument differs from the header, or, with no header on a credential bound to a member, names anyone but that member; its own member id or a canonical id linked to it is dropped and the call runs exactly as the credential), `argument_without_attestation` (`acting_user` came without an attested header from a credential bound to no member, over stdio, or beside an `on_behalf_of` audience), `invalid_actor_id` (the header or argument is not 1-256 visible ASCII characters), `actor_required` (`memory_write` named no attested person) or `audience_not_supported` (the request carries `x-qm-audience`, QM's channel audience, which is refused on every call until wave 2). Nothing was read or written. | `no_attest_right` and `op_not_attested` are the brain operator's call: `fix` carries `gbrain auth rescope --client <id> --attest-actor qm [--attest-ops <list>]`. The other five are fixed in the calling harness: send the canonical id unchanged in the header from the attest credential, the same value or nothing in `acting_user` (on a member-bound credential with no header: its own member id, a canonical id linked to it, or nothing), and no `x-qm-audience`. || <a id="actor_unlinked"></a>`actor_unlinked` | The id is not linked to an enabled member: never linked, unlinked, or the member is disabled or removed. Ids compare exactly, with no case folding. Nothing was read or written. A queued write or agent job made for the person is refused the same way when its link is gone or now names another member. `memory_recall` answers it as an empty success instead (`structuredContent: {facts: [], truncated: false, code: "actor_unlinked"}`), so a person not yet linked reads nothing. | The brain operator links it: `gbrain access member link <member> --qm <id>` (or `gbrain access member enable <member>`). |## Relateddiff --git a/docs/protocol/AGENT_OPERATOR_v1.md b/docs/protocol/AGENT_OPERATOR_v1.mdindex 17d3b1ea24..8e613500a5 100644--- a/docs/protocol/AGENT_OPERATOR_v1.md+++ b/docs/protocol/AGENT_OPERATOR_v1.md@@ -753,7 +753,7 @@ except the notices that describe one call's result. HTTP is stateless, sodedupe is per authenticated client and session, and `degraded` and `safety`notices ride every affected call. At most 2 `coaching` notices per session.Notices that describe one call's result (`degraded_recall`, `empty_retrieval`,-`unknown_param`, `listing_truncated`, `delta_incomplete`, `facts_unembedded`)+`listing_truncated`, `delta_incomplete`, `facts_unembedded`)are never deduped on any transport, with one exception: a `degraded_recall`whose only stages come from the brain's configuration (`embed_unavailable` ona keyless brain, which degrades every search the same way) shows once perdiff --git a/docs/protocol/MCP_META_CHANNELS.md b/docs/protocol/MCP_META_CHANNELS.mdindex 9200bd3611..8afe85a610 100644--- a/docs/protocol/MCP_META_CHANNELS.md+++ b/docs/protocol/MCP_META_CHANNELS.md@@ -33,7 +33,7 @@ shape for it.| `brain_hot_memory` | dispatch `metaHook` on stdio and HTTP (`getBrainHotMemoryMeta`, [details](#brain_hot_memory)) | Hot-memory facts relevant to the call; each fact carries `trust_tier` and `origin`, and `suppressed` (`{withheld, review}`, present only when non-zero) counts unconfirmed agent-written facts activation control withheld, never their content || `retrieval` | `search`/`query` op handlers | `returned_count`, `retrieved_count`, `vector_enabled`, `expansion_applied`, `cache`, `token_budget`, `degraded[]` (closed stage vocabulary), `rerank_degraded` (on a call whose reranker failed: `{reason, fallback: "fused_order", calls_this_session}`; reason is `timeout`, `budget`, `rate_limited`, `unreachable`, `auth` or `provider_error`; no `fields: "full"` needed), `hint` (non-contractual prose), `rows` (`"lean"` or `"full"`: the row shape of content[0]; reported for remote callers and whenever `fields` is passed), `timings` (`{total_ms, stages_ms, other_ms, overlapped_ms?, parts_ms?}`, integer ms, every response; [search-explain.md](../guides/search-explain.md#see-where-the-time-went)) || `access` | dispatch (`appliedAccessSummary`, `src/core/access/caller.ts`), every remote response that reached the operation | The view the call was answered under: `member` and `groups` it read as (null and `[]` for an unbound caller or an audience of several entries), `audience` (the normalized `on_behalf_of` principals, or null), `policy_rev` (each source's applied folder-rule revision; null on a brain with no restriction), `relaxation` (`none`, `granted_sources` or `operator`: what relaxed `visibility: private`). `whoami` returns the same object as `access.applied`. An attested call adds `actor` (`{system}`); an unlinked `memory_recall` carries `code: "actor_unlinked"`, `member: null` and the id as sent. |-| `warnings` | dispatch strict-params warn mode | `[{code: 'unknown_param', param, suggestion?}]` |+| `warnings` | dispatch strict-params warn mode | `[{code: 'unknown_param', param, suggestion?}]`: a parameter a read ignored. This is the only place the warning appears; no content block or notice carries it, so a harness that stores tool output in its turns never stores it (writes refuse unknown parameters instead). || `pagination` | `list_pages` op handler | `truncated` (more rows match), `limit` (effective), `clamped_from?` (the caller's limit when capped), `next?` (params for the following page: `{sort, updated_after, updated_after_slug}` under `updated_asc`, else `{offset}`). The model-visible counterpart is the `listing_truncated` notice block (kind `info`, never deduped), whose `fix.mcp` is the next-page call. |## `brain_hot_memory`diff --git a/llms-full.txt b/llms-full.txtindex be60d11d32..28e9762b23 100644--- a/llms-full.txt+++ b/llms-full.txt@@ -4300,7 +4300,7 @@ except the notices that describe one call's result. HTTP is stateless, sodedupe is per authenticated client and session, and `degraded` and `safety`notices ride every affected call. At most 2 `coaching` notices per session.Notices that describe one call's result (`degraded_recall`, `empty_retrieval`,-`unknown_param`, `listing_truncated`, `delta_incomplete`, `facts_unembedded`)+`listing_truncated`, `delta_incomplete`, `facts_unembedded`)are never deduped on any transport, with one exception: a `degraded_recall`whose only stages come from the brain's configuration (`embed_unavailable` ona keyless brain, which degrades every search the same way) shows once perdiff --git a/plugin-variants/gbrain-coding/skills/conventions/agent-operator-protocol.md b/plugin-variants/gbrain-coding/skills/conventions/agent-operator-protocol.mdindex f640bd75ef..344fb2f2e9 100644--- a/plugin-variants/gbrain-coding/skills/conventions/agent-operator-protocol.md+++ b/plugin-variants/gbrain-coding/skills/conventions/agent-operator-protocol.md@@ -755,7 +755,7 @@ except the notices that describe one call's result. HTTP is stateless, sodedupe is per authenticated client and session, and `degraded` and `safety`notices ride every affected call. At most 2 `coaching` notices per session.Notices that describe one call's result (`degraded_recall`, `empty_retrieval`,-`unknown_param`, `listing_truncated`, `delta_incomplete`, `facts_unembedded`)+`listing_truncated`, `delta_incomplete`, `facts_unembedded`)are never deduped on any transport, with one exception: a `degraded_recall`whose only stages come from the brain's configuration (`embed_unavailable` ona keyless brain, which degrades every search the same way) shows once perdiff --git a/plugin-variants/gbrain-daily/skills/conventions/agent-operator-protocol.md b/plugin-variants/gbrain-daily/skills/conventions/agent-operator-protocol.mdindex f640bd75ef..344fb2f2e9 100644--- a/plugin-variants/gbrain-daily/skills/conventions/agent-operator-protocol.md+++ b/plugin-variants/gbrain-daily/skills/conventions/agent-operator-protocol.md@@ -755,7 +755,7 @@ except the notices that describe one call's result. HTTP is stateless, sodedupe is per authenticated client and session, and `degraded` and `safety`notices ride every affected call. At most 2 `coaching` notices per session.Notices that describe one call's result (`degraded_recall`, `empty_retrieval`,-`unknown_param`, `listing_truncated`, `delta_incomplete`, `facts_unembedded`)+`listing_truncated`, `delta_incomplete`, `facts_unembedded`)are never deduped on any transport, with one exception: a `degraded_recall`whose only stages come from the brain's configuration (`embed_unavailable` ona keyless brain, which degrades every search the same way) shows once perdiff --git a/plugin/skills/conventions/agent-operator-protocol.md b/plugin/skills/conventions/agent-operator-protocol.mdindex f640bd75ef..344fb2f2e9 100644--- a/plugin/skills/conventions/agent-operator-protocol.md+++ b/plugin/skills/conventions/agent-operator-protocol.md@@ -755,7 +755,7 @@ except the notices that describe one call's result. HTTP is stateless, sodedupe is per authenticated client and session, and `degraded` and `safety`notices ride every affected call. At most 2 `coaching` notices per session.Notices that describe one call's result (`degraded_recall`, `empty_retrieval`,-`unknown_param`, `listing_truncated`, `delta_incomplete`, `facts_unembedded`)+`listing_truncated`, `delta_incomplete`, `facts_unembedded`)are never deduped on any transport, with one exception: a `degraded_recall`whose only stages come from the brain's configuration (`embed_unavailable` ona keyless brain, which degrades every search the same way) shows once perdiff --git a/scripts/build-qm-memory-contract.ts b/scripts/build-qm-memory-contract.tsindex b77ce3c3c6..2d7c3f7a29 100644--- a/scripts/build-qm-memory-contract.ts+++ b/scripts/build-qm-memory-contract.ts@@ -23,6 +23,10 @@ export const QM_CONTRACT_PATHS: Record<QmContractVersion, string> = {export const QM_CONTRACT_PATH = QM_CONTRACT_PATHS[1];/** The arguments v1 publishes per tool, frozen: later arguments appear from v2 on. */const V1_PARAMS: Record<string, readonly string[]> = { memory_recall: ['query', 'max_chars', 'acting_user'], memory_write: ['facts', 'idempotency_key', 'acting_user'] };+/** Catalogue summaries v1 published before they changed, frozen. */+const V1_SUMMARIES: Record<string, string> = {+ actor_not_attested: "A call named the person it serves (the x-qm-actor header or the acting_user argument) in a way gbrain does not honour: the credential holds no attest right, the operation is not in its attested operations, the argument differs from the header or comes without an attested header, or the id is not 1-256 visible ASCII characters; or a write that saves only as an attested person (memory_write) named none; or the request carries x-qm-audience, a channel audience gbrain does not serve yet. Nothing was read or written.",+};/** Who fixes each actor_not_attested reason, and how. Every reason the catalogue lists needs a row (the drift test checks). */export const ACTOR_REASON_FIXES: Record<string, { fixed_by: 'brain_operator' | 'calling_harness'; fix: string }> = {@@ -118,7 +122,7 @@ export function buildQmMemoryContract(version: QmContractVersion): Record<stringapplies_to: 'every refusal of memory_recall and memory_write, including the transport\'s scope and unknown-tool refusals',codes: codes.map(code => {const entry: { class: string; summary: string; suggestion?: string; reasons?: readonly string[]; docs?: string } = CODES[code];- return { code, class: entry.class, summary: entry.summary, ...(entry.suggestion ? { suggestion: entry.suggestion } : {}), docs: entry.docs ?? 'docs/guides/error-codes.md#' + code,+ return { code, class: entry.class, summary: (v2 ? undefined : V1_SUMMARIES[code]) ?? entry.summary, ...(entry.suggestion ? { suggestion: entry.suggestion } : {}), docs: entry.docs ?? 'docs/guides/error-codes.md#' + code,...(code === 'actor_not_attested' ? { reasons: (entry.reasons ?? []).map(reason => ({ reason, ...ACTOR_REASON_FIXES[reason], ...(v2 ? V2_REASON_FIXES[reason] : {}) })) } : {}),...(notes[code] ? { note: notes[code] } : {}) };}),diff --git a/scripts/function-size-baseline.tsv b/scripts/function-size-baseline.tsvindex b76121fd97..491c30bd73 100644--- a/scripts/function-size-baseline.tsv+++ b/scripts/function-size-baseline.tsv@@ -46,7 +46,7 @@ src/core/minions/handlers/subagent.ts runSubagentViaGateway 329 seed: W5 baselinsrc/core/minions/queue.ts MinionQueue.add 498 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)src/core/minions/queue.ts MinionQueue.add>result=this.engine.transaction(#0) 359 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)src/core/minions/worker.ts MinionWorker.start 470 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)-src/core/ops/facts.ts recall.handler 357 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +3 #4830 (W14 PR3): every hit names its source_id, falling back to the scope's single source (the federated case stays absent); +3 W5: recall threads the page-unit ranking cut into its hybrid page arm (logic in search/page-rank-cut.ts; delivery reports it); +3 #7043: copies of one claim collapse before the limit cut (the collapse lives in facts/capture-dedup.ts collapseFactReads) and the row names its entity_slugs/collapsed_count+src/core/ops/facts.ts recall.handler 358 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +3 #4830 (W14 PR3): every hit names its source_id, falling back to the scope's single source (the federated case stays absent); +3 W5: recall threads the page-unit ranking cut into its hybrid page arm (logic in search/page-rank-cut.ts; delivery reports it); +3 #7043: copies of one claim collapse before the limit cut (the collapse lives in facts/capture-dedup.ts collapseFactReads) and the row names its entity_slugs/collapsed_count; +1 HARN-15: max_chars is parsed before any read (the bound lives in boundRecallChars)src/core/ops/search.ts query.handler 338 +5 GBRA-81 item 5 per-stage search timings: the request's SearchTimings and setup-stage binding, the image branch's limit read hoisted out of the timed vector call, and its response stage wrapper (collector logic in search/stage-timings.ts); seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +2 GBRA-49 explain_target: one TargetTrace prep line and its HybridSearchOpts thread (diagnosis/meta live in prepareExplainTarget/finishExplainTarget); +1 W5 (#6445): query passes the page-unit ranking cut to hybrid search (logic in search/page-rank-cut.ts), merged with master growthsrc/core/persistence/page-prepare.ts prepareInlineOrSegmentedMutation 303 +3 #7841: a put_page that asks for visibility: private is kept or refused (visibility_not_applied), checked before the no-op test and after the trust stamp (logic in persistence/visibility-request.ts)src/core/progressive-batch/orchestrator.ts runProgressiveBatch 348 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 3950144ddc..02c4a7def9 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -47,4 +47,4 @@ src/commands/doctor/checks/extraction-sync.ts 1500 ratchet +7 GBRA-130 A-1: linksrc/core/search/evidence-delivery.ts 1759 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); new row: crossed the 1500 unlisted cap at the #6367 merge (master 1479, its explicit-budget cap) by the C1 date header threaded through every block path, cap included; pagePlanHits (search/page-plan-hits.ts) and the header loader (evidence-date.ts blockDateHeaders) were peeled first; peel candidate: allocateCapped; +8 at the #6396 merge: page evidence text cut through the fence-chunk trust overlay and the caller minTrust floor (re-summed: our 1504 + master +8); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136); +39 Wave B PR 2 lane 2b: planSegmentedBlock joins the windows search/segmented-evidence.ts reads around a segmented page's hits into one run-marked document (needs the private Doc/Piece/buildDoc/locateAnchor internals), planBlock's unit cut split into blockFromDoc for both, sections bounded by their run, selectionCost counts a gap between runs, and the fetch skips the whole-body fence overlay for a segmented page; +4 segmented pages read at once before planning (segmentedReads; the read is search/segmented-evidence.ts, the statements page-body/read-range.ts); +17 GBRA-156: tail trim plan flag, DeliverOptions.query, DeliveryMeta.tail_trim, the trim call and the frozen-hit score/query library fields (logic in search/evidence-tail-trim.ts; interface fields cannot move); +7 GBRA-205: EvidencePlan.titleHeader and DeliveryMeta.title_header (interface fields cannot move) and the titles option on the header loader (logic in search/evidence-date.ts; the query budget key lives in search/evidence-packing.ts); +11 #7600: assemble_evidence quotes conversation rows and capEvidenceToBudget counts the quote fence (logic in search/transcript-quote.ts); +2 GBRA-156 /ship review: the cut-path admission and title room count the quote fence; +2 GBRA-156 /ship review pass 2: capEvidenceToBudget counts the fence only for the paths that fence (quote flag; recall counts the text as returned); +4 GST-687: page evidence and the extractive fallback quote below-owner-tier text for untrusted readers (untrusted flag; logic in search/transcript-quote.ts)src/commands/config.ts 1524 ratchet new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 wave 16 G5.1 (#6495): set-time refusal hook for search.keyword_statement_timeout_ms (check lives in commands/config/keyword-timeout-value.ts); +1 wave 18b lane 5 (#5012 item 6): search.contextual_retrieval prints the existing-pages hint after the write (text lives in commands/config/contextual-mode-hint.ts); +1 #6712 PR 2: retired/rollback sync key dispatch line (logic in core/sync-config-keys.ts handleSyncKeyConfig); +1 #6865: sync.slug_conflicts.auto_remove boolean validation at set time (refusal text in repair/slug-autoheal.ts); +1 #6948: sync.origin_twins.auto_resolve boolean validation at set time (refusal text in repair/origin-twins-heal.ts); +2 #6795: config set chat_model/expansion_model help line and the model-pin import (shadow report and file-pin unset live in commands/config/model-pin-shadow.ts); +1 #6712 PR 4b: sync.admission set-time hook (value logic in commands/config/sync-admission-value.ts); +4 #7130: set-time refusal hook for sync.max_deletes / sync.max_delete_ratio (and .source.<id>) / purge.retention_hours (check lives in core/sync-reconcile.ts deleteSafetyConfigRefusal); +1 GBRA-150: sync.metafile_pages set-time route (body in config/sync-metafile-pages-value.ts); re-summed at the v0.60.330.0 merge (1520 measured); +2 #7242 minions.terminal_hook file-plane key and its set branch (logic in minions/terminal-hook.ts); +1 GBRA-161: generations.* set-time route (refusal in commands/config/generations-values.ts); +1 GBRA-207 #7630: sync.repo_path set-time refusal hook (refusal in core/sync-config-keys.ts syncRepoPathRefusal)src/commands/mcp-expose.ts 1519 ratchet hosted_option: Session carries the gbrain.io coaching notice on the first-receipt run and Tailscale/service friction exits (copy, refs and gating live in core/onboard/hosted-option.ts); +7 GBRA-199: --surface help lines, surfaceChosen option field and the advertise pass-through (registrationAdvertise in core/mcp-registration.ts)-src/core/behavior-change-notice.ts 1610 ratchet the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured+src/core/behavior-change-notice.ts 1614 ratchet the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +2 #7199 (re-port of #7228) classic_drift_rescreen_7199 comment and row; +2 #7931 file_drift_agrees_7931 comment and row; +1 #7950 file_drift_slug_release_7950 row; +1 #7974 file_drift_followups_7974 row; +1 #8059 quoted_fence_marker_8059 row; +2 GBRA-247 #8009 provenance_repair_held_8009 and #7982 pass_transient_streak_7982 rows; +4 GBRA-247 #7973 plain_directory_sync_7973, #7988 managed_marker_own_directory_7988, #7985 former_binding_parked_group_7985 and settle_effects_retire_7985 rows Train S merge: 1570 base + 5 (master since the #8077 base) + 13 (#8077) = 1588.; +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (re-summed at the gate-ahead on train S 0.60.534.0: 1588 + 2); +2 #8377: the quote fence follow-ups row and its comment; +2 #8384: the quote fence follow-ups 2 row and its comment; +2 #8384 wave 3: the quote fence follow-ups 3 row and its comment; +5 GBRA-218 train M rows (A1 member_read_access_gbra218 and member_access_hatch_scope_gbra218, B shared_agent_audience_gbra231, A2 folder_access_rules_gbra218, folder_access_scoped_role_gbra218), re-summed at the train M merge of master v0.60.541.0: 1596 + 5 = 1601 measured; +3 GST-359 train C rows (C1 qm_attested_actor_gst359, C2 member_facts_gst359, D qm_memory_provider_gst359), re-summed at the train C merge of master v0.60.543.0: 1601 + 3 = 1604 measured; +2 #8424: hook_launcher_8424 row and its comment (rows are data and cannot move), re-summed at the #8418 v0.60.546.0 merge: 1604 + 2 = 1606 measured; +2 #8426: mcp_lane_launcher_8426 row and its comment (rows are data and cannot move); +2 GST-927: empty_nonstring_args_gst927 row and its comment, re-summed at the gate-ahead on master v0.60.550.0 plus #8420: 1610 measured; +4 GST-1094/GST-900: the memory_recall scope-read, member-bound acting_user, recall max_chars and unknown_param _meta-only rows (since TBD until the merge slot)diff --git a/skills/conventions/agent-operator-protocol.md b/skills/conventions/agent-operator-protocol.mdindex f640bd75ef..344fb2f2e9 100644--- a/skills/conventions/agent-operator-protocol.md+++ b/skills/conventions/agent-operator-protocol.md@@ -755,7 +755,7 @@ except the notices that describe one call's result. HTTP is stateless, sodedupe is per authenticated client and session, and `degraded` and `safety`notices ride every affected call. At most 2 `coaching` notices per session.Notices that describe one call's result (`degraded_recall`, `empty_retrieval`,-`unknown_param`, `listing_truncated`, `delta_incomplete`, `facts_unembedded`)+`listing_truncated`, `delta_incomplete`, `facts_unembedded`)are never deduped on any transport, with one exception: a `degraded_recall`whose only stages come from the brain's configuration (`embed_unavailable` ona keyless brain, which degrades every search the same way) shows once perdiff --git a/skills/skills.lock.json b/skills/skills.lock.jsonindex b7092e07a6..aee4b5a6de 100644--- a/skills/skills.lock.json+++ b/skills/skills.lock.json@@ -44,7 +44,7 @@"concept-synthesis/routing-eval.jsonl": "96dbd7d9c1b606e9e06262d0c06282399741e2bccb8eeb7b9ca88c20f44cda0e","context-audit/SKILL.md": "6d786629d40544ddaab4f4e6e333569d270bcb8b581589dc16fb9f8bcb4f6207","context-audit/routing-eval.jsonl": "fb1832e24cc1b04163a74c5cde72bca53050a66246ca902e1a5f40303f52b5ab",- "conventions/agent-operator-protocol.md": "d7ea0c80658d7cf9b187d80296fe6336f6299ff5bc26b0c895f80134e5ca45c5",+ "conventions/agent-operator-protocol.md": "ff342ada7d0bd80c0aa4fda35cc5c5cba35cc89f5d82c05cb7be1e7990161ae3","conventions/brain-first.md": "e0e4d7c4b760213325dffd286baf934720816a0b6aac5338538a0463e8fe77d2","conventions/brain-routing.md": "f11c3e7c4f98163aa6c68aa7d8f09a7acb7b6a8695f42eb7d92d4ee5787d428a","conventions/calibration.md": "500dc26bd7c8400f50dc4c16fd83f1a588f3e7e68c59050a21fd8a0f69e4d198",diff --git a/src/core/access/actor.ts b/src/core/access/actor.tsindex ebb2fe6ec9..0c373aa93e 100644--- a/src/core/access/actor.ts+++ b/src/core/access/actor.ts@@ -20,7 +20,7 @@ import type { CallerAccess } from '../search/private-visibility.ts';import { identityFor } from './principals.ts';import { isMissingSchemaObject } from '../utils.ts';import { memberIdentity } from './members.ts';-import { folderAccessFor } from './caller.ts';+import { folderAccessFor, memberIdentityFor } from './caller.ts';import { ACTOR_ARGUMENT, ACTOR_DEFERRED_OPS, ACTOR_HEADER, attestRightFrom, DEFAULT_ATTEST_OPS, EXTERNAL_ID_RE, QM_AUDIENCE_HEADER, type AttestedActor, type AttestRight } from './actor-model.ts';export * from './actor-model.ts';@@ -100,7 +100,7 @@ function credentialArgv(caller: ActorCaller): string[] {const transportOf = (transport?: string) => ({ remote: true, transport: transport === 'stdio' ? 'stdio' as const : 'http' as const });/** actor_not_attested with its reason, remedy and (where the operator can fix it) the rescope command. */-export function actorNotAttested(reason: ActorReason, caller: ActorCaller, ctx: { op: string; transport?: string; right?: AttestRight | null; reissue?: boolean }): OperationError {+export function actorNotAttested(reason: ActorReason, caller: ActorCaller, ctx: { op: string; transport?: string; right?: AttestRight | null; reissue?: boolean; memberBound?: boolean }): OperationError {const docs = ERROR_CATALOGUE.actor_not_attested.docs;const rescope = (extra: string[]) => ['gbrain', 'auth', 'rescope', ...credentialArgv(caller), ...extra];const hostOnly = (message: string, argv: string[], why: string, suggestion: string) =>@@ -124,6 +124,10 @@ export function actorNotAttested(reason: ActorReason, caller: ActorCaller, ctx:'Lets an attested call run this operation as the person it names. Widening what a trusted system may do as a person is the brain operator\'s decision.',`An attested call runs only the operations the operator listed (default ${DEFAULT_ATTEST_OPS.join(', ')}); admin and membership operations never.`);case 'argument_mismatch':+ if (ctx.memberBound) {+ return opError('actor_not_attested', `The ${ACTOR_ARGUMENT} argument names someone other than this credential's member, so nothing was read or written.`,+ `Leave ${ACTOR_ARGUMENT} out, or send this credential's own member id or a canonical id linked to it. A credential bound to a member reads only as that member; text in a conversation never chooses whose notes are read.`, { reason, docs });+ }return opError('actor_not_attested', `The ${ACTOR_ARGUMENT} argument names someone other than the ${ACTOR_HEADER} header, so nothing was read or written.`,`The header decides whom the call serves; send ${ACTOR_ARGUMENT} equal to it, or leave it out. Text in a conversation never chooses whose notes are read.`, { reason, docs });case 'argument_without_attestation':@@ -227,7 +231,7 @@ export interface ActorChannels { header?: string | null; audience?: string | nulexport async function resolveAttestedActor(engine: Pick<BrainEngine, 'executeRaw'>, input: {channels?: ActorChannels; params: Record<string, unknown> | undefined; op: string; opShape: AttestableOpShape | undefined;auth?: ActorCaller['auth']; transport?: string; audienceAsserted: boolean;-}): Promise<{ actor: AttestedActor; access: Partial<CallerAccess>; params: Record<string, unknown> } | null> {+}): Promise<{ actor?: AttestedActor; access?: Partial<CallerAccess>; params: Record<string, unknown> } | null> {const header = input.channels?.header ?? undefined;const hasArgument = !!input.params && Object.prototype.hasOwnProperty.call(input.params, ACTOR_ARGUMENT);const caller: ActorCaller = { auth: input.auth };@@ -238,7 +242,7 @@ export async function resolveAttestedActor(engine: Pick<BrainEngine, 'executeRawif ((header !== undefined && !EXTERNAL_ID_RE.test(header)) || (hasArgument && (typeof argument !== 'string' || !EXTERNAL_ID_RE.test(argument)))) {throw actorNotAttested('invalid_actor_id', caller, ctx);}- if (header === undefined) throw actorNotAttested('argument_without_attestation', caller, ctx);+ if (header === undefined) return ownMemberArgument(engine, input, argument as string, caller, ctx);if (input.audienceAsserted) {throw catalogueError('on_behalf_of_invalid_audience', `The call names its person twice (${ACTOR_HEADER} and an on_behalf_of audience). Nothing was read.`,`Send one: ${ACTOR_HEADER} from an attest credential, or X-Gbrain-On-Behalf-Of / request-level _meta.on_behalf_of from a shared agent.`);@@ -257,6 +261,22 @@ export async function resolveAttestedActor(engine: Pick<BrainEngine, 'executeRawreturn { actor, access: await attestedCallerAccess(engine, actor, covered.identity), params };}+/**+ * GST-900: acting_user with no header, on a credential bound to a member (no stdio, no on_behalf_of audience). The+ * member id, or a canonical id linked to it, is stripped and the call runs exactly as the credential; any other value+ * is argument_mismatch, so the argument never widens or switches whose notes are read, and never tells an existing id+ * from an unknown one. Every other caller is refused argument_without_attestation as before.+ */+async function ownMemberArgument(engine: Pick<BrainEngine, 'executeRaw'>, input: { params?: Record<string, unknown>; auth?: ActorCaller['auth']; transport?: string; audienceAsserted: boolean },+ argument: string, caller: ActorCaller, ctx: { op: string; transport?: string }): Promise<{ params: Record<string, unknown> }> {+ const own = input.transport === 'stdio' || input.audienceAsserted || !input.auth ? null+ : (await memberIdentityFor(engine, input.auth)).find(p => p.startsWith('member:'))?.slice('member:'.length) ?? null;+ if (!own) throw actorNotAttested('argument_without_attestation', caller, ctx);+ if (argument !== own && (await linkedMember(engine, 'qm', argument))?.member !== own) throw actorNotAttested('argument_mismatch', caller, { ...ctx, memberBound: true });+ const { [ACTOR_ARGUMENT]: _stripped, ...params } = input.params ?? {};+ return { params };+}+export interface MemberLink { system: string; external_id: string; member_id: string; created_at: string | null }function linkInvalid(message: string, reason: string, suggestion: string): OperationError {diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex 727fa1fb23..3e70413583 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -1412,6 +1412,10 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;{ since: '0.60.550.0', id: 'mcp_lane_launcher_8426', text: 'The stdio MCP entry `gbrain setup claude-code|codex` and `gbrain bootstrap hooks` (opencode\'s user-global entry included) register now starts `gbrain serve` through `<gbrain config dir>/hook-launcher/gbrain-hook`, and the hooks from `gbrain bootstrap hooks`, `gbrain bootstrap harness`, the Codex SessionEnd capture and the gbrain plugins start gbrain from the launcher\'s or the plugin\'s own directory, so a session opened in a cloned repository never runs that repository\'s bunfig.toml preload or loads its .env; serve still reads .gbrain-source from the session directory. `gbrain post-upgrade` moves a Claude Code setup MCP entry setup still owns and names the command for every Codex (the turn-rule hook included) and bootstrap entry, doctor `hook_session_cwd` covers them, and `gbrain hook` git probes skip core.fsmonitor and run only in the workspace the install receipt names.' },// GST-927 (GBRA-280) schema-ruled-out empty arguments; release:restamp stamps since at the merge slot.{ since: '0.60.553.0', id: 'empty_nonstring_args_gst927', text: 'Read tools now treat an optional argument as not provided when its own schema rules the value out: 0 where the range starts above zero (limit: 0, around_chunk_id: 0, schema_version: 0 and others), [] where the list must not be empty (types, only, traverse_graph hops), {} where the object needs a field (get_page lines and bytes), false on get_versions diff, and get_page context without grep. These calls used to refuse with invalid_params; now they answer as if the argument were left out. get_page known_as_of beside window or view arguments still refuses, and the refusal names the arguments to drop.' },+ { since: 'TBD', id: 'memory_recall_scope_read_gst1094', text: '`memory_recall` now takes `source_id` and `source_ids`. A call that names sources reads as their audience, never as the attested person: no own recent facts first and no fact from any member page; a page restricted to named readers stays hidden and `visibility: private` is never relaxed. A source outside the credential\'s read grant is refused (`permission_denied`) and `__all__` is refused (`invalid_params`). Without sources, `memory_recall` is unchanged. The contract is `docs/contracts/qm-memory-provider/v2.json`; `v1.json` is unchanged.' },+ { since: 'TBD', id: 'member_bound_acting_user_gst900', text: 'A credential bound to a member may now send `acting_user` with no `x-qm-actor` header: its own member id, or a canonical id linked to that member, is dropped and the call runs exactly as the credential; any other value is refused (`actor_not_attested` reason `argument_mismatch`). A credential bound to no member is still refused (`argument_without_attestation`).' },+ { since: 'TBD', id: 'recall_max_chars_harn15', text: '`recall` now takes `max_chars` (a whole number from 200 to 12000, as `memory_recall`): it keeps the whole facts, then results, whose text fits, adds no marker and returns `truncated`; without it `recall` is unchanged.' },+ { since: 'TBD', id: 'unknown_param_meta_only_harn15', text: 'A read that ignores a parameter the tool does not declare (`mcp.strict_params` `warn`, the default) no longer adds a `[gbrain notice unknown_param kind=info]` text block to the result: the warning is only in `_meta.warnings` (`{code: \'unknown_param\', param, suggestion?}`), so a harness that stores tool output in its turns never stores it. Writes still refuse unknown parameters, and `reject` mode is unchanged.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --git a/src/core/error-registry.ts b/src/core/error-registry.tsindex 3bfd94f6ea..9c42093632 100644--- a/src/core/error-registry.ts+++ b/src/core/error-registry.ts@@ -68,7 +68,7 @@ export const CODES = {on_behalf_of_invalid_audience: { class: 'caller', summary: "A shared agent's request named its audience (the X-Gbrain-On-Behalf-Of header or request-level _meta.on_behalf_of) in a form gbrain does not accept: empty, more than 50 entries, an entry that is not a member id, group:<id> or guest, or a header and _meta that name different audiences. Nothing was read.", why: 'The audience decides whose notes the agent may read, so an audience gbrain cannot read exactly is refused instead of guessed.', docs: 'docs/guides/write-refusals.md#on_behalf_of_invalid_audience', suggestion: 'Fix the harness code that sets the audience: 1-50 entries, each a member id, group:<id> or guest, the same in the header and _meta when both are sent.' },on_behalf_of_unknown_member: { class: 'caller', summary: "A shared agent's audience names a member who is not enabled on this brain, or a group that does not exist, so nothing was read.", why: 'An unknown or disabled entry is refused rather than read as a guest, so a typo or a removed person never quietly changes what the agent reads.', docs: 'docs/guides/write-refusals.md#on_behalf_of_unknown_member', suggestion: 'Name enabled members and existing groups only (gbrain access member list --all, gbrain access group list on the brain host); a person who is not a member joins the audience as guest.' },on_behalf_of_not_permitted: { class: 'host_only', actor: 'user', summary: "A shared agent asserted an audience its credential's may_act_for does not list (for a stdio server, config mcp.stdio_may_act_for), so nothing was read.", why: 'A shared agent acts only for the people the brain operator approved for its credential; widening that list is the operator\'s decision, never the agent\'s.', docs: 'docs/guides/write-refusals.md#on_behalf_of_not_permitted', suggestion: 'The brain operator decides whether to approve the audience: gbrain auth rescope --token <name>|--client <id> --may-act-for <list> on the brain host. Until then, call without the audience.' },- actor_not_attested: { class: 'host_only', actor: 'user', reasons: ['no_attest_right', 'op_not_attested', 'argument_mismatch', 'argument_without_attestation', 'invalid_actor_id', 'actor_required', 'audience_not_supported'], summary: "A call named the person it serves (the x-qm-actor header or the acting_user argument) in a way gbrain does not honour: the credential holds no attest right, the operation is not in its attested operations, the argument differs from the header or comes without an attested header, or the id is not 1-256 visible ASCII characters; or a write that saves only as an attested person (memory_write) named none; or the request carries x-qm-audience, a channel audience gbrain does not serve yet. Nothing was read or written.", why: 'Naming a person decides whose notes are read and written as; only a credential the brain operator granted the attest right may do it, only for the operations it lists, and text in a conversation never chooses it.', docs: 'docs/guides/write-refusals.md#actor_not_attested', suggestion: 'Read reason: no_attest_right and op_not_attested are the brain operator\'s call (gbrain auth rescope --client <id> --attest-actor qm [--attest-ops <list>]); argument_mismatch, argument_without_attestation, invalid_actor_id, actor_required and audience_not_supported are fixed in the calling harness.' },+ actor_not_attested: { class: 'host_only', actor: 'user', reasons: ['no_attest_right', 'op_not_attested', 'argument_mismatch', 'argument_without_attestation', 'invalid_actor_id', 'actor_required', 'audience_not_supported'], summary: "A call named the person it serves (the x-qm-actor header or the acting_user argument) in a way gbrain does not honour: the credential holds no attest right, the operation is not in its attested operations, the argument differs from the header, names anyone but a member-bound credential's own member, or comes without an attested header from a credential bound to no member, or the id is not 1-256 visible ASCII characters; or a write that saves only as an attested person (memory_write) named none; or the request carries x-qm-audience, a channel audience gbrain does not serve yet. Nothing was read or written.", why: 'Naming a person decides whose notes are read and written as; only a credential the brain operator granted the attest right may do it, only for the operations it lists, and text in a conversation never chooses it.', docs: 'docs/guides/write-refusals.md#actor_not_attested', suggestion: 'Read reason: no_attest_right and op_not_attested are the brain operator\'s call (gbrain auth rescope --client <id> --attest-actor qm [--attest-ops <list>]); argument_mismatch, argument_without_attestation, invalid_actor_id, actor_required and audience_not_supported are fixed in the calling harness.' },actor_unlinked: { class: 'host_only', actor: 'user', summary: 'An attested call named a person whose canonical id is not linked to an enabled member of this brain (never linked, unlinked, or the member is disabled or removed), so nothing was read or written.', why: 'An attested call reads and writes as exactly one member; an unknown person is refused rather than read as a guest, and unlinking or disabling takes effect on the next call.', docs: 'docs/guides/write-refusals.md#actor_unlinked', suggestion: 'The brain operator links the id to its member: gbrain access member link <member> --qm <id> (or enables the member).' },on_behalf_of_in_arguments: { class: 'caller', summary: 'A tool call carried on_behalf_of inside its arguments, where conversation text could set it, so it was refused and nothing was read.', why: 'Only harness code may name whose notes a shared agent reads: the X-Gbrain-On-Behalf-Of header or request-level _meta.on_behalf_of, never tool arguments.', docs: 'docs/guides/write-refusals.md#on_behalf_of_in_arguments', suggestion: 'Remove on_behalf_of from the tool arguments. Harness code sends it as the X-Gbrain-On-Behalf-Of header or request-level _meta.on_behalf_of; other stdio clients use a credential bound to one member or config mcp.stdio_member.' },access_policy_invalid: { class: 'host_only', actor: 'user', docs: 'docs/guides/write-refusals.md#access_policy_invalid', summary: "A source's folder-rule policy (the committed .gbrain/access.yml, or a file given to gbrain access rule import) does not validate, so it was not applied: the last applied rules stay in force and every prefix the bad file names reads as nobody (the whole source when its prefixes cannot be read).", why: 'A typo in an access file must never open a folder: an unreadable revision keeps the previous rules and hides what it touches until it is fixed.', suggestion: 'Show each problem with its line (gbrain access rule list --source <id>). Fix the file, commit it with gbrain git commit-push and sync the source (gbrain sync --source <id> --no-pull).', fix: { argv: ['gbrain', 'access', 'rule', 'list', '--source', '{source_id}', '--json'], consent: [], actor: 'agent', requires_exclusive: false, why: 'Lists the applied rules and each problem in the policy file with its line; changes nothing.' } },diff --git a/src/core/operation-manifest.generated.ts b/src/core/operation-manifest.generated.tsindex e650f0cdcb..791d1713d6 100644--- a/src/core/operation-manifest.generated.ts+++ b/src/core/operation-manifest.generated.ts@@ -5806,6 +5806,10 @@ export const OPERATION_MANIFEST: OperationMeta[] = [],"description": "Lowest trust tier to return (the connection floor still applies).","fullSurfaceOnly": true+ },+ "max_chars": {+ "type": "integer",+ "description": "Cap on fact (then results) text, 200-12000; whole items only, truncated says if cut."}},"scope": "read",@@ -6177,6 +6181,17 @@ export const OPERATION_MANIFEST: OperationMeta[] = ["type": "string","description": "Set by the trusted system: equal to the x-qm-actor header, or omit.","fullSurfaceOnly": true+ },+ "source_id": {+ "type": "string",+ "description": "Read this one source as its audience (a shared scope): never the person's own facts."+ },+ "source_ids": {+ "type": "array",+ "items": {+ "type": "string"+ },+ "description": "Read only these sources as their audience (a shared scope): never the person's own facts."}},"scope": "read",diff --git a/src/core/ops/facts.ts b/src/core/ops/facts.tsindex 4b6f24f2ab..037a341bd4 100644--- a/src/core/ops/facts.ts+++ b/src/core/ops/facts.ts@@ -29,6 +29,7 @@ import { OperationError, opError, verbError } from './contract.ts';import { invalidParam, paramUse } from './op-fix.ts';import { parseSourceIdParam, sourceScopeOpts, stampEvidenceSafe } from './context.ts';import { parseSourceIdsParam, requestSourceScope, SOURCE_IDS_PARAM } from './search-source-scope.ts';+import { boundFactLines, MEMORY_RECALL_MAX_CHARS, parseMaxChars } from './qm-memory.ts';import { markKeywordHits } from '../search/evidence.ts';import { hybridSearchCached, stampContentFlags, type HybridSearchOpts } from '../search/hybrid.ts';import { dedupResults } from '../search/dedup.ts';@@ -309,11 +310,13 @@ const recall: Operation = {return_unit: { type: 'string', enum: ['chunk', 'window', 'section', 'page', 'auto'], description: 'results[] unit (see search).', fullSurfaceOnly: true },return_window: { type: 'number', description: 'Window 1-3.', fullSurfaceOnly: true },min_trust: MIN_TRUST_PARAM,+ max_chars: { type: 'integer', description: `Cap on fact (then results) text, ${MEMORY_RECALL_MAX_CHARS.min}-${MEMORY_RECALL_MAX_CHARS.max}; whole items only, truncated says if cut.` },},scope: 'read',verb: true,annotations: { title: 'recall (memory read)', readOnlyHint: true },handler: async (ctx, p) => {+ const maxChars = p.max_chars === undefined || p.max_chars === null ? null : parseMaxChars(p.max_chars);const sourceId = ctx.sourceId ?? 'default';const limit = clampRecallLimit(p.limit);const includeExpired = p.include_expired === true;@@ -668,10 +671,22 @@ const recall: Operation = {...(delivery ? { delivery } : {}),};recordRecallOutcome(out);- return out;+ return maxChars === null ? out : boundRecallChars(out, maxChars);},};+/**+ * GST-900: recall's max_chars, memory_recall's bound on recall's text: the fact texts, then the results' chunk texts,+ * one per line, keep the whole items that fit; the first item that would cross the cap ends both lists, with no+ * marker. `truncated` says whether anything was cut and `total` counts the facts kept.+ */+function boundRecallChars<T extends { facts: Array<{ fact: string }>; total: number; results?: Array<{ chunk?: unknown }> }>(out: T, maxChars: number): T & { truncated: boolean } {+ const lines = [...out.facts.map(f => f.fact), ...(out.results ?? []).map(r => String(r.chunk ?? ''))];+ const { kept } = boundFactLines(lines, maxChars);+ const facts = out.facts.slice(0, kept);+ return { ...out, facts, total: facts.length, ...(out.results ? { results: out.results.slice(0, Math.max(0, kept - out.facts.length)) } : {}), truncated: kept < lines.length };+}+/*** One source's facts about an entity, read under every slug they may be saved* under (the page, its identity siblings and its bare subject slug,diff --git a/src/core/ops/qm-memory.ts b/src/core/ops/qm-memory.tsindex 8c33b44f63..b73e73d702 100644--- a/src/core/ops/qm-memory.ts+++ b/src/core/ops/qm-memory.ts@@ -89,7 +89,7 @@ export function isoDate(value: Date | string | null | undefined): string {const invalid = (message: string, suggestion: string): OperationError => opError('invalid_params', message, suggestion);-function parseMaxChars(raw: unknown): number {+export function parseMaxChars(raw: unknown): number {if (raw === undefined || raw === null) return MEMORY_RECALL_MAX_CHARS.default;const { min, max } = MEMORY_RECALL_MAX_CHARS;if (typeof raw !== 'number' || !Number.isInteger(raw) || raw < min || raw > max) {diff --git a/src/mcp/dispatch.ts b/src/mcp/dispatch.tsindex c1918c969b..1c9727cc2e 100644--- a/src/mcp/dispatch.ts+++ b/src/mcp/dispatch.ts@@ -47,7 +47,6 @@ import {findInvalidParam,schemaInvalidParams,findUnknownParams,- buildUnknownParamWarnBlock,resolveStrictParamsMode,} from './validate-params.ts';import { backupCheckDisabled, backupNagGate, backupNoticeText, loadBackupStatus } from '../core/backup/status-file.ts';@@ -927,7 +926,7 @@ export async function dispatchToolCall(const header = opts.actor?.header ?? undefined;const actorNamed = header !== undefined || opts.actor?.audience != null || (!!args && Object.prototype.hasOwnProperty.call(args, ACTOR_ARGUMENT));const assertion = (outcome: AudienceAuditEvent['outcome'], reason?: string) => logAudienceAssertion({ outcome, op: name,- audience: [...(attested?.access.audience ?? audience ?? [])], transport: opts.transport ?? 'unknown',+ audience: [...(attested?.access?.audience ?? audience ?? [])], transport: opts.transport ?? 'unknown',principal: opts.auth?.principal ? `${opts.auth.principal.kind}:${opts.auth.principal.id}` : opts.transport === 'stdio' ? 'local_stdio' : 'unknown',...(actorNamed ? { actor: { system: 'qm', ...(header && EXTERNAL_ID_RE.test(header) ? { external_id: header } : {}), ...(reason ? { reason } : {}) } } : {}) });try {@@ -935,7 +934,7 @@ export async function dispatchToolCall(audience = parseAudience(opts.onBehalfOf);attested = await resolveAttestedActor(engine, { channels: opts.actor, params: args, op: name, opShape: op,auth: opts.auth, transport: opts.transport, audienceAsserted: audience !== null });- access = attested ? attested.access : await remoteCallerAccess(engine, opts.auth, privateSources, opts.transport, audience);+ access = attested?.access ?? await remoteCallerAccess(engine, opts.auth, privateSources, opts.transport, audience);} catch (e) {// GST-359: a call that names a person gets every failure here (a lock timeout reading its link included) in the// envelope QM reads, never a thrown call; anything else keeps the caller's own error path.@@ -946,7 +945,7 @@ export async function dispatchToolCall(assertion(e.code as AudienceAuditEvent['outcome'], e.reason);return qmMemoryToolResult(name, actorNamed ? actorRefusal(e, opts, name, header, args) : errorResult(e, opts, { op: name }));}- if (audience || attested) assertion('accepted');+ if (audience || attested?.actor) assertion('accepted');const callParams = attested ? attested.params : args;return withCallerAccess(access, async () => {const out = await withRequestIdentityMemo(() => dispatchResolvedCall(engine, name, callParams, resolved));@@ -1240,12 +1239,6 @@ async function dispatchResolvedCall(// Cat 40 (#5932) evidence blocks (type-filter notice, other names, saved facts) are retrieval// data, not advice: they stay plain extra text blocks right after content[0], as measured.const evidenceBlocks = retrievalNoticeBlocks(result, responseMeta.retrieval).slice(emptyBlock ? 1 : 0);- // WP3/D8: warn-mode unknown-param notices ride the same channel, so the- // grace period actually corrects clients (old thin-clients read content[0]- // only — skew-safe). One notice per ignored parameter.- for (const w of unknownParamWarnings) {- notices.push({ code: 'unknown_param', kind: 'info', why: buildUnknownParamWarnBlock([w]) });- }// Lane F (F3): degraded recall and a source binding that narrowed an empty read.const rerankDegradedCalls = recordRerankDegradation(responseMeta, opts);notices.push(...recallInteropNotices(name, result, responseMeta, safeParams,diff --git a/src/mcp/validate-params.ts b/src/mcp/validate-params.tsindex 504db54980..e094ebb812 100644--- a/src/mcp/validate-params.ts+++ b/src/mcp/validate-params.ts@@ -232,10 +232,10 @@ export function findUnknownParams(op: Operation, params: Record<string, unknown>}/**- * Render the model-visible warn-mode notice lines (one per unknown key) that- * dispatch appends as an extra text content block on the RESULT — the same- * D8 second-block mechanism that carries empty-retrieval loudness, so the- * grace period actually corrects clients instead of warning into a void.+ * The warn-mode notice lines (one per unknown key) hosts before GST-900 appended+ * as an extra content block. Dispatch no longer sends it (the warning lives in+ * `_meta.warnings` only, so harnesses never store it in a turn); it stays the+ * reference for the old-host block `ignoredRemoteParams` still parses.*/export function buildUnknownParamWarnBlock(warnings: UnknownParamWarning[]): string {return warningsdiff --git a/test/access-qm-actor.test.ts b/test/access-qm-actor.test.tsindex dd58088d71..8243279fec 100644--- a/test/access-qm-actor.test.ts+++ b/test/access-qm-actor.test.ts@@ -97,7 +97,7 @@ for (const kind of testBackends()) {const text = out.content.map(c => c.text).join('\n');let json: Record<string, unknown> = {};try { json = JSON.parse(text); } catch { /* prose */ }- return { isError: out.isError === true, text, json, meta: out._meta, structured: out.structuredContent as { error?: Record<string, unknown> } | undefined };+ return { isError: out.isError === true, text, first: out.content[0]?.text, json, meta: out._meta, structured: out.structuredContent as { error?: Record<string, unknown> } | undefined };}const qm = () => clients.qm!.token;const getAs = (actor: string | undefined, key: Key, bearer = qm(), extra: Record<string, unknown> = {}) =>@@ -128,7 +128,12 @@ for (const kind of testBackends()) {await register('plain');await bindCredential(engine, { kind: 'client', id: await register('defaults') }, { attestActor: 'qm' });await register('code', ['authorization_code']);- for (const name of ['qm', 'plain', 'defaults']) await issue(name);+ await bindCredential(engine, { kind: 'client', id: await register('alice') }, { member: 'alice-example' });+ await bindCredential(engine, { kind: 'client', id: await register('agent') }, { mayActFor: ['member:alice-example', 'member:bob-example'] });+ for (const name of ['qm', 'plain', 'defaults', 'alice', 'agent']) await issue(name);+ const aliceLegacy = await mintLegacyToken(engine, { name: 'qm-alice-legacy', scopes: ['read', 'write'], takesHolders: ['world'], sourceGrant: [SRC] });+ tokens.aliceLegacy = { id: aliceLegacy.id, token: aliceLegacy.token };+ await bindCredential(engine, { kind: 'token', id: aliceLegacy.id }, { member: 'alice-example' });await engine.executeRaw("UPDATE oauth_clients SET private_pages = 'granted_sources' WHERE client_id = $1", [clients.qm!.id]);const minted = await mintLegacyToken(engine, { name: 'qm-legacy', scopes: ['read', 'write'], takesHolders: ['world'], sourceGrant: [SRC] });tokens.legacy = { id: minted.id, token: minted.token };@@ -219,6 +224,43 @@ for (const kind of testBackends()) {await refused(getAs(ALICE_ID, 'alice', qm(), { acting_user: 7 }), 'actor_not_attested', 'invalid_actor_id');}, 120_000);+ test('HARN-1: on a member-bound credential, acting_user naming its own member runs exactly as the token; anyone else is argument_mismatch', async () => {+ const canaries = (text: string) => (Object.keys(PAGES) as Key[]).filter(k => text.includes(PAGES[k].canary));+ for (const bearer of [clients.alice!.token, tokens.aliceLegacy!.token]) {+ expect((await getAs(undefined, 'alice', bearer)).text).toContain(PAGES.alice.canary);+ for (const key of Object.keys(PAGES) as Key[]) {+ const plain = await getAs(undefined, key, bearer);+ for (const id of ['alice-example', ALICE_ID, OIDC_ID]) {+ const named = await getAs(undefined, key, bearer, { acting_user: id });+ expect({ isError: named.isError, first: named.first }).toEqual({ isError: plain.isError, first: plain.first });+ expect(named.meta?.access).toEqual(plain.meta?.access);+ expect(named.text).not.toContain('acting_user');+ expect(JSON.stringify(named.meta?.warnings ?? [])).not.toContain('acting_user');+ }+ }+ const search = (extra: Record<string, unknown>) => call(bearer, 'search', { query: 'harbor ledger qm notes', match: 'keyword', fields: 'full', limit: 30, ...extra });+ const own = canaries((await search({})).text);+ expect(own).toEqual(expect.arrayContaining(['alice', 'both', 'open']));+ expect(own).not.toContain('bob');+ expect(canaries((await search({ acting_user: 'alice-example' })).text)).toEqual(own);+ expect(canaries((await search({ acting_user: ALICE_ID })).text)).toEqual(own);+ for (const id of ['bob-example', BOB_ID, 'dan-example', 'nobody-example', 'U0NOBODY']) {+ for (const key of ['bob', 'alice'] as Key[]) await refused(getAs(undefined, key, bearer, { acting_user: id }), 'actor_not_attested', 'argument_mismatch');+ await refused(search({ acting_user: id }), 'actor_not_attested', 'argument_mismatch');+ }+ await refused(getAs(ALICE_ID, 'alice', bearer, { acting_user: ALICE_ID }), 'actor_not_attested', 'argument_without_attestation');+ await refused(call(bearer, 'get_page', { slug: PAGES.alice.slug, acting_user: 'alice-example' }, { obo: 'alice-example' }), 'actor_not_attested', 'argument_without_attestation');+ }+ }, 120_000);++ test('HARN-1: acting_user never widens a credential bound to no member: a may_act_for credential, a bare credential and stdio are refused', async () => {+ for (const id of ['alice-example', ALICE_ID, 'bob-example']) {+ for (const bearer of [clients.agent!.token, clients.plain!.token, null]) {+ await refused(call(bearer, 'get_page', { slug: PAGES.alice.slug, acting_user: id }), 'actor_not_attested', 'argument_without_attestation');+ }+ }+ }, 60_000);+test('the right follows the token\'s grant: an authorization-code token of an attest client is not attested', async () => {const hash = createHash('sha256').update(qm()).digest('hex');await engine.executeRaw("UPDATE oauth_tokens SET grant_type = 'authorization_code' WHERE token_hash = $1", [hash]);diff --git a/test/e2e/serve-http-oauth.test.ts b/test/e2e/serve-http-oauth.test.tsindex 449a27e2f2..d6f831f107 100644--- a/test/e2e/serve-http-oauth.test.ts+++ b/test/e2e/serve-http-oauth.test.ts@@ -1662,9 +1662,9 @@ describeE2E('serve-http OAuth 2.1 E2E (v0.26.1 + v0.26.2 + v0.26.3)', () => {const warnings = warned._meta?.warnings;expect(Array.isArray(warnings)).toBe(true);expect(warnings.some((w: any) => w.code === 'unknown_param' && w.param === 'bogus_unknown_param')).toBe(true);- // The model-visible warn notice rides as an extra content block (D8).- expect(warned.content.some((c: any) => typeof c.text === 'string'- && c.text.includes('unknown parameter "bogus_unknown_param"'))).toBe(true);+ // HARN-15: the warning lives in _meta.warnings only; no content block names it.+ expect(JSON.stringify(warned.content)).not.toContain('bogus_unknown_param');+ expect(JSON.stringify(warned.content)).not.toContain('unknown_param');// Control (anti-vacuity): same op with only declared params.const clean = await mcpToolResult(token, 'tools/call', {diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.jsonindex a6bd83ffc0..59c0a17a68 100644--- a/test/fixtures/goldens/cli/tools-json.json+++ b/test/fixtures/goldens/cli/tools-json.json@@ -2,8 +2,8 @@"golden": {"exitCode": 0,"stderr": "",- "stdoutBytes": 268798,- "stdoutSha256": "7e8ad692baa54268f6f79bf3109bfb03bf6c29119f65624e8847aff30963f591",+ "stdoutBytes": 269480,+ "stdoutSha256": "a5efd152d5b57d8cab862c842421d4b321090631a5c72139cc5d1195e2849563","toolNames": ["remember","entity",@@ -6658,6 +6658,7 @@"include_expired": "boolean?","include_pending": "boolean?","limit": "number?",+ "max_chars": "integer?","min_trust": "string?","query": "string?","question": "string?",@@ -6704,6 +6705,10 @@"description": "Per-arm max (default 50, cap 100).","type": "number"},+ "max_chars": {+ "description": "Cap on fact (then results) text, 200-12000; whole items only, truncated says if cut.",+ "type": "integer"+ },"min_trust": {"description": "Lowest trust tier to return (the connection floor still applies).","enum": [@@ -7116,7 +7121,9 @@"parameters": {"acting_user": "string?","max_chars": "integer?",- "query": "string"+ "query": "string",+ "source_id": "string?",+ "source_ids": "array?"},"required_scopes": [],"schema": {@@ -7132,6 +7139,17 @@"query": {"description": "What the turn is about; ranks the facts.","type": "string"+ },+ "source_id": {+ "description": "Read this one source as its audience (a shared scope): never the person's own facts.",+ "type": "string"+ },+ "source_ids": {+ "description": "Read only these sources as their audience (a shared scope): never the person's own facts.",+ "items": {+ "type": "string"+ },+ "type": "array"}},"required": [diff --git a/test/qm-memory-tools.test.ts b/test/qm-memory-tools.test.tsindex c83dad1ba4..0aff9c570e 100644--- a/test/qm-memory-tools.test.ts+++ b/test/qm-memory-tools.test.ts@@ -432,6 +432,45 @@ for (const kind of testBackends()) {expect(unlinked.structured).toEqual({ facts: [], truncated: false, code: 'actor_unlinked' });}, 120_000);+ test('generic recall takes max_chars: whole facts in order, no marker, structured truncated, invalid values refused; without it recall is unchanged (HARN-15)', async () => {+ const ENTITY = 'companies/harn-recall-example';+ for (let i = 0; i < 12; i++) {+ await engine.insertFact({ fact: 'Harn recall world fact ' + String(i).padStart(2, '0') + ' ' + 'ledger detail '.repeat(6) + 'canaryharnrecall', kind: 'fact', entity_slug: ENTITY, source: 'test', visibility: 'world' }, { source_id: SRC });+ }+ const recallAll = (args: Record<string, unknown> = {}) => call({ token: 'plain' }, 'recall', { entity: ENTITY, ...args });+ const base = await recallAll();+ expect(base.isError).toBe(false);+ expect(base.json.facts.length).toBe(12);+ expect('truncated' in base.json).toBe(false);+ expect(base.json.total).toBe(12);+ const again = await recallAll();+ expect(Object.keys(again.json).sort()).toEqual(Object.keys(base.json).sort());+ const baseIds = base.json.facts.map((f: { id: number }) => f.id);+ for (const max_chars of [500, 1000, 1500]) {+ const out = await recallAll({ max_chars });+ expect(out.isError).toBe(false);+ const facts = out.json.facts as Array<{ id: number; fact: string }>;+ expect(facts.length).toBeGreaterThan(0);+ expect(facts.length).toBeLessThan(12);+ expect(facts.map(f => f.fact).join('\n').length).toBeLessThanOrEqual(max_chars);+ expect(facts.map(f => f.id)).toEqual(baseIds.slice(0, facts.length));+ const next = base.json.facts[facts.length].fact as string;+ expect(facts.map(f => f.fact).join('\n').length + 1 + next.length).toBeGreaterThan(max_chars);+ expect(out.json.truncated).toBe(true);+ expect(out.json.total).toBe(facts.length);+ expect(out.text).not.toMatch(/\d+ more|truncated at/i);+ }+ const roomy = await recallAll({ max_chars: MEMORY_RECALL_MAX_CHARS.max });+ expect(roomy.json.truncated).toBe(false);+ expect(roomy.json.facts.map((f: { id: number }) => f.id)).toEqual(baseIds);+ for (const max_chars of [199, 12_001, 500.5, '600']) {+ const out = await recallAll({ max_chars });+ expect(out.isError).toBe(true);+ expect(out.json.code ?? out.json.error).toBe('invalid_params');+ expect(out.text).not.toContain('canaryharnrecall');+ }+ }, 120_000);+test('an unlinked person gets an empty success whose code rides structuredContent only', async () => {const out = await recall({ token: 'qm', actor: 'U0NOBODY' }, 'budget ledger');expect(out.isError).toBe(false);diff --git a/test/truthful-catalog.e2e-lite.test.ts b/test/truthful-catalog.e2e-lite.test.tsindex d9c47563ba..391c5f4970 100644--- a/test/truthful-catalog.e2e-lite.test.ts+++ b/test/truthful-catalog.e2e-lite.test.ts@@ -462,9 +462,9 @@ describe('E5 truthful catalog — legacy bearer transport (real HTTP, PGLite)',const meta = result._meta as { warnings?: Array<{ code: string; param: string }> } | undefined;expect(meta?.warnings?.[0]?.code).toBe('unknown_param');expect(meta?.warnings?.[0]?.param).toBe('e5_garbage_probe');- // The model-visible grace-period notice rides the second content block.+ // HARN-15: the warning lives in _meta.warnings only; no content block names it.const blocks = result.content.map(c => c.text);- expect(blocks.some(t => t.includes('unknown parameter "e5_garbage_probe"'))).toBe(true);+ expect(blocks.some(t => t.includes('e5_garbage_probe'))).toBe(false);} finally {await engine.setConfig('mcp.strict_params', 'reject');}diff --git a/test/validate-params.test.ts b/test/validate-params.test.tsindex 9b55768cdd..72cae64491 100644--- a/test/validate-params.test.ts+++ b/test/validate-params.test.ts@@ -88,7 +88,7 @@ describe('normalize→validate order (absence idioms are not unknown keys)', ()// 2. warn mode// ----------------------------------------------------------------------------describe('warn mode (default) — accept + _meta.warnings + model-visible block', () => {+describe('warn mode (default) — accept + _meta.warnings only, never a content block', () => {test('unknown key collected with amendment-13 shape and nearest-declared suggestion', async () => {const out = await dispatchToolCall(stubEngine('warn'), 'resolve_slugs', {partial: 'alice-ex',@@ -98,12 +98,10 @@ describe('warn mode (default) — accept + _meta.warnings + model-visible block'expect(out._meta?.warnings).toEqual([{ code: 'unknown_param', param: 'partal', suggestion: 'partial' },]);- // D8 second-block mechanism carries the grace-period notice.- expect(out.content.length).toBe(2);- // Agent contract v1: the block rides the notice channel (prefix line), its text kept as `why:`.- expect(out.content[1].text).toBe(- '[gbrain notice unknown_param kind=info]\nwhy: warning: unknown parameter "partal" ignored — did you mean "partial"? A future release rejects unknown parameters.',- );+ // HARN-15: the warning rides _meta.warnings alone; harnesses store content in the turn, so no block is added.+ expect(out.content.length).toBe(1);+ expect(JSON.stringify(out.content)).not.toContain('partal');+ expect(out._meta?.gbrain_notices).toBeUndefined();});test('unresolved (absent) config defaults to warn', async () => {@@ -117,9 +115,8 @@ describe('warn mode (default) — accept + _meta.warnings + model-visible block'expect(warnings[0].param).toBe('totally_unrelated_key');// Nothing within edit distance → no suggestion key at all.expect('suggestion' in warnings[0]).toBe(false);- expect(out.content[1].text).toBe(- '[gbrain notice unknown_param kind=info]\nwhy: warning: unknown parameter "totally_unrelated_key" ignored. A future release rejects unknown parameters.',- );+ expect(out.content.length).toBe(1);+ expect(JSON.stringify(out.content)).not.toContain('totally_unrelated_key');});test('suggestion candidates are the op\'s DECLARED params only', () => {@@ -442,6 +439,12 @@ describe('write operations reject unknown parameters even in warn mode (#5970)',expect(out.isError ?? false).toBe(false);expect(handlerCalls).toBe(1);expect(out._meta?.warnings).toEqual([{ code: 'unknown_param', param: 'limt', suggestion: 'limit' }]);+ // HARN-15 regression: a read's content carries no notice text for an ignored parameter.+ const text = out.content.map(c => c.text).join('\n');+ expect(text).not.toContain('limt');+ expect(text).not.toContain('unknown_param');+ expect(text).not.toContain('unknown parameter');+ expect(text).not.toContain('[gbrain notice');} finally {searchOp.handler = original;}