Skip to content

Sequential pipeline emits invalid JSON: unterminated "broker" on ASYNC_CALLS edges, raw non-JSON Route properties #898

Closed

Description

@kriswill

Version: codebase-memory-mcp 0.8.1 (built from source)
Platform: macOS (Apple Silicon) · Install channel: Built from source · Binary variant: standard

What happened, and what did you expect?

Two JSON-emission bugs in pass_calls.c (the sequential pipeline path — small repos; the parallel path is correct):

  1. The ASYNC_CALLS edge props format closes the method field with a quote but not broker, producing "broker":"bullmq}. The fixup block beneath it only repairs the truncation case (props[plen-1] != '}'), which never fires in the normal case — so every brokered ASYNC_CALLS edge gets malformed properties.
  2. create_svc_route_node stores the raw method/broker string as the Route node's properties (e.g. literally bullmq instead of {"broker":"bullmq"}).

Consequence: any json_extract over those rows errors — including the edges generated columns (local_name_gen, the url_path index), so index-backed queries over such edges can fail, and PRAGMA quick_check (which recomputes generated columns) aborts with malformed JSON instead of completing. The parallel path's build_service_route / emit_http_async_service_edge handle both correctly, so the two pipelines produce different bytes for the same input.

Expected: the sequential path emits the same valid JSON as the parallel path.

Reproduction

Index this snippet as a small repo (small file counts take the sequential path):

const { Queue } = require("bullmq");
const mailQueue = new Queue("mail");
async function notify() { await mailQueue.add("welcome-email", {}); }

Then:

SELECT count(*) FROM edges WHERE json_valid(properties)=0;  -- expect >= 1
SELECT count(*) FROM nodes WHERE json_valid(properties)=0;  -- expect >= 1 (Route nodes)
PRAGMA quick_check;  -- aborts: "malformed JSON"

Observed field values: edges with {"callee":"mailQueue.add","url_path":"welcome-email","broker":"bullmq} and Route nodes whose properties column is the bare string bullmq.

Cascade

Found while root-causing #895/#896: a quick_check-based integrity gate (the natural fix for #895) trips over these rows, so this needs fixing first or the gate must tolerate non-corruption quick_check aborts — otherwise projects with brokered async calls would re-index into the same state repeatedly. Companion: #897.

Maintainer note

I have a working private fix for this (with reproduce-first regression tests) that I can submit as a PR. Before I do, I'd prefer you groom this issue — confirm the framing, tag, and prioritize — so the PR lands against an agreed shape.

Confirmations

  • I searched existing issues and this is not a duplicate.
  • My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.

Activity

  1. kriswill commented on Jul 5, 2026

    @kriswill
    ContributorAuthor

    Companion issues in this cascade:

    # Issue Role in the cascade
    #895 Fast artifact export raw-copies a live WAL-mode DB Producer — torn graph.db.zst, weak import gate
    #896 Row-scan loops swallow SQLITE_CORRUPT Concealer — total=N, results=[] with no error
    #897 Fresh DB install leaves old -wal/-shm behind Second producer — stale WAL replayed over the new file
    #898 Sequential pipeline emits invalid JSON Gate blocker — aborts a quick_check-based integrity gate (this issue)
  2. added
    bugSomething isn't working
    parsing/qualityGraph extraction bugs, false positives, missing edges
    priority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
    on Jul 7, 2026
  3. DeusData commented on Jul 7, 2026

    @DeusData
    Owner

    Thanks for the precise sequential-pipeline JSON report. Triage: high-priority graph property correctness bug under #592.

    Sequential and parallel extraction must produce the same valid JSON shape for ASYNC_CALLS and Route properties. A good guard would assert json_valid/json_extract behavior on emitted edge and route properties, not just string equality.

  4. added this to the 0.9.1-rc milestone on Jul 8, 2026
  5. added a commit that references this issue on Jul 11, 2026
    51921d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions