fix(swarm): resolve all blocking and medium PR review issues#407
fix(swarm): resolve all blocking and medium PR review issues#407cuongdo-byterover wants to merge 1 commit intoproj/swarm-memoryfrom
Conversation
Blocking (5 fixes): - #1: Bound resolveUniqueFilename loop to MAX_SUFFIX=10000 with timestamp fallback (local-markdown-adapter) - #2: Make GBrain bin resolution lazy — execFileSync no longer runs in constructor, deferred to first executor use - #3: Replace execFileSync with async execFileAsync in config-validator (validateGBrain is now async) - #4: Add MAX_ARG_LENGTH guard (200KB) in execBrvCurate to prevent E2BIG on large content - #5: Bound memory-wiki store() filename loop with same pattern Medium (6 fixes): - #6: Remove unreachable 'creative' from QueryType union and SELECTION_MATRIX - #8: Replace this.index! non-null assertions with explicit null guards in obsidian and local-markdown adapters - #9: Fix byterover writeSupported: true → false in createDefaultCapabilities (matches adapter) - #10: Replace 'as' type assertion with instanceof narrowing in execBrvCurate error handler - #11: Replace 'as Error' assertions with instanceof checks in swarm curate and query CLI commands - Stale JSDoc: remove 'creative' from router comment Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @cuongdo-byterover's task in 3m 21s —— View job PR Review — fix(swarm): resolve all blocking and medium PR review issues
SummaryOverall score: 3 / 5 The defensive fixes in this PR (null assertion removal, error type narrowing, IssuesCritical / Correctness
// current — broken for titles with quotes
`title: "${title}"`,
// fix
`title: ${JSON.stringify(title)}`,
// fix: sanitize the end marker in user content before insertion
content.replaceAll('', ''),MediumMissing unit tests — violates mandatory TDD policy
Only
Low / Nitpick
What's done well
|
Summary
brv swarm query.memory-wikias the 7th swarm provider. The adapter reads directly from the wiki vault on disk (no subprocess), uses MiniSearch for fast in-process search (~12ms for 118 pages), supports writes toentities/andconcepts/directories with proper OpenClaw frontmatter, and applies freshness + kind boosts for structured ranking.Type of change
Scope (select all touched areas)
Linked issues
Root cause (bug fixes only, otherwise write
N/A)N/A
Test plan
test/unit/agent/core/domain/swarm/types.test.ts(updated: 7 providers)concepts/with correct frontmatter, immediately queryable✓inbrv swarm status--explainUser-visible changes
memory_wikiin.brv/swarm/config.yaml[wiki]source label in whiteBrightbrv swarm statusdisplays Memory Wiki healthbrv swarm curatecan write to wiki vault (concept/entity pages with OpenClaw frontmatter)personalqueries (wiki content is factual, not personal)Evidence
Status:
Query with explain (118 pages, 5 providers):
Write to wiki:
Performance (15 queries, 118 pages):
Checklist
npm test) — 5891 passingnpm run lint) — pre-commit hook verifiednpm run typecheck)npm run build)mainRisks and mitigations
Risk: Direct file system access to wiki vault — concurrent writes from OpenClaw and ByteRover could conflict.
concepts/andentities/with aswarm.prefix in the page ID. OpenClaw wiki operations target different page types (sources, syntheses). The.openclaw-wiki/locks/directory exists for OpenClaw's internal locking — ByteRover does not acquire locks (acceptable for low-frequency writes).Risk: MiniSearch index not invalidated when OpenClaw updates wiki pages externally.
agent-digest.jsonmtime. When OpenClaw runswiki compile, the digest is updated, which invalidates the MiniSearch cache on next query.Risk:
extractContentSection()may not correctly strip all OpenClaw page templates.```text\n...\n```code block (standard wiki source page format), (2) fallback to stripping YAML frontmatter. Tested with both imported source pages and manually curated concept pages.