fix(gbrain): stop forcing GBRAIN_PREPARE on transaction-mode poolers (#1965)

buildGbrainEnv auto-set GBRAIN_PREPARE=true whenever DATABASE_URL targeted
port 6543, and the /sync-gbrain capability check exported it for the rest
of the skill run. Both had the semantics inverted: gbrain auto-disables
prepared statements on transaction-mode poolers because they break every
write there ("prepared statement does not exist"); GBRAIN_PREPARE=true is
gbrain's documented override for SESSION-mode poolers on 6543, not a
requirement for transaction mode. The #1435 search symptom the auto-set
worked around was fixed gbrain-side.

Remove both force-sets. A caller-set GBRAIN_PREPARE (either value) still
passes through untouched, preserving the session-mode-on-6543 escape hatch.
isTransactionModePooler stays exported.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-06-11 20:20:36 -07:00
co-authored by Claude Fable 5
parent a5833c413f
commit 8e4662e930
4 changed files with 30 additions and 36 deletions
+5 -4
View File
@@ -1013,10 +1013,11 @@ SLUG="_capability_check_$$"
CAPABILITY_OK=0
if [ -f ~/.gbrain/config.json ] && \
gbrain --version 2>/dev/null | grep -q '^gbrain '; then
# GBRAIN_PREPARE=true ensures prepared statements stay enabled when
# connecting through a PgBouncer transaction-mode pooler (port 6543).
# Without it, search silently returns no results (#1435).
export GBRAIN_PREPARE=true
# Do NOT export GBRAIN_PREPARE here (#1965). gbrain auto-disables prepared
# statements on transaction-mode poolers (port 6543) — forcing them on
# breaks every write with "prepared statement does not exist". Users on a
# session-mode pooler at 6543 can set GBRAIN_PREPARE=true themselves (the
# gbrain banner documents this override).
if echo "ping" | gbrain put "$SLUG" >/dev/null 2>&1; then
# Retry search up to 3 times with 1s delay — under transaction-mode
# pooling the search index may not be visible on the next connection
+5 -4
View File
@@ -301,10 +301,11 @@ SLUG="_capability_check_$$"
CAPABILITY_OK=0
if [ -f ~/.gbrain/config.json ] && \
gbrain --version 2>/dev/null | grep -q '^gbrain '; then
# GBRAIN_PREPARE=true ensures prepared statements stay enabled when
# connecting through a PgBouncer transaction-mode pooler (port 6543).
# Without it, search silently returns no results (#1435).
export GBRAIN_PREPARE=true
# Do NOT export GBRAIN_PREPARE here (#1965). gbrain auto-disables prepared
# statements on transaction-mode poolers (port 6543) — forcing them on
# breaks every write with "prepared statement does not exist". Users on a
# session-mode pooler at 6543 can set GBRAIN_PREPARE=true themselves (the
# gbrain banner documents this override).
if echo "ping" | gbrain put "$SLUG" >/dev/null 2>&1; then
# Retry search up to 3 times with 1s delay — under transaction-mode
# pooling the search index may not be visible on the next connection