Repository navigation
v0.60.27.0 chore(runtime): require Bun 1.4.0 or newer - #5838
Merged
Merged
Conversation
…able refusal, doctor check and upgrade path
|
😎 This pull request was merged. |
garrytan
added a commit
that referenced
this pull request
Oct 1, 2026
garrytan
added a commit
that referenced
this pull request
Oct 1, 2026
garrytan
added a commit
that referenced
this pull request
Oct 2, 2026
…boarding, legacy job recovery, stale atoms and facts restore, eval-wave lane A (#5839) * fix(hooks): stop surfacing another session's text at session start (#5558) The session-start digest printed the newest stop-buffer entry on the machine, regardless of which agent or session wrote it. Remove the line and the stop buffer write entirely; stop GCs buffers older binaries left behind. No opt-in restores the cross-session line. * fix(sync): skip a pinned import that trails the page's own working-tree bytes A coordinated page write reaches the database and the working tree before its Git effect lands. A sync run enumerated in that window pins the previous HEAD, finds working-tree bytes newer than the pinned content and a page that differs from it, and records source_changed (pinned_git_worktree_conflict), although the newer bytes are the current page itself. The failure then stays unresolved until --retry-failed is run by hand. prepareManagedSyncMutation now skips the entry as a no-op when the frozen working-tree bytes parse to the current page. Working-tree bytes that are neither the pinned commit nor the page still conflict, and renames are not affected. * fix(sync): note why a trailing-commit skip may advance the checkpoint (#5777) Adds the comment the CEO-A15 contract asks for and a regression that the commit carrying the page bytes later imports as a no-op. * fix(persistence): retire stale managed atoms Managed re-extraction could leave atoms from older source revisions searchable and fail recovery when canonical derived files were absent. Admit revision-pinned retirements in the durable atom batch, wait for writes and deletions before checkpointing, and replay retries without another provider call. Fixes #5770 Signed-off-by: cmontemuino <1761056+cmontemuino@users.noreply.github.com> * fix(atoms): mark retirements, restore retired slugs, regenerate after retirement (#5770) Builds on #5774 per ENG-O7: managed_atom_delete stamps retired_by/retired_at in the same publication; publishManagedAtoms restores a retired atom of the same origin (a user-deleted atom stays deleted); a completion that retired atoms bumps the origin page's managed-atoms-generation, which enters the run key only above 0, and clears older page state and completed checkpoints so an A->B->A edit re-extracts; the seven-day checkpoint purge keeps the generation row. Pins the 16-character source_hash prefix comparison. * fix(mcp): allow explicit federated reads from a GBRAIN_SOURCE-bound stdio connection (#5081) A stdio serve bound with GBRAIN_SOURCE (or a .gbrain-source pin) refused every explicit source_id outside the bound source, because localFederatedSourceIds returns undefined for the explicit tiers. The stdio transport now computes an explicit-read binding (bound source plus non-archived federated sources; only the bound source when it opted out) and federatedSearchScope alone passes it, or the unbound federated set, to resolveRequestedScope as the admission set. Unqualified reads stay scalar; image, loops and code-intel keep denying; each denial hint now names why (token grant, binding, opted-out source). * fix(slug): accept colon-separated namespace parts * fix(autopilot): name each brain's autopilot job per brain on all four install targets (#5195) The default brain (~/.gbrain) keeps com.gbrain.autopilot, gbrain-autopilot.service, ~/.gbrain/start-autopilot.sh and an unmarked crontab line. Any other brain gets <name>-<suffix> names from a random install id recorded in <brain>/.gbrain/autopilot-install-id ({ id, realpath, created_at }; exclusive first create, move keeps the id, copy mints a new one). Crontab lines carry '# gbrain-autopilot:<suffix>'; every log sink writes under the brain's home. --status and --uninstall act only on that brain's job, --status prints the job names, install-id path, wrapper and log (DX-O12), flags a moved brain's missing wrapper and a legacy shared-name job, and install replaces a legacy shared job that runs this brain. A job whose wrapper runs another live brain is never replaced or removed (autopilot_job_owned_by_other_brain). * fix(migrations): resolve v0.11.0 and v0.22.4 state through gbrainPath (#5549) Both orchestrators built the gbrain home from process.env.HOME, so with GBRAIN_HOME set one apply-migrations run split its artifacts: the ledger followed GBRAIN_HOME while pending-host-work.jsonl and v0.22.4-audit.json landed under $HOME/.gbrain, possibly another brain's home. v0.11.0 also read config.json from $HOME to decide --follow on rewritten cron entries. Route all three through gbrainPath()/configPath(). home() stays on $HOME only for the host-agent scans ($HOME/.claude, $HOME/.openclaw). Tests now isolate with GBRAIN_HOME: Bun's os.homedir() ignores runtime HOME changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(migrations): print the resolved gbrain-home paths in the v0.22.4 pitch (#5549) Ported from PR #5696 (commit 0a5fe6a, v0_22_4.ts hunk only): the feature pitch named literal ~/.gbrain paths; a getter now interpolates the audit report path and gbrainPath('backups', 'frontmatter') at print time. Co-authored-by: Andrei Neacsu <andrei.neacsu@hypersense-software.com> * feat(errors): fix wave 5 refusal catalogue with anchor doc test (DX-O1, DX-O2) ERROR_CATALOGUE maps each wave 5 refusal to its stable wire code and its docs/guides anchor; catalogueError builds the OperationError (hint as suggestion, anchor as docs) and catalogueStructuredError the StructuredError envelope. The doc test resolves every catalogue anchor against the guides' headings and <a id> tags. Short anchor stubs land in repair.md and write-refusals.md; the integrator writes the full text. * feat(persistence): preview-approval helper for preview-bound applies (ENG-O1) previewHash(parts) (byte-identical to authorityDigest, so the authorize-legacy --ids digest is unchanged), saveApprovedSet / loadApprovedSet / clearApprovedSet in op_checkpoints (op='repair-approval', keyed by command and hash). A missing, foreign, malformed or older-than-purge-window set refuses whole with preview_changed. Contract test on PGLite and Postgres across the four preview-bound commands. * feat(repair): explicit_only repair kinds, enforced at execution (ENG-O1) RepairKindSpec gains explicit_only. stale-atoms and extractor-facts are registered as explicit-only stubs that refuse with unavailable until their lanes land. gbrain repair --all, the no-kind preview, the remediation plan and the post-upgrade banner list them with their preview command (explicit_kind_required) and never run them; runRepair refuses an unnamed explicit-only kind and runRepairSteps refuses a supplied step naming one before any step starts. Only explicit-only kinds accept --expect <hash> and --include-ambiguous, passed to plan() as RepairPlanOptions. * fix(persistence): store manifest digest and file count instead of the per-file map (#5790) Stored worktree manifests and clone recovery records drop the per-file hash map and keep digest, file_count, canonical_stamp and self_transfer, so sources add, claim, rebind, archive, remove, clone, reclone and writer transfer no longer refuse request_too_large past ~10k files. The digest is unchanged, legacy rows with a files map stay valid and are compacted on rewrite, and transfer prepare/accept hash once under the native lock before their transaction. Hashing reports progress on stderr above 5,000 files in human mode. No schema migration. * fix(persistence): withdrawal scans move past metafile and locally edited pages (#5396) A withdrawal-mirror or Git scan target whose page is a sync-skip metafile (RESOLVER.md diverges from its legacy page by design) or whose file holds an uncoordinated local edit is recorded in data.skipped and the cursor advances; the mirror still materializes the withdrawal in the database. The request's Git and embedding effects are no longer gated behind a parked mirror. * fix(migrations): run migration children through the running CLI, not PATH (#5184) runGbrainSubprocess and every direct execSync of a gbrain command in the migration orchestrators (v0.11.0 smoke and autopilot install, v0.12.0 config read and stats, v0.12.2 repair-jsonb dry run, v0.13.0 stats) now resolve the command word through resolveChildCliInvocation, as the supervisor and autopilot do: the compiled executable, or bun plus the running cli.ts. A PATH gbrain could be another version or a wrapper that sets its own GBRAIN_HOME or database URL. When the running CLI cannot be identified the command stays PATH-resolved. upgrade.ts keeps its PATH probes (they check the post-swap binary). Tests that intercepted migration children with a PATH shim now set the GBRAIN_JOB_CHILD_CLI seam to the same shim. * fix(skills): check skill bundle paths per segment so nested files publish on Windows (#5776) readBundleFile tested the whole relative path for a backslash, which is the path separator on Windows, so every nested bundle file was refused and the shared-skills projection never completed there. bundleRelativePathIsSafe now checks each segment for a separator, control character or colon, with the same depth bound. The new test runs on every OS through path.win32 and joins the windows-latest security-regressions job. * fix(skills): strip only the leading frontmatter block in brain-pdf, portably (#5772) The GNU-only sed range failed on BSD sed (empty PDF on macOS), and on GNU sed a body '---' rule restarted the range and deleted the rest of the page, while a page without frontmatter kept only its first line. A plain awk now removes only a leading '---' block, and an empty result stops with a message instead of rendering an empty PDF. Plugin tree and skills lock regenerated. * fix(recall): honor an explicit --source default (#5535) parseFlags defaults flags.source to the literal 'default', so the value alone cannot distinguish "user asked for the default source" from "user passed no source flag". recall's resolver mapped the literal away (`flagValue !== 'default' ? flagValue : null`) and the thin-client wire call omitted source_id when it equalled 'default' — so an explicit `--source default` fell through to GBRAIN_SOURCE / sources.default / the server's own default. With sources.default pointing at another source, facts in `default` became unreachable from the CLI and the command printed "No matching facts.", which reads as missing data. Thread the existing sourceExplicit signal through resolveSourceForRecall (local: the literal value wins tier 1 of the 6-tier resolver; thin client: return the literal id instead of the GBRAIN_SOURCE fallback) and send source_id on the wire whenever the selector was explicit. Omitting the flag keeps the full resolution chain, and the --budget-policy branch — which already honored sourceExplicit — is untouched. Verified against the real CLI on both paths: the per-source --since-last-run cursor file names the source actually queried (other.json pre-fix, default.json post-fix), and a fixture MCP server records the forwarded call. Both new tests fail on the pre-fix tree. * fix(serve): bind the persistence owner for the brain the engine opened (#5237) A serve started in a .gbrain-mount project opens the mounted brain but bound its persistence socket and consumer config from the host config, so CLI writes from that project failed owner_unavailable. The resident owner now resolves its brain exactly as the CLI does and keeps host-level settings, so the socket the CLI probes exists and writes commit. Host-brain serve is unchanged. * test(e2e): map the preview-approval Postgres lane in the e2e test map * fix(summary): truncate synopsis documents on a surrogate boundary (#5316) buildUserPrompt tail-truncated documentText with a raw code-unit slice; when the cap fell between the halves of a surrogate pair the prompt carried a lone high surrogate, strict JSON parsers rejected every chunk synopsis identically (deterministic malformed classification), and the page-level title-tier fallback left the page in the backlog to fail again forever. Reuse the existing safeSplitIndex helper (src/core/text-safe.ts) so the cut backs off to a pair boundary and the truncation marker reports the real trimmed count. Co-Authored-By: 古野光太朗 <info@techworker.co.jp> (cherry picked from commit 16abf9820207996c3894914490088b3d52e67484) (cherry picked from commit f3adadf2170c81cc5ea8ec54a0a3b42320348c71) (cherry picked from commit 35dd7307c7936b1d869136fe4b1db6fe3361f482) * fix(upgrade): stop reporting success when a pinned bun install did not move (#5311) A bare gbrain upgrade passes no target version, so the #4366 mismatch check never ran, and on an exact-tag Git pin bun update is a successful no-op. When the version is unchanged and the bun global package.json pins gbrain to a tag, upgrade now prints the reinstall command (pinned to the known latest release when the update cache has one), records a verify-pin upgrade error and exits 1, without the just-upgraded breadcrumb. * fix(backup): pass an env allowlist to the remote-ref probe (#5794) The backup-coverage git calls ran with only the no-prompt variables, so git could not read ~/.gitconfig or credential helpers and every private remote reported unavailable. Both calls now pass HOME, PATH, XDG_CONFIG_HOME, SSH_AUTH_SOCK, GIT_CONFIG_GLOBAL, the proxy variables and the Windows profile variables under the no-prompt overrides, never GIT_DIR or GIT_WORK_TREE. The backup-check guide documents the passed variables, the deploy-key path and the verification states. * fix(slug): refuse colon-slug write-through on Windows, per-file sync refusal (#5032) PR #5044 (previous commit) makes colon slugs writable again. On Windows a ':' in a file name names an NTFS alternate data stream, so: - put_page refuses before admission with colon_slug_windows_write_through when this host would publish the canonical file; database-only writes pass; - publication (prepareFileTarget) refuses the same target on a Windows owner; - managed sync reports each committed colon file in fileRefusals and keeps it out of the run and its origin checks, instead of failing the whole run; - unmanaged incremental sync records a named per-file failure. macOS and Linux are unchanged. The tests join the security-regressions job, whose matrix includes windows-latest. * fix(search): treat an empty types array as no filter (#5390) OpenAI-family MCP clients routinely over-fill every optional parameter with a type-zero value, so 'types: []' is what the model emits when it has no type filter to express. The current normalizeTypesParam treats that as a request for an impossible filter and throws invalid_params, which fails 20 of 31 MCP calls on one measured harness. The structurally empty array carries no entries to filter on, so the right behaviour is to run unfiltered (same as 'types' absent or null). The CLI typo guard for a non-empty list that filters to nothing ('--types ,,', '['']') is preserved — that path still throws loudly. Discrimination test: reverted src/core/ops/search.ts to merge-base, ran test/ops-search-types.test.ts → 9 pass / 1 fail. Restored → all pass. * fix(embed): clamp embed concurrency to the Postgres client pool (#5183) GBRAIN_EMBED_CONCURRENCY (default 20) above the client pool left embed --stale waiting on itself: no progress, no error, 0% CPU. Both embed loops now resolve their worker count through resolveEmbedConcurrency, which caps it at the pool size (GBRAIN_POOL_SIZE or the default 10) on Postgres. An explicit setting that gets lowered prints one warning per process naming both knobs; the default is lowered silently. PGLite is unchanged. * fix(search): treat types "" and whitespace-only strings as no filter (#5390) Completes PR #5781 per the wave contract: [], "" and " " are absent; [''], ' , ' and ',,' still fail loudly. Only normalizeTypesParam changes. * fix(frontmatter): --fix keeps correct slug fields (#5053) frontmatter validate --fix and writeBrainPage passed an absolute path to autoFixFrontmatter, so its slug check saw every declared slug as mismatched and deleted it, re-keying the page on the next import. Both callers now pass the path the slug derives from (brain-root or source relative; the basename outside a brain). * fix(connect): say where an installed bearer token lives and how to replace it (#5775) The Codex, Claude Code and opencode handoff installs store the bearer token inline in the harness config without saying so, and CODEX.md claimed the connect path keeps it in the shell env. The install receipt and human output now carry token_storage, config_path, renew_command and if_exposed (invalidate-tokens preview and apply, renew, reload), plus a token_warning when a Git working tree would commit the config. The token is never printed. CODEX.md and hosted-harness-access.md are corrected. * feat(repair): gbrain repair stale-atoms retires drifted atoms preview-bound (#5770) Implements the explicit-only stale-atoms kind (CEO-A7, ENG-O7, DX-O4): origin_gone and origin_changed classes, preview listing and hash saved through preview-approval, --apply --expect replay with changed_since_preview, the managed_maintenance_retire_stale_atoms intent per atom (rechecked under page locks, no live origin needed), direct soft delete on unmanaged brains, retired_by/retired_at markers and the origin regeneration bump. Doctor atom_provenance_drift counts managed atoms and names the repair. Adds the #5770 + #5777 cross-lane journey (ENG-O14). * fix(serve): keep serve --http running when its log pipe closes (#5079) Under Bun a closed stdout/stderr pipe raises SIGPIPE (exit 141) or an EPIPE stream error, and the CLI-wide cleanup handlers exit on both. For serve --http those streams only carry logs, so installSignalHandlers now takes keepServingOnLogEpipe, set by cli.ts for serve --http only: the write is dropped and the server keeps serving. Stdio serve, where a broken stdout means the client left, and every other command keep exiting. * test(e2e): map the stale-atoms repair and its sync-race journey Postgres lanes * fix(think): save syntheses to the think source and scope citation binding (#5426) persistSynthesis now takes the think's scope. CLI think, the think op and auto-think pass their source: the synthesis page is written to that source instead of default, and each citation binds to a page in the sources the think drew from (its own source first) instead of the first page anywhere in the brain with that slug. An unscoped think keeps the default source. Markdown write-through for think --save stays out of scope. * refactor(slug): raise the #5032 refusal through the wave error catalogue Uses catalogueError('colon_slug_windows_write_through', …) from the shared commit instead of a local code, keeps one write-refusals row, and fills the source into the unmanaged sync hint. * fix(calibration): resolve the voice-gate judge model through the key-aware tier (#5165) defaultJudge hardcoded TIER_DEFAULTS.utility (the Anthropic floor), so every voice gate failed on installs without Anthropic credit. It now uses resolveTierDefault('utility'), like the other utility-tier callers. Duplicates: #5303, #5357. * fix(models): add Claude Opus 5.5 to the recipes and price table (#5359, #5494) claude-opus-5-5 joins the anthropic and claude-cli recipe model lists (1M context), the brainstorm judge output caps, the takes-quality budget allowlist and CANONICAL_PRICING at Anthropic's published rates: $4 in, $20 out, cache reads 0.05x ($0.20, a cache-read override like Fable 5.1), 5-minute writes 1.25x. --max-cost runs on Opus 5.5 now estimate instead of failing with no_pricing. The newer-model hint tests now expect Opus 5.5 as the newest priced Opus. * fix(connect): make exposure recovery exchange a new token; keep serve-http within its size ceiling Codex review: after invalidate-tokens, re-running connect --install with an unexpired handoff reinstalled the invalidated cached token. connect --install gains --fresh-token, which forces a token exchange, and if_exposed names it (or a new handoff when the credential has no client secret). residentPersistenceConfig is re-exported from provider.ts so serve-http.ts stays at its 915-line ceiling. * fix(persistence): keep cycle stamps out of the reconcile policy digest Every successful source cycle stamps last_source_cycle_at and last_full_cycle_at into sources.config, and reconcilePolicyDigest hashed the raw blob, so an autopilot cycle between gbrain sources reconcile preview and apply made the preview stale (policy_digest). The digest now drops those two bookkeeping keys; any real config or policy-column change still moves it. The full move of the stamps out of sources.config stays open (TODOS P1). * fix(atoms): retry committed retirements by their published revision; bind stale-atoms applies to the preview's sources and cursor Codex review: a retry of a partly committed retirement batch compared the committed deletion with its pre-delete revision; a stale-atoms apply under a different --source used another selection's approved set; a preview-bound apply resumed the cursor an older preview's apply left. Also classifies the two new writers in canonical-writers.tsv and regenerates the flag registry for the shared commit's --expect flag. * fix(persistence): carry connector holds through sources writer deactivate Deactivate refused while any Google or GitHub item was held, because classic mode reads holds from the connector's state file, not the managed checkpoint, and the only exit was resolving every hold first. It now copies each source's managed item_holds into its classic state file (.google-source.json / .github-source.json, other fields kept) inside the deactivation, as a filesystem publication under the locks it already holds, and reports them as carried_holds (also in the dry run). A held item stays held, retried and reported in classic mode. Only a source with no state directory, or whose classic state file does not parse, still blocks. Fix wave 4's X6 scenario now pins the carry instead of the refusal. * fix(projections): budgeted resident drain with an injected clock (#5401) rebuildPendingPageProjections gains deadlineMs, an injectable clock, a run-start bound (notAfter, cast from text so microseconds survive the driver), the shared 30 s rebuild_failed cooldown, and per-page failure reporting; a lock or snapshot error is now one page's failure instead of aborting the batch. Each resident projection invocation takes up to 100 pages within 250 ms, or 2 when a write is claimable (CLAIMABLE_WRITE_SQL, shared with claimNextWrite and the idle probe). * feat(cli): gbrain projections drain with named exits (#5401) Trusted-local drain in batches of up to 100 until every row queued at the run start was tried once; --limit caps pages tried, --json reports rebuilt, superseded, failed (source_id, slug, reason) and remaining. Exit 0/1/2; on PGLite a resident holder is refused with projection_owner_resident before any engine opens (mounted brains resolved via persistenceConfigForBrain). Safe beside a Postgres resident. * chore(repair): retire safeChunkUpgradeAdvisory The post-upgrade banner reports safe_index_pending through the doctor check, so the advisory formatter was only exercised by its own test. That test's pending-count and recovery-command assertions move onto safeIndexPendingCheck (warn with pages_pending 3 before the re-seal, ok with 0 after), and the function is deleted. * feat(doctor): owner-aware text_projection_readiness and resident projection_status IPC (#5401, E-T1) Doctor names gbrain projections drain when no PGLite resident holds the brain; run_doctor inside a PGLite resident says it is draining. A new read-only projection_status persistence IPC op returns counts only, and the unregistered filesystem-lane entry projectionResidentEntry reports the resident's backlog, pid and stop-drain-restart commands. * fix(connect): register --fresh-token and reuse the exchanged token for shared skills Codex review cycle 2: the generated flag registry rejected --fresh-token before dispatch, and the shared-skills step still read the cached token. The exchange now happens once up front so every later step uses it; the flag registry is regenerated and a CLI-level test pins the flag. * test(repair): pin the retired safeChunkUpgradeAdvisory export * fix(c2): Codex review round 1 - stdio scope: a failed explicit-read admission lookup keeps the resolved binding instead of falling back to 'default' (#5081) - fetch: a source-qualified id is read under the same explicit-read admission as the search that issued it, so the search/fetch round trip works (#5081) - query CRAG re-run reuses the normalized types, so types: [] escalates like an omitted filter (#5390) * chore(c2): regenerate llms-full, the CLI flag registry and the export-surface golden * fix(minions): one raw-row coalesce rule for legacy NULL authority on all five paths (#5157, #5114) MinionQueue.add refused every resubmission over a job row left with SQL NULL submission_authority by the v0.50 cutover: the authority assertion ran before the dead/cancelled key release, and hydrated rows could not tell SQL NULL from JSONB null, malformed or future authority. Synthesize failed on every run and POST /ingest returned 500 after an upgrade. coalesceDecision(rawRow, authority) is now the one rule for the idempotency fast path, param coalescing, the pending and waiting caps and the insert race. Rows are read with 'submission_authority IS NULL AS legacy_authority_is_null'; only SQL NULL gets the legacy rule: dead/cancelled keys are released by a CAS update (key, terminal status and SQL NULL rechecked), completed/failed rows coalesce for application callers only, and live rows are refused for every caller with the legacy_job_authority catalogue error and recovery hint. The insert race re-reads the winner, applies the same rule and retries the insert once after a release. The claim gate's query is exported for doctor. Credit: PR #5048 found the fast-path hunk; this keeps master's __released_idempotency_key merge and covers every path. Co-authored-by: Christian Friedland <chris@friedlandenterprises.com> * fix(ai): release the reservation of documented-unbilled embedding rejections Only token-limit rejections released their invocation reservation, so any other rejected embedding request kept its maximum debit against a gbrain migrate embeddings --max-cost-usd authorization and a migration could stop early at the cap. A request-shaped rejection (HTTP 400, 413 or 422) now settles at zero usage, but only for providers whose documentation says rejected requests are not billed: Google ('If your request fails with a 400 or 500 error, you won't be charged', Gemini API billing FAQ, checked 2026-10-01). OpenAI, Voyage and the other embedding recipes publish no such statement and keep the debit. Tested at exactly the cap for both outcomes. * chore(c2): keep ops/pages.ts within its size ceiling * fix(serve): POST /ingest returns 409 with the recovery hint for legacy job authority (#5157, #5114) A capture whose idempotency key (or waiting cap) lands on a job row left with SQL NULL authority by an upgrade across v0.50 now returns 409 {error: permission_denied, message, hint, docs_url} instead of 500 queue_submission_failed. /ingest submits with application authority, so a completed legacy key coalesces with 202 and a dead or cancelled one is released. Every other submission error still returns 500. * fix(connect): renew_command always exchanges a new token for renewable handoffs Codex review cycle 3: a plain --install renewal reinstalled an unexpired cached token. renew_command now carries --fresh-token whenever the handoff has a client secret, and if_exposed reuses it. * refactor(wave5-d): keep touched modules within their size ceilings Moves the new logic out of size-ratcheted modules instead of raising ceilings: autopilot job-definition reads, legacy replacement and the --status job report into src/commands/autopilot/jobs.ts; resolveEmbedConcurrency into src/core/embed-concurrency.ts; the documented-unbilled rejection check into src/core/ai/errors.ts; and the serve --http signal-handler choice into src/core/serve-invocation.ts, so cli.ts and cli-force-exit.ts (imported by most commands) carry no --http literal and the CLI flag registry is unchanged. Regenerated scripts/structural-suites.tsv. * feat(jobs): preview-bound authorize-legacy --select with coded refusals (#5157 T3, DX-O2, DX-O3) gbrain jobs authorize-legacy --select "status=<s>[|<s>],name=<n>[|<n>]" lists every matching job row with SQL NULL authority (counts by job name and status, the first 20 ids, startup-blocking dependencies, paid-provider job names; full rows with --json) and saves the exact id set under its snapshot hash through the shared preview-approval helper. --expect <hash> --yes authorizes exactly that set under the existing snapshot CAS, so 17.8k rows can be reviewed without typing ids. The --ids path and its refusal of implicit approval stay. Every plain Error in minions/authorize-legacy.ts is now a catalogue error (legacy_job_selection_invalid, legacy_jobs_active with up to 10 cancel commands, preview_changed) with a filled hint and docs anchor, rendered on the CLI as the toJSON envelope with --json. The claim gate and queue refusals name the same recovery order. preview-approval now has a runtime caller, so its orphan-module allowance is removed. * fix(c2): Codex review round 2 — Windows colon refusal keeps database-only exemptions (#5032) A live page that publishes to the database only (declared db_only slug or a never-filed derive-phase page) is no longer refused on Windows; the admission preflight and publication share publishesDatabaseOnly. * fix(atoms): invalidate earlier extractions as each retirement commits; retry identity ignores the generation Codex review cycle 2: a batch whose completion failed after one retirement committed left the earlier content's completed checkpoint, so an A->B->A revert skipped the retired atoms; and a successful retry that retired atoms could not replay because the bumped generation changed its retry identity. The generation now moves with each committed managed_atom_delete, the retry identity leaves it out, and retirements are admitted in slug order. * docs(key-files): retirement regeneration moves with each committed retirement * feat(doctor): legacy_job_authority check module and post-upgrade banner line (#5157, DX-O3(a)) The check reads the claim gate's own query, so its live count is exactly the population that blocks every worker: SQL NULL rows (authorizable, by status) and unsupported non-NULL rows. Live rows fail with the filled recovery order (stop producers and workers, cancel the listed active ids, preview with authorize-legacy --select, apply with the printed hash, restart). Terminal keyed SQL NULL rows are reported separately as ok, since resubmissions now reuse or release them. The module is categorized but not registered; the integrator adds legacyJobAuthorityEntry to src/commands/doctor/registry.ts. The post-upgrade banner names the read-only preview when live rows exist. * feat(repair): gbrain repair extractor-facts restores facts the pre-fix projection expired (#5731) Replaces the shared-commit stub. Candidates are conversation-extractor facts with expired_at set and row_num NULL, classified: - excluded: page gone, superseded (E-T5), withdrawn, an active same-text fact on the page, or an earlier same-text candidate; - ambiguous: unmanaged brain, no committed request of the page whose completed_at equals expired_at (same transaction; compared as microsecond text), a consumer at or above v0.60.11.0, or a page that ever held fence facts (a fence row may have taken the position); - evidenced: everything else. The preview lists every candidate with class and evidence, prints a hash over them and the selection, and saves one approved item per page with its request id (preview-approval helper). --apply requires --expect; the apply replays only the approved set, skips pages whose request committed or whose facts are active again (crash after publication restores no new candidate), and restores each still-identical fact with a fresh row_num above the page's rows. Managed brains publish one database-only managed_maintenance_restore_extractor_facts request per page; unmanaged brains run the same restore under the page lock. --include-ambiguous widens the hashed set. Previews warn, naming the host, when a consumer older than this release published after writer_version_cutoff. Adds the extractor_facts_expired doctor check module (registration left to the integrator), the census row, the e2e map entry and the Postgres wrapper. RepairPlan/RepairResult gain listing (identical to lane B-atoms) and warnings. Removes the preview-approval test-only allowance now that it has runtime callers. * feat(jobs): preview-bound jobs cancel --select for legacy rows (DX-T2, ENG-O5) gbrain jobs cancel --select "status=<s>[|<s>],name=<n>[|<n>]" selects the live rows the claim gate blocks on (SQL NULL or unsupported authority), previews counts by job name and status, the first 20 ids and the parents that return to waiting, and hashes the complete cancelJobs closure. A selection that would cascade to a descendant outside it refuses with legacy_job_selection_invalid naming those ids. --expect <hash> --yes re-hashes under a table lock and cancels exactly that set through cancelJobs in one transaction; a moved hash refuses with preview_changed. Active jobs refuse with legacy_jobs_active. jobs cancel <id> is unchanged. * fix(facts): managed writeSingleFact keeps an absent entity's fallback slug, so dedup is per entity On a managed brain a single fact for an entity with no page published database-only on memory/unattributed with entity_slug NULL, so the same commitment remembered for a second absent person deduplicated against the first. writeSingleFact now opts in through the managed_facts_entity intent's attribute_fallback flag: publishManagedFacts keeps the resolver's fallback slug on those memory/unattributed rows, and prepareManagedFactsMutation accepts that slug on rows without a row number (no fence row, no page, no file) and passes it to insertFact, so dedup and withdrawal checks are per entity, as on an unmanaged brain. The in-batch duplicate key includes the entity. The facts backstop never sets the flag; a test pins its unchanged dedup and replay. Coordinated with community PR #5586 (@andreineacsu): its write-single.ts hunks (cross-source connector resolution) depend on its resolver and reader changes, so none is adopted here; they still apply to this file exactly as they did before this change. * test(e2e): isolate frontmatter-migration through GBRAIN_HOME v0.22.4 now writes its audit report and pending-host-work under gbrainPath(), so redirecting HOME alone left 3 of 5 tests reading the run's GBRAIN_HOME. Point GBRAIN_HOME at the same tmp home and restore it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(atoms): keep the retiring extraction's batch resumable; give stale-atoms retirements attempt-aware request ids Codex review cycle 3: bumping the generation at a retirement changed the run key of the very batch that retired, so a drain after a partial failure called the model again instead of resuming; the generation row now records the kept content and the generation its batch used. A managed stale-atoms retirement refused by an uncoordinated atom-file edit replayed its terminal receipt forever; it now reports file_conflict and the next apply takes a new attempt through repairRequestId. * fix(ai): redact provider keys from upstream errors and report the first embedding 401/403 (#5137) normalizeAIError scrubs the message and the wrapped error's cause chain in place with the gateway's provider-key redactor (exact values in effect, masked echoes, key fragments), and multimodal response bodies are redacted too. The first embedding 401/403 in a process prints embedding_auth_failed naming the key source in effect and the fixes. mergedProviderEnv stays pure; providerKeyShadows and providerKeySource are pure siblings over the file-only config. * feat(cli,doctor): warn once when an env key shadows a different config key (#5137) Env keeps winning. The CLI startup seam (every command except gbrain hook; serve starts through it) prints one stderr warning per process naming the variable, the config key, that env is in effect and both fixes; gbrain config unset <key> also silences it. Doctor embedding_key_source (unregistered filesystem-lane entry in embedding-health.ts) reports the same and scopes itself to doctor's own environment. * test(repair): #5731 restore journey with managed writeSingleFact and a re-extraction (ENG-O14) A real managed conversation extraction, the pre-fix expiry, then doctor, preview, apply (printed command), recall, writeSingleFact deduplicating against the restored fact and keeping an absent entity apart, and a forced re-extraction that replaces the restored batch. The #5401 drain leg of the ENG-O14 journey runs on the integrated head. * docs(write-refusals): name the key sources and fixes for embedding_auth_failed (#5137) * fix(c2): Codex review round 3 — Windows colon sync refusals keep page identity (#5032) A deletion or rename touching a ':' path is refused on both sides (delta and working-tree renames), so a Windows owner never splits a page imported on macOS or Linux into a stale page and a new one; a full sync reports a colon origin missing from the tree instead of silently keeping it. * fix(minions): live legacy refusals name the active ids and the whole live selection (#5157, DX-O15) The queue refusal for a live legacy row (and the /ingest 409 built from it) now fills its hint with the active job ids to cancel and a --select that covers every reviewable live status, so one preview and apply clears the whole SQL NULL population the claim gate blocks on and the printed recovery runs verbatim. * test(minions): restored-operation journey for legacy jobs on PGLite and Postgres (#5157, DX-O15(a), DX-O3(f)(g)) A brain upgraded across v0.50 with terminal and live legacy keyed rows, an unkeyed live SQL NULL row and an orphaned active row: terminal keys need no operator step, doctor fails and POST /ingest returns 409. The test then runs the commands the product prints, verbatim, through the real jobs dispatcher (stop serve, cancel the named active job, authorize-legacy --select preview, the printed apply, restart, search: 6 commands), and proves /ingest returns 202, a worker completes the queued synthesize and capture work and search finds the memory. An unsupported non-NULL row needs its own printed cancel before a worker starts. * fix(repair): bind an extractor-facts apply to its preview's source scope Codex review: an approved set previewed brain-wide could be applied under --source A and restore pages in other sources. Each approved page records the preview scope; an apply under a different scope refuses with preview_changed. * docs(auth-upgrade): bulk legacy review with --select, bulk cancel, terminal keys (#5157) * fix(wave5-d): address Codex review of lane D - Deactivate no longer writes held items into the classic state of a source whose worktree another host owns; that source keeps blocking with an exit naming the owning host (holdCarryBlocked). - Carrying holds syncs the classic state to the managed state, so a hold copied by an earlier deactivation that then aborted, and resolved since, is cleared instead of coming back as held. - The think op saves to the default source for a '__all__' read scope instead of passing the sentinel to putPage. - Install-id moves and copies are decided under a lock, so concurrent installs of a copied brain settle on one id. * chore(wave5-d): regenerate llms bundle, export-surface golden and e2e map build:llms picks up the several-brains autopilot section; the export golden records persistSynthesis's optional scope; scripts/e2e-test-map.ts maps the new autopilot multi-brain E2E; new source-read pins carry their structural justification; structural manifest regenerated. * fix(repair): extractor-facts dedup is per entity Codex review: an identical claim about a different entity on the same page was excluded as a duplicate. The active-duplicate check and the in-preview candidate key now include entity_slug (null-safe), matching decideSingleFact. * fix(repair): an extractor-facts --limit run always advances Codex review: on an unmanaged brain a partially restored page never counted as finished, so each limited rerun picked it again and later pages never ran. Apply items carry a cursor tagged with the approved set's hash; pages the set's cursor already passed are skipped whatever their outcome, and a cursor left by another preview is ignored. * fix(jobs): --dry-run never applies a --select; recovery previews every live status (Codex review) - authorize-legacy --select and jobs cancel --select preview when --dry-run is present, even next to --expect/--yes, matching the --ids path. - Every legacy recovery hint (queue refusal, claim gate, doctor, banner) previews all reviewable live statuses: cancelling an active child moves a waiting-children parent to waiting, so a filter built from the statuses present before the cancel could select nothing. * fix(minions): keep the claim gate's query shape; share its population predicate with doctor The gate again selects 'id, submission_authority' (worker resilience fixtures and the authority inventory match that shape) and the doctor check reads the same population through the shared UNREVIEWED_LIVE_JOBS_WHERE predicate. Found by ci:ubicloud:diff (queue-lock-retry, worker-promote-reconnect, worker-conn-resilience-1720). * fix(repair): extractor-facts restores only onto the previewed page id Codex review: on an unmanaged brain a page deleted and recreated at the same slug between preview and apply still got the old page's facts. The restore now requires the live page's id to equal the approved page id; otherwise every fact reports changed_since_preview. * fix(autopilot): see and remove a pre-upgrade brain's shared launchd job before it has an install id A non-default brain installed by an older gbrain has no install id, so its job resolved to the shared launchd label and the legacy-candidate check (label differs from the brain's own) skipped it: --uninstall left the job loaded and then deleted its wrapper, and --status called it not installed. The shared label is now a legacy candidate for an unassigned brain too, still only when its wrapper names this brain. Found by Codex review cycle 2. * fix(projections): bound the claimable-write probe, keep the selected brain and restart the owner in drain steps (#5401) Codex review and the Ubicloud gate: the resident's claimable-write probe now runs under the phase deadline and the stop signal (a probe behind a table lock counts as a waiting write instead of pinning a connection); the refusal and doctor stop-drain-restart commands keep --brain for a mounted brain and restart the owner even when the drain exits 1; the thin-client refusal names the brain host. Regenerated the CLI goldens, flag registry and llms files. shared-skills-writer-boundary drains queued projections before its snapshot, since the faster resident drain can seal that page while the test runs. * fix(jobs): approval hash binds the --select filter; mark every job that may spend (Codex review) - authorize-legacy --select prints a preview hash over the filter and the snapshot digest, so two filters selecting the same rows keep separate approved sets; the apply still re-checks the snapshot digest under lock. - The preview marks import, reindex, sync, skillopt and subagent jobs as 'may make paid provider calls' alongside the gateway-refresh set. * chore: regenerate the CLI flag registry * feat(sources): read-only mirror sources keep managed writes out of their checkout (#5409) Managed sync wrote a canonical overlay (default metadata, tags kept in the brain) back into a mirrored Git checkout, which then blocked the next git pull --ff-only. A per-source sources.config.mirror_read_only flag (default false), set by gbrain sources mirror-readonly <id> and cleared by mirror-writable <id> (following federate/unfederate): - managed sync imports an overlay database-only: no file, no newer-working- tree refusal, and the content-unchanged screen ignores the overlay; - every coordinated page write into the source publishes no file; the receipt carries write_through.skipped=mirror_read_only and storage=database_only (DX-O16); - gbrain sources list --json reports mirror_read_only. Tests for true and false on the sync and put_page paths, on PGLite and Postgres. Regenerates the CLI flag registry. * fix(jobs): mark ingest_capture as may-spend in legacy previews (Codex review) * fix: refuse a mirror file target prepared before mirror-readonly; prefer evidenced duplicates (Codex review) - #5409: the coordinator rechecks mirror_read_only under the publication transaction (source row FOR SHARE) and refuses a file target prepared before the source became a read-only mirror, so nothing reaches the checkout after the flag is set. - #5731: within a duplicate group (page, visibility, entity, text) the first evidenced row is the representative, so an older ambiguous copy no longer hides a restorable evidenced one. * fix(ai): name the real API-key variable and the overridden embedding model in key-source diagnostics (#5137) Codex review: Azure lists its endpoint first and LiteLLM's key is optional, so the credential is the recipe's *_API_KEY variable, required or not; doctor embedding_key_source resolves the model with GBRAIN_EMBEDDING_MODEL over the file model while shadow detection keeps file-only values. * fix: bound in-flight projection_status requests and give Entra-mode auth failures Entra guidance (#5401, #5137) Codex review cycle 3: projection_status now counts toward the listener's eight-in-flight bound, so stalled backlog reads cannot pile up behind abandoned sockets; an Azure 401/403 in Entra mode names the Entra token and az login instead of an unused API key. * fix(sources): mirror-created pages stay database-only; mirror Git effects complete as skipped (Codex review) - A page created while its source was a read-only mirror has no file; it is stamped pages.database_only_reason=mirror_read_only in the publication and stays database-only after mirror-writable, so editing it no longer fails as an uncoordinated file deletion. - gitPage completes a mirror source's Git effects (for example a forget's withdrawal) as skipped instead of failing and parking them. - Census rows for sources-mirror.ts and mirror-read-only.ts; the extractor_facts_expired check is categorized (BRAIN) so the drift guard passes before the integrator registers it. * chore(doctor): register legacy_job_authority and regenerate doctor goldens (#5157) * docs(repair): wave 5 recovery runbook, refusal codes and explicit-only repair kinds Fill the wave 5 refusal-code sections, document stale-atoms, extractor-facts, projections drain and provider key source, add the v0.60.27.0 symptom table and ordered recovery sequence, record that session start no longer shows another session's activity (no opt-in), note withdrawal scans skipping metafile and drifted pages, and add explicit_kind_required to AGENTS.md. * docs(todos): file fix wave 5 follow-ups; remove the items v0.60.27.0 ships * docs(key-files): split Commands (2/6) under the 60 KB subsystem cap * docs(changelog): v0.60.27.0 fix wave 5 release notes and upgrade note * v0.60.27.0 chore: bump version stamps and regenerate plugin, template and llms bundles * fix(wave5): cross-lane fixes from the integration review - #5032 x #5409: on Windows, a read-only mirror source (and a page created while one) stores a colon slug database-only instead of refusing. - #5401 x #5195: the projection drain's stop/drain/restart steps name this brain's own autopilot job (or the shared job an older install still runs it from), not the default job. - Regenerate the doctor early-stop golden for the new checks. * docs: drain steps name this brain's autopilot job; mirror sources take colon slugs on Windows * chore: regenerate the CLI flag registry (projections command) * fix(doctor): register atom_provenance_drift as a wave check so the banner and remediate name stale-atoms The stale-atoms repair kind clears atom_provenance_drift, but that check was never in WAVE_CHECKS, so the post-upgrade banner and doctor --remediate never reported stale atoms as explicit_kind_required with their preview command. Add it host-only, registered inline in doctor.ts as before. * test: fix wave 5 cross-lane journeys (ENG-O14) on PGLite, Postgres and a mounted serve owner * fix(context): hide private pages from volunteer_context, turn context, reflex resolve and compile-context (N8-1, N8-2) * fix(doctor): a failed atom_provenance_drift inspection reports unknown health; harden the wave 5 journeys (Codex review) As a wave check, the drift check's query failure must read as unknown, not as a stale-atoms finding with a zero count. The journeys now stop the in-process owner before seeding the projection backlog and keep part of it in the resident's retry cooldown, so the drain always rebuilds pages; the hook journey stubs the backup-check spawn; mounted CLI children are bounded. * chore(cli): regenerate the flag registry after projections.ts stopped importing autopilot.ts The projections drain now resolves autopilot names through autopilot-paths and autopilot/jobs, so the generator no longer folds autopilot's flags into 'projections'. The committed registry still listed them, failing the cli-flag-validation freshness guard. * fix(loops): measure grace windows from the oldest unanswered message in the run (N7-1) * fix(conversation-parser): one-off bold labels are not a conversation (N12-1) * fix(transcripts): offset timestamps round-trip exactly; adapters normalize to UTC (N12-2) * fix(chunker): const arrow/function-expression definitions keep their named chunk (N13-1) * fix(code-intel): resolved flag honors resolved_chunk_id; language gate scoped to the symbol's own definitions (N13-2, N13-3) * docs+guards: lane A notes, KEY_FILES entries, size ratchets; N8 tests on both engines * chore: renumber fix wave 5 to v0.60.28.0 (#5838 takes v0.60.27.0) * docs(changelog): #5390 empty-string types are CLI-only; MCP takes [] or omits types * test(#5032): start the Windows fixture from the native realpath (8.3 TEMP on windows-latest); file the preflight follow-up * Merge eval-wave lane A (GBRA-27) into fix wave 5; fold its notes into the v0.60.28.0 CHANGELOG and upgrade note * chore(semgrep): justify the #5195/#5184/#5311 child-process and path findings * test(e2e): map the eval-wave lane A Postgres suites --------- Signed-off-by: cmontemuino <1761056+cmontemuino@users.noreply.github.com> Co-authored-by: Howard Park <howardpark@users.noreply.github.com> Co-authored-by: cmontemuino <1761056+cmontemuino@users.noreply.github.com> Co-authored-by: Javier Aldape <javieraldape@users.noreply.github.com> Co-authored-by: Andrei Neacsu <andrei.neacsu@hypersense-software.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Ziyang Guo <121015044+RerankerGuo@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: 古野光太朗 <info@techworker.co.jp> Co-authored-by: Christian Friedland <chris@friedlandenterprises.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GBrain's minimum Bun version goes from 1.3.11 to 1.4.0 (owner-approved).
Why 1.4.0. The exit-event half of oven-sh/bun#30301 (merge ff38b2b) first shipped in Bun 1.3.14, and 1.4.0 is the lowest 1.4 release that contains it. A raw reproduction without
execFileBounded, using 20 children while a nestedexpect().resolvesre-enters the event loop:The pipe half is still unfixed upstream: #40030 and #32233 were closed unmerged, and #33289 is open. So the in-code child bounds from v0.60.16.0 and v0.60.21.0 stay, and the comments, docs and CHANGELOG now say exactly which half Bun fixed.
What a user on an old Bun sees. Every entrypoint refuses before doing any work with
GBrain requires Bun 1.4.0 or newer (found Bun <v>).and the fixbun upgrade, then restart. If agbrain upgradestopped at that point,gbrain post-upgradefinishes it. The entrypoints checked:serveandserve --httpjobs workandjobs supervisor starthook,upgrade,post-upgradeandautopilot--versionstill answers, so an oldergbrain upgraderecords the correct target. Autopilot writes the refusal to its log, which is the log the launchd, systemd and cron services surface. The postinstall step warns when an install lands on an old Bun. A newgbrain doctorcheck,bun_runtime, reports the version against the floor.skills/migrations/v0.60.27.0.mdtells agents to ask before runningbun upgrade, and nothing upgrades Bun silently. The cloud setup script installs a supported Bun when the sandbox's Bun is missing or too old.I walked a v0.60.26 install on Bun 1.3.14 through
gbrain upgradeonto this branch. After switching to Bun 1.4.2,gbrain post-upgradesucceeded and doctor reportedbun_runtime ok.CI. The minimum lanes move from 1.3.11 to 1.4.0 in the test.yml security regressions, all four persistence-validation matrices, and native-locks full scope, which also drops 1.3.13.
test/scripts/ci-pr-scope.test.tsrequires each matrix to be exactly[MINIMUM_BUN_VERSION, primary].Verification.
bun run verifypasses 66/66.bun run ci:ubicloudon the head is green: unit 2175, serial 373, E2E 342, slow 26, plus verify and gitleaks.