Skip to content

fix(cli): thin-client pre-connectEngine routing seam for CLI-only commands#2304

Open
2anoubis wants to merge 1 commit into
garrytan:masterfrom
2anoubis:fix/thin-client-cli-only-routing
Open

fix(cli): thin-client pre-connectEngine routing seam for CLI-only commands#2304
2anoubis wants to merge 1 commit into
garrytan:masterfrom
2anoubis:fix/thin-client-cli-only-routing

Conversation

@2anoubis

Copy link
Copy Markdown

Problem

gbrain graph-query, gbrain salience, gbrain anomalies, gbrain think, gbrain recall, gbrain forget, gbrain whoknows, and gbrain founder all crash on thin-client installs with:

No database URL: database_url is missing from config

gbrain status works because it has a dedicated pre-connectEngine() thin-client guard. gbrain get works because it routes through the op-layer dispatch path which has its own thin-client routing seam.

Root Cause

Each of these commands has isThinClient() → callRemoteTool() branches in their handlers (added in v0.31.1, commit 6ba7feb), but handleCliOnly() calls connectEngine() at line 1568 BEFORE the switch statement can dispatch to them. The handlers never reach their thin-client code.

Fix

Add pre-connectEngine() thin-client guards in handleCliOnly(), matching the exact pattern already used by status (v0.41.19.0) and eval whoknows (v0.33.1.3). Each passes null for the engine argument — the handler detects isThinClient and routes through the remote MCP op instead.

Commands fixed

Command MCP Op Scope
graph-query traverse_graph read
salience get_recent_salience read
anomalies find_anomalies read
think think write
recall recall read
forget forget_fact write
whoknows find_experts read
founder find_trajectory read

Verification

Tested on a thin-client install (remote MCP mode, no database_url):

  • gbrain graph-query people/bob ✅ — produces graph traversal output
  • gbrain salience ✅ — produces salience table
  • gbrain recall people/bob ✅ — no crash (empty results, correct)
  • gbrain status ✅ — still works (no regression)

…mands

graph-query, salience, anomalies, think, recall, forget, whoknows, and founder already contain isThinClient -> callRemoteTool branches in their handlers (v0.31.1 pattern), but handleCliOnly called connectEngine() before the switch statement could dispatch to them -- crashing thin-client installs with 'database_url is missing from config'.

Add pre-connectEngine thin-client guards matching the exact pattern already used by 'status' (v0.41.19.0) and 'eval whoknows' (v0.33.1.3). Each passes null for the engine; the handler detects isThinClient and routes through the remote MCP op instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant