feat(SUP-1500): add GBrain graph recall helper#22
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61c5f78fdb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const seedValues = options.seeds || overrides.seeds || options.seed || overrides.seed; | ||
| const seeds = asStringList(seedValues); | ||
| const results = seeds.map((seed) => { | ||
| const command = runCommand(config.gbrainBin, ['graph', seed, '--depth', String(depth)], { |
There was a problem hiding this comment.
Invoke the current graph-query command
The current upstream GBrain command reference and verification runbook list graph traversal as gbrain graph-query <slug> --depth 2, not gbrain graph; this wrapper builds gbrain graph ..., so jarvos-gbrain graph --seed ... will fail on current GBrain installs before returning any recall results. Please switch the spawned command to graph-query (or version-gate/alias it) and update the tests/docs accordingly.
Useful? React with 👍 / 👎.
c2791d7 to
5d841ef
Compare
61c5f78 to
62a4a7a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62a4a7a39c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dryRun, | ||
| timeoutMs: config.retrievalTimeoutMs, | ||
| }); | ||
| const parsed = dryRun ? { ok: true, value: [], error: null } : parseJsonOutput(command.stdout || '[]'); |
There was a problem hiding this comment.
Parse graph-query's real text output
When this runs against the current GBrain CLI, graph-query does not emit a JSON array: I checked upstream src/commands/graph-query.ts, where runGraphQuery prints an indented tree like [depth 0] <slug> / --type-> ... (or No edges found...). Because this line unconditionally JSON-parses stdout, every non-dry-run graph recall with a real GBrain install will report ok: false and return no nodes even when traversal succeeds; either request a JSON-capable surface/MCP op or parse the actual CLI format.
Useful? React with 👍 / 👎.
5d841ef to
95faeeb
Compare
6744ee9 to
a9b677f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9b677f17b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (nodes.length > 0) return { ok: true, value: nodes, error: null }; | ||
| return { ok: false, value: null, error: json.error || 'Expected gbrain graph-query output' }; |
There was a problem hiding this comment.
Handle no-edge graph-query output
When gbrain graph-query succeeds for a valid seed that has no traversable edges, the current CLI output is a No edges found... message rather than a JSON array or [depth ...] tree. This parser drops that line and returns ok: false, so graphRecall reports a parse failure even though the command completed successfully and the correct recall result is simply empty; callers can misclassify sparse but valid seed pages as errors.
Useful? React with 👍 / 👎.
Summary
graphRecallto@jarvos/gbrainas a compact wrapper aroundgbrain graphfor sidecar recall from known seed pages.jarvos-gbrain graph --seed <slug> --depth <n>.Why
SUP-1500 found that direct GBrain search still misses some cross-source questions, while graph traversal from known seed pages finds the relevant neighboring concepts and sources. This helper makes that sidecar path callable from jarvOS/OpenClaw wiring without returning duplicated raw graph output into context.
Validation
node --check modules/jarvos-gbrain/src/index.js && node --check modules/jarvos-gbrain/scripts/jarvos-gbrain.jsnpm test --prefix modules/jarvos-gbrainnode modules/jarvos-gbrain/scripts/jarvos-gbrain.js graph --seed projects/jarvos-context-engineering-upgrade --seed sources/paperclip-openclaw-setup-guide-draft --depth 2 --timeout-ms 5000node tests/modules-smoke-test.jsbash scripts/smoke-test.shnpm testgit diff --checkStack
Base branch:
sup-1499-gbrain-qmd-eval/ PR #21.