Repository navigation
v0.60.679.0
Doctor, dream, enrich and maintain --safe fixes, landed together. gbrain maintain --safe no longer deletes pages or calls a paid provider, several doctor checks now report what they find accurately, dream phases stop and report correctly, and enrich, model-call errors, atom provenance, transcript dates and the stale link sweep get community-reported fixes. Each fix has a test that fails without it.
The unindexed_files maintenance phase no longer reports a complete scan when a source could not be scanned. A source whose Git checkout failed to read was counted as an error and the phase warned, but its details.complete still said true, so anything reading the phase result took the run as a full scan of every managed source. complete is now true only when no source stopped at its time budget and none errored. Reported by @Masashi-Ono0611 (#8887).
A source with automatic sync off now walks forward through its pages on a database whose DateStyle is not ISO. The per-source maintenance window saved its cursor in the session's date style. Under a day-first style such as German, DMY or SQL, DMY, a cursor dated after the 12th of a month was not a date the cycle handler could read, so it dropped the cursor and the next cycle started again from the source's oldest pages; a source over 2,000 pages never got past its first window. The cursor is now always written as a UTC ISO timestamp with microseconds. A source holding a cursor in the old form may start from its oldest pages one last time; from then on it advances. Reported by @javieraldape (#8771).
gbrain dream --drain stops as no progress when its batches only skip items the backlog keeps counting. The drain checked for no progress only after a batch that extracted nothing and skipped nothing. A page the phase skips on every batch while the backlog still counts it kept that check from ever running, so the drain ran all 1,000 batches, held the cycle lock for minutes and ended max_batches with exit 11, which tells the caller to rerun a stop a rerun cannot clear. A batch that extracts nothing now always rechecks the backlog, and when it did not shrink, the drain stops no_progress (atom_drain_no_progress, exit 1), and skips that do shrink it keep draining. Reported by @h6y3 (#8445).
gbrain dream --help --json prints its help as one JSON document. Under --json, stdout carries only a JSON document, and dream printed its help as plain text, which went to stderr. So stdout was empty, the run exited 0 and logged a missing-document event that gbrain doctor counts under its agent-contract check. It now prints {"command": "dream", "help": "<the help text>", "contract_version": 1}, and dream retriage --help --json and dream reset-key --help --json do the same. gbrain dream --help without --json prints exactly the same text as before. Reported by @Kkkkkuro (#8510).
Concept synthesis stops when its maintenance job times out or is cancelled. The synthesize_concepts dream phase never looked at the cycle's abort signal, so with a slow model it kept calling the model and publishing concept pages after its job had timed out, and an aborted model call could be written as a template fallback page. The phase now passes the signal to the model call and checks it before each concept and again right before each page is written, so nothing is published once the job is cancelled. The spend of the model calls that finished and the failed-attempt counts are still saved, so the recorded spend and the retry limit keep counting them. On a managed brain, concepts synthesized but not yet published when the job stops are synthesized again on the next run. No setting changed. Reported by @Nazim22 (#7986).
Doctor checks that misreported their findings now report them accurately. A community bug wave: each fix below was reported by a contributor, reproduced on master with a failing test first, and rewritten here.
gbrain maintain --safe no longer deletes pages or calls a paid provider. It used to run the whole dream cycle on the default source, so pages soft-deleted more than 72 hours earlier were purged for good, and the embedding, synthesis and other model phases ran too. The source cycle now runs only free phases that never purge: lint, backlinks, sync, the fence and content repair lanes, unindexed files, extract, extract_facts, symbol edges, emotional weight, consolidate, orphans and schema suggestions. It also holds back extract_facts when an embedding provider is set up or the decide conflict slot is on (its conflict sweep calls the decision provider), and the fence and content repair lanes when an embedding provider is set up (their publications embed) or fences.repair.llm has a repair model. The JSON report lists the phases that ran and the ones held back. Old soft-deleted pages are still purged by gbrain pages purge-deleted (preview it with --dry-run), gbrain dream and an installed autopilot, and the paid phases still run from gbrain dream.
Enrich write-ups from thinking models are no longer cut off. Enrich capped every write-up at 2048 output tokens, which thinking-by-default models such as Claude 5 spend on reasoning, so write-ups came back truncated or failed. Thinking models now get the gateway's thinking headroom; other models keep 2048.
An OpenAI account with no credits left is reported as a billing problem instead of being retried. OpenAI answers with HTTP 429 when an organisation has no credits, and gbrain read that as a rate limit and retried. A provider body whose error type or code is a billing code now decides billing wherever the error is wrapped.
Atom quotes keep their provenance when the model drops Markdown or punctuation, and a failed fence step no longer books a healthy facts round. Quote matching skips line-leading # and > markers, quotation marks and a spaced dash, never words or number signs; ambiguous or reworded quotes still fail closed. A fence write that fails with an I/O or database error now counts as failed and stops the facts.fence round, so doctor's extract_health warns.
A write-up that has its own dated timeline section round-trips. A page with no timeline whose body had a ## Timeline highlights section re-parsed that section as the page timeline, so enrich refused its own paid write-up with CONCEPT_REPUBLICATION_LOSSY.
Transcripts without a date in the filename take the date in their frontmatter, and the atoms extracted from a transcript take the transcript's date. Both used to fall back to the date of the run.
The admin dashboard's live feed keeps reconnecting after a dropped connection, and four smaller fixes land with it: the load throttle still applies its concurrency and memory limits when the machine reports no load data (Windows), a remember TTL past the representable date range is refused as invalid_params instead of throwing, a worker pool whose error callback throws now stops every worker before rejecting, and claude-cli tool loops read the previous turn's prompt cache instead of rewriting the whole transcript to it.
The stale link sweep no longer re-extracts one page forever when a bare-name frontmatter link matches a top-level page. A person page with founded: ["acme-toolkit"] resolves that name under companies/, so a top-level page named acme-toolkit does not satisfy it and the link stays wanted. The wanted-link row was still stamped as if its target existed, which marks its page stale on every pass, so the sweep queued the same page again and again (thousands of extract jobs an hour) and starved lower-priority jobs. Only a slug reference to an existing page is stamped that way now, and a row an earlier release stamped settles the next time its page is extracted, which the sweep does on its own. Editing the top-level page still re-checks the link once. One narrow case is left for a follow-up release. If the top-level page is created for the first time while that link is being extracted, the link can stay missing until either page is written again. Reported by @akinduroifedayo (#9140) and first fixed by @Masashi-Ono0611 (#9144); @akinduroifedayo's own fix (#9149) also found that narrow case.
Itemized changes
src/core/cycle/unindexed-files.ts:details.completealso requireserrors.length === 0. Test:test/unindexed-files.test.ts(a source whose.git/HEADis unreadable: phasewarn, one error,complete: false).src/core/cycle/source-window.ts: the listing instant and the last page'supdated_atare formatted withto_char(... AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"'). Test:test/sync-disabled-cycle-window.test.ts(the real queued handler underGerman, DMYadvances window by window;German,SQLandPostgresstyles under a +05:45 time zone give ISO UTC cursors with microseconds and the same windows), now also run on Postgres bytest/e2e/sync-disabled-cycle-window-postgres.test.ts.src/core/cycle/extract-atoms-drain.ts: the no-progress recount runs after every batch withextracted === 0, not only whenskippedis also 0. Test:test/extract-atoms-drain.test.ts(a skip-only batch over a flat backlog stopsno_progressafter one batch; skip-only batches that shrink the backlog drain).src/cli/help/render.ts: newprintHelpText(command, text, args), the--help --jsondocument for a handler that prints its own help text;src/commands/dream.ts,dream-retriage.tsanddream-reset-key.tsprint their help through it. Test:test/dream-help-json-8510.test.ts(the real CLI: one document per help, nojson_document_missingevent, plain--helpstdout equal to the document text).src/core/cycle/synthesize-concepts.ts,src/core/cycle.ts:signaloption, passed from the cycle like extract_atoms', handed to the narrativechatcall and checked before each concept, right before each publication and before the final managed flush; an abort saves the retry counters and the finished spend to the rollup, then throwsAbortError. Test:test/cycle/synthesize-concepts-abort-7986.test.ts(runCycleunder the creator pack: a job aborted during the second model call publishes only the first concept and makes no third call; an aborted call is not published; an abort during the page read before the first publication publishes nothing; an aborted run still writes its spend and failed attempts).timeline_history: on a brain with more than 10,000 pages carrying database-only timeline rows, a pass keeps only the first 10,000 for its final recount. It used to report that recount as exact, and a pass whose kept pages had been repaired was recorded as clean while the rest still held database-only rows. Such a pass now reports its counts as a lower bound ("at least"), keeps warning, and is never trusted as clean. A pass saved by an earlier release, which did not record whether it dropped pages, is treated the same way when its kept list is full. Reported by @Masashi-Ono0611 (#8511).conversation_format_coverage: the sample now includes pages stored under the granular conversation types the extractor already reads (slack-thread,slack-dm-day,email-digest), so unparseable transcripts on a brain that never ran the type-consolidation pack are reported instead of silently skipped. Reported by @Masashi-Ono0611 (#8519).minions_migrationundergbrain doctor --fast: a migration the brain's config can decline (v0.53.0,shared_skills.migration.enabled) is no longer listed as not run. Without a database connection the check cannot read that setting, andgbrain apply-migrations --yesskips a declined migration, so the warning could never clear. The fullgbrain doctorstill reports it when it is not declined. Reported by @Masashi-Ono0611 (#8721).stale_mentions: each stale example now carries its owngbrain unlinkcommand with the link type the row is stored under, shell-quoted so a slug or link type with quotes or$(...)pastes as plain words, with the options first and--before the two slugs, so a slug that starts with--is never read as a flag. The hint used to say--link-type mentionsfor every row, which removes nothing for a typed link stored under a verb such asfounded. Reported by @Masashi-Ono0611 (#8817).schema_pack_consistency: pages gbrain itself wrote (extract receipts underextracts/, and pages from the code importer) no longer count as undeclared on a custom schema pack copied before the base pack declared their types. The exemption follows how the page was written, not its type name. A page of yours that uses one of those types, such as a Markdown note withtype: code, still warns, as do your own undeclared types. Reported by @Masashi-Ono0611 (#8818).embedding_stateandgbrain embed --stale: a page whose body holds only a protected takes fence (which never reaches search chunks) is now countedemptyinstead ofchunkless_healable. Doctor no longer warns about it, andembed --staleno longer plans a heal that can never produce a chunk. A page is treated this way only when the writer already chunked its current revision to nothing; a chunkless page that was never chunked, a page whose chunks were deleted after it was chunked, or anembed_skippage an older release stored without chunks, is still healed. Deleting a page's chunks clears that seal, indeleteChunks, an empty chunk replacement andpurge_fact's chunk delete (which also empties pages whose body held no purged row), so such a page stays healable. Reported by @akinduroifedayo (#8502).managed_sync_backlog: removing a source in the middle of a managed sync now removes its sync cursor too, whether the brain is managed or not. The cursor used to stay behind, and doctor warned about a stalled backlog forever with a resume command that failedunknown_source. A cursor an earlier removal already left behind is no longer reported, including after the source is added back under the same id. Reported by @omni-nordaware (#8741).src/commands/maintain.ts:MAINTAIN_SAFE_PHASESis the allowlist of free, non-purging phases;maintainSafePhasesintersects it with the source's own phase list and holds back provider-gated phases (extract_factson an embedding provider or an enabled decide conflict slot,fence_repairandcontent_repairon an embedding provider or a resolved repair model); the dry-run and applied actions reportphasesandheld_phases; the help text namesgbrain pages purge-deletedandgbrain dream.src/core/behavior-change-notice.ts: one row for the changedmaintain --safebehavior.scripts/module-size-limits.tsv: the notice file's ceiling grows by one for that row.- Docs: the
maintain.tsrow indocs/architecture/key-files/commands-4.md. - Tests:
test/maintain.test.ts: the allowlist holds no purge or paid phase; each provider holds its phase; a non-default source keeps its subset; on PGLite a page soft-deleted 100 hours ago survives--safeand no unsafe phase runs; a keyless brain with the decide conflict slot on holdsextract_facts. src/commands/enrich.ts(defaultSynthesize): thinking models get the gateway's thinking output headroom; other models keep the 2048-token cap. A thinking-model write-up can reserve up to 32000 output tokens against--max-usdper in-flight call. Test:test/enrich/thinking-cap-7564.test.ts. Reported by @mattverlaque (#7564).serializeMarkdown,edit_page's view and the timeline file splice: a body with no timeline sentinel whose own dated section would split under the bare-section fallback ends with an empty<!-- timeline -->; every other body keeps its bytes. Test:test/markdown-own-timeline-section-7738.test.ts. Reported by @mattverlaque (#7738).src/core/ai/errors.ts: "no credits remaining" is a billing phrase, and a billingerror.type/error.codedecides billing through every wrapper layer. Test:test/ai/classify-billing-credits-8400.test.ts. Reported by @Masashi-Ono0611 (#8699, #8400).src/core/ai/providers/claude-cli-language-model.ts: one content block per message over--input-format stream-json(rendered text unchanged, lone surrogates still become U+FFFD), so each turn reads the previous turn's cache. The subscription-only env scrub is unchanged. Test:test/claude-cli-prompt-cache-7352.test.ts. Reported by @spiky02plateau (#7352).src/core/cycle/extract-atoms.ts(locateQuote): folds with the shared grounding core's markup option. Test:test/cycle/extract-atoms-quote-markup-8373.test.ts. Reported by @Masashi-Ono0611 (#8373).- Legacy fence step of
extract_facts: an untyped fence write error counts inpagesFailedand halts the round withitem_error; typed refusals, a busy source lock, segmented pages and files on another host stay holds. Test:test/extract-facts-fence-failure-health-8758.test.ts(PGLite and Postgres, managed and unmanaged). Reported by @javieraldape (#8758). - Transcript discovery and
--input: an undated basename falls back to the frontmatterdate; impossible calendar days are rejected and the date window filters on the resolved date. Test:test/transcript-discovery-frontmatter-date.test.ts. Reported by @spiky02plateau (#7267). src/core/cycle/atom-source-date.ts: newtranscriptAtomSourceDate(frontmatter date, else the path date that names theatoms/<date>/folder); an undated transcript still gets none. Test:test/extract-atoms-source-date.test.ts. Reported by @spiky02plateau (#7268).- Admin dashboard: the EventSource
onerroronly sets the status fromreadyStateand no longer closes the stream;admin/distandsrc/admin-embedded.tsare rebuilt. Test:test/admin-dashboard-stream-reconnect.test.ts. Reported by @ramybarsoum (#8913). - Load throttle (
shouldProceed),rememberTTL parsing and the worker pool: see the paragraph above. Tests:test/backoff.test.ts,test/writeback-config.test.ts,test/worker-pool.test.ts. Reported by @ramybarsoum (#8913). src/core/wanted-links-store.ts(replaceWantedLinks):checked_atis-infinityonly for aslugrow whose exact page exists; anamerow getsnow(), and the existingON CONFLICTupdate re-stamps old rows on their origin's next extraction. Test:test/wanted-links.test.tsandtest/e2e/wanted-links-postgres.test.ts(topLevelSlugNameReferenceSettles: the origin is not stale after one sweep, and a row forced to-infinitysettles after one more;topLevelSlugNamePageEditWakesOnce: an edit of the top-level page lists the origin stale once and one sweep settles it). Reported by @akinduroifedayo (#9140); first fixed by @Masashi-Ono0611 (#9144) and also by @akinduroifedayo (#9149).