fix(gbrain-detect): classify gbrain >= 0.43 held-lock refusal as engine-locked, not broken-config - #2698
Open
pvanl wants to merge 1 commit into
Open
Conversation
…ne-locked gbrain 0.43+ refuses a held PGLite lock with exit 1 and the message "GBrain's local database is already open through `gbrain serve` (MCP, PID N)" instead of the pre-0.43 exit 124 + "connect timed out" that the garrytan#2194 branch matches. The message matches no known pattern, so the classifier falls through to the defensive broken-config default — and Step 1.5 of /setup-gbrain and /sync-gbrain then tell the user to move a perfectly healthy config.json aside and re-init the engine. Reproduced live on gbrain 0.43.0.0, 0.44.0.0 and 0.46.30.0: with a serve holding the lock, gstack-gbrain-detect reports gbrain_local_status=broken-config; after stopping the serve it reports ok with the same untouched config. Match on the stable substring "already open through", mirroring the existing garrytan#2194 branch semantics: engine-locked for pglite, broken-db otherwise. Adds a fake-gbrain behavior for the 0.43+ refusal plus two cases (pglite -> engine-locked, postgres -> broken-db). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
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.
What
lib/gbrain-local-status.tsrecognizes a held PGLite lock only by the pre-0.43 signature: stderr containingconnect timed outor exit code 124 (#2194). Since gbrain 0.43.0.0 the CLI refuses the same case with exit 1 and its own message:That string matches none of the classifier branches, so it falls through to the defensive
broken-configdefault.Why it matters
broken-configis not cosmetic: Step 1.5 of/setup-gbrainand/sync-gbrainSTOP on it and offer remediation that moves a perfectly healthy~/.gbrain/config.jsonaside and re-inits the engine. A user who follows that advice wipes a working setup because an MCP serve happened to hold the lock — which is the normal state whenever a Claude Code session with the gbrain MCP is open.Reproduced live on gbrain 0.43.0.0, 0.44.0.0 and 0.46.30.0: with a serve running,
gstack-gbrain-detectreportsgbrain_local_status=broken-config; kill the serve and the same untouched config reportsok. Verified the message contains neitherconfig.jsonnorCannot connect to databasenorconnect timed out, so no existing branch can catch it.Fix
One branch next to the existing #2194 case, matching the stable substring
already open through, with identical semantics:engine-lockedfor pglite,broken-dbotherwise.Tests
Added a fake-gbrain behavior for the 0.43+ refusal (exit 1 + message) and two cases: pglite →
engine-locked, postgres →broken-db. Without the lib change both fail on thebroken-configfall-through.Kind regards from Peter's agent, who never sleeps... ツ
🤖 Generated with Claude Code