Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: gbrain get --as-of never pages the current page after an older host's large-page refusal
garrytan97f5d6cd1210
diff --git a/src/cli/page-render.ts b/src/cli/page-render.tsindex ff2948974f..79105b27c3 100644--- a/src/cli/page-render.ts+++ b/src/cli/page-render.ts@@ -157,9 +157,9 @@ export function remoteErrorCode(e: unknown): string | undefined {return err?.canonical ?? (typeof err?.code === 'string' ? err.code : undefined);}-/** True when a get_page call named no body mode, selector or round-trip flag: the caller wants the page as it is. */+/** True when a get_page call named no body mode, selector, round-trip flag or as_of date: the caller wants the page as it is now. */export function wantsWholePage(params: Record<string, unknown>): boolean {- return ['body', 'lines', 'bytes', 'around_chunk_id', 'cursor', 'include_content', 'content_only', 'section', 'grep'].every(k => params[k] === undefined);+ return ['body', 'lines', 'bytes', 'around_chunk_id', 'cursor', 'include_content', 'content_only', 'section', 'grep', 'as_of'].every(k => params[k] === undefined);}/**diff --git a/test/valid-time-gbra217.test.ts b/test/valid-time-gbra217.test.tsindex d5758f278f..aea9c67a75 100644--- a/test/valid-time-gbra217.test.ts+++ b/test/valid-time-gbra217.test.ts@@ -25,7 +25,7 @@ import { importFromContent } from '../src/core/import-file.ts';import { createPageVersion } from '../src/core/page-state/versions.ts';import { assertValidTimeEcho, currentValidTime, validDate, validDateSql, validTimeVerdict, validTimeWriteAdvisory, VALID_TIME_MIN_HOST_VERSION } from '../src/core/valid-time.ts';import { exitCodeForCode } from '../src/core/error-catalogue.ts';-import { asOfExitCode, formatGetPage, validTimeLine } from '../src/cli/page-render.ts';+import { asOfExitCode, formatGetPage, validTimeLine, wantsWholePage } from '../src/cli/page-render.ts';import { utcToday } from '../src/core/link-validity.ts';import { unquoteTranscriptText } from '../src/core/search/transcript-quote.ts';import { testBackends, requirePostgresTestDatabase } from './helpers/test-backends.ts';@@ -85,6 +85,11 @@ describe('valid-time normaliser and verdict (pure)', () => {expect(() => assertValidTimeEcho({}, plain, { client: 'x', host: null })).not.toThrow();});+ test('an as_of read never takes the thin client whole-page fallback: an older host that ignored as_of pages the current text', () => {+ expect(wantsWholePage({ slug: 'policies/policy-4a-example' })).toBe(true);+ expect(wantsWholePage({ slug: 'policies/policy-4a-example', as_of: '2026-07-01' })).toBe(false);+ });+test('B4: the minimum host version is the release whose CHANGELOG entry adds get_page as_of', () => {const sections = readFileSync(join(import.meta.dir, '..', 'CHANGELOG.md'), 'utf8').split(/^## \[/m).slice(1);const adding = sections.filter((s) => s.includes('get_page {slug, as_of')).map((s) => s.slice(0, s.indexOf(']')));