Get this on every PR automatically. Webhook fires, AI reviews, you approve.
Install on langchain-ai/openwiki →
// reviewed by pulllight
PullLight found 3 issues
1 high
2 medium
// convert to your repo
PullLight caught 3 1 high, 2 medium on this PR.
Install on langchain-ai/openwiki to get this on every PR automatically — 60 seconds.
Findings
3 issues
high
logic
Race condition / data inconsistency: `backend.edit` is called with `(filePath, content, repaired)` where `content` is the original file text read moments earlier. If another writer modifies the file between the `readText` call and this `edit` call, the optimistic-concurrency check (if `edit` uses the old content as a base/ETag) will either silently overwrite the concurrent change or fail. More critically, if `edit` succeeds but the file was already modified, `repaired` is returned and used for indexing even though it was built from a stale `content` snapshot. The return value should be re-read from the backend after a successful edit, or the caller should re-read and re-parse rather than trusting the locally-constructed `repaired` string.
// src/agent/index-middleware.ts:163
medium
logic
`hasFrontmatterOpening` only checks for a leading `---\n` delimiter but does not verify the file doesn't start with a BOM (`\uFEFF`) or leading whitespace/newlines. A file beginning with `\n---\n` or `\uFEFF---\n` will be treated as legacy and have duplicate front matter prepended, corrupting the file.
// src/agent/index-middleware.ts:175
medium
logic
`renderFallbackFrontmatter` interpolates `title` and `description` via `JSON.stringify`, which correctly escapes double-quotes and backslashes. However, YAML block scalars are not used, so a title or description containing a newline character (e.g. from `firstHeading` matching a line that somehow contains `\n` after trim) would produce invalid YAML front matter. `JSON.stringify` does escape `\n` to `\\n` in JSON strings, so this is safe for JSON-style quoting — but worth confirming that `firstHeading` and `firstParagraph` cannot return multi-line strings (the heading regex uses `$` with `m` flag so it stops at line end; `firstParagraph` joins lines with spaces — both appear safe, but the guarantee is implicit).
// src/agent/index-middleware.ts:183