fix(gbrain): thin-client state — remote-MCP brains no longer classify as broken-config (#2051)

A thin client (remote-HTTP MCP brain, no local engine by design) probed
`gbrain sources list`, which gbrain's dispatch guard REFUSES on thin clients
(exit 1, no recognized error string), so the classifier fell to its
defensive broken-config default and every suppression gate silently hid
brain-aware blocks from exactly the users on a shared team brain.

New 'thin-client' state, detected PRE-probe from gbrain's own remote_mcp
config marker via the existing gbrainConfigPath() helper (mirrors gbrain's
isThinClient(); honors GBRAIN_HOME; zero network, immune to error-string
drift), with a /thin[- ]client/ stderr backstop in the probe catch. Remote
reachability is deliberately NOT probed by the classifier — that is the
#1964 pathology; gbrain calls degrade gracefully at use time, and the detect
JSON says so honestly (gbrain_thin_client: {probed: false}).

The state is admitted at every suppression gate — gstack-gbrain-detect
--is-ok (drives setup + gbrain-refresh), gen-skill-docs' detection override,
gstack-config gbrain-refresh — while the sync stages (code/memory/dream)
SKIP with an accurate reason: code indexing runs on the brain server, memory
syncs via the remote brain's artifacts pull. The two consumer classes need
opposite answers, which is why this is a distinct state and not a
skip-the-probe special case. sync-gbrain Step 1.5 and setup-gbrain prose
route thin-client to proceed, never into broken-config remediation.

detectMcpMode secondary generalization: url-match against the config's
remote_mcp.mcp_url (deterministic — gbrain mounts at the generic /mcp path)
-> name pattern gbrain[-_]* -> stdio command token; gbrain_mcp_mode stays a
3-value enum.

Tripwires: end-to-end --is-ok exits 0 on a thin-client fixture AND still
exits 1 on broken-config (the gate didn't widen); pre-probe + stderr-fallback
classifier paths; 4 detectMcpMode identification cases incl. a non-matching
url that must NOT false-positive.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-07-09 19:29:37 -07:00
co-authored by Claude Fable 5
parent a7a25aa489
commit e742648eda
9 changed files with 266 additions and 27 deletions
+7
View File
@@ -719,6 +719,9 @@ function dreamMarkerPid(): number | null {
* broken-db → "config points at unreachable DB; see /setup-gbrain Step 1.5"
* timeout → kept for Record totality; stages PROCEED on timeout (#1964)
* via the gate's warnProbeTimeout path, never this skip.
* thin-client → remote-HTTP MCP brain, no local engine by design (#2051);
* local sync stages skip (gbrain refuses sources/sync there),
* but suppression gates treat the brain as USABLE.
*/
function skipStageForLocalStatus(
stage: "code" | "memory" | "dream",
@@ -735,6 +738,10 @@ function skipStageForLocalStatus(
"config points at unreachable DB; see /setup-gbrain Step 1.5",
"timeout":
"engine probe timed out; raise GSTACK_GBRAIN_PROBE_TIMEOUT_MS if your pooler is slow",
"thin-client":
"thin client (remote-HTTP MCP brain, no local engine by design, #2051); " +
"code indexing runs on the brain server, memory syncs via the remote " +
"brain's artifacts pull — nothing to do locally",
};
const reason = reasons[status as Exclude<LocalEngineStatus, "ok">];
return {