v0.46.24.0
gbrain sync now works while your agent's brain is live. On a PGLite
brain, a running gbrain serve (the MCP server your agent harness spawns)
owns the database's single-writer connection, and a sync used to require
stopping the serve — killing your agent's memory to feed it. Sync now
delegates the run to the serve process over its local IPC socket: the lock
owner does the work, the CLI streams progress, and your agent stays up the
whole time.
Added
- Serve-delegated sync:
gbrain syncunder a livegbrain serveruns inside
the serve process (secret-gatedsync_start/sync_status/sync_abort
kinds on the existing resolve-IPC socket; never raw SQL). The CLI prints a
delegation banner with the job id, polls progress (phases, banked-file
counts), and prints the same result a direct sync would. Ctrl-C aborts to a
durable checkpoint the next sync resumes from; a second Ctrl-C exits
without waiting. - Embeds under delegation are always deferred and drained by the serve's idle
maintenance sweep afterwards (the serve's environment/API keys apply);
--no-embedalso suppresses the drain. The inline embed cost gate is never
silently bypassed. - Bounded by construction: the client always sends its resolved hard deadline
(interactive default 3600s) so a job whose client died still ends;
--no-hard-deadlineis the only unbounded encoding. A serve shutdown
mid-sync aborts the job and waits a bounded settle
(GBRAIN_SERVE_SYNC_SETTLE_MS, default 3000ms) for the checkpoint flush
before disconnecting. - Safety posture: unsupported sync flags (
--repo,--all,--watch,
--exclude,--workers,--json, …) refuse BY NAME under delegation
(default-deny — a silently dropped flag would perform the wrong sync), with
three remediations in every message. Opt-outs:--no-delegate/
GBRAIN_SYNC_NO_DELEGATE=1(client) andGBRAIN_SERVE_SYNC_IPC=0(serve).
serve --httpexposes no IPC and keeps the stop-the-serve behavior.
Changed
- The
LiveServeLockErrormessage now says sync runs through the live serve
automatically; stopping the serve remains the remedy for OTHER CLI write
commands. docs/architecture/serve-sync-concurrency.mdrewritten around delegation
(limits table, crash/resume notes, unchanged hang-triage recipes).
To take advantage of v0.46.24.0:
gbrain upgrade(or reinstall the binary), then restart any running
gbrain serveso it registers the sync IPC kinds — a serve from an older
version answers with a typed "restart the serve" refusal instead of
delegating.- If a serve dies mid-delegated-sync, re-run
gbrain syncto resume from the
checkpoint; a dead-PID sync lock younger than 60s can be cleared with
gbrain sync --force-break-lock.