Repository navigation
fix(llm): stop a failed --deep round from erasing the concept layer - #111
Closed
christian-jorge wants to merge 6 commits into
Closed
christian-jorge wants to merge 6 commits into
christian-jorge wants to merge 6 commits into
Conversation
…ting Adds a third transport, `claude-cli`, that drives the locally installed and already-signed-in Claude Code binary in headless mode. `--deep` previously required GRAFT_API_KEY, so a developer paying for a Claude subscription still had to buy separate API credits for concept nodes and per-symbol summaries. The CLI is a coding agent, not a completions endpoint, so the adapter narrows it: every built-in tool is disabled, and the user's settings, hooks, MCP servers and CLAUDE.md are kept out of the run — without that a personal "always answer in Portuguese" memory silently rewrites every summary in the graph. Structured output is emulated (no tool_choice on this wire) and transient failures are retried with backoff. Provider selection is explicit-first: an existing key-based setup resolves exactly as it did before. The CLI is only inferred when no key is configured. Also pins the savings/stats number formatting to en-US. Nine bare toLocaleString() calls followed the machine locale, so a pt-BR host rendered 1990 as "1.990" — and graft explicitly asks the reading agent to SUM those numbers across calls, making its headline metric ~1000x low. This was already failing three tests upstream. 681 tests, 0 failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Windows only *marks* a file deleted and keeps it in its directory until the last handle closes, so an rmdir racing a just-closed parse or an exiting child throws ENOTEMPTY. Bare rmSync teardowns made a DIFFERENT test fail on each full run while every one passed in isolation. Callers move over in later changes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…king a WASM parser per file A Python repo's graph had no cross-file edges at all: resolveImport treated '.utils' as a JS-relative path, producing candidates like src/.utils that never exist. Relative dots now walk directories and __init__.py is a candidate. JSX component usage produced no edge either — <Button/> is the field 'name' of a JSX element, which isDeclarationName counted as a declaration, so in a React app most real dependencies were invisible. Also: the breadth tier allocated a Parser and a Tree per file and freed neither (both live in the WASM heap, out of reach of the GC); git ls-files during a merge conflict emitted every conflicted path three times, tripling its nodes; C/C++ header prototypes shadowed their definitions; and the extraction cache stamp ignored queries/*.scm, so editing a grammar query invalidated nothing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…d honor --in across a workspace A pattern from a user or an LLM ran unbounded against every file, so one catastrophic backtrack hung the whole MCP server. grep now runs under a time budget and reports when it stopped early, in the CLI as well as over MCP. The viz server accepted any Host header, so any page a developer visited could rebind DNS and read the repo graph off localhost; and the viewer's esc() left quotes unescaped, letting a symbol name break out into an attribute. Both are closed and covered. Also: graft_trace_calls silently degraded depth 'all' to 1 in a workspace, the --in filter was dropped entirely for grep and find_all across child repos, and $ anchors never matched in a CRLF checkout. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ited refresh inside the repo runInit treated a settings.json it could not parse — a BOM, a comment, a trailing comma — as absent and overwrote it, taking permissions, env, model, hooks and statusLine with it, without a backup. It is now refused and reported, including through the automatic refresh path so hook-only users see it. An unsolicited refresh no longer creates machine-wide config it was never asked for: the --no-global opt-out is memoized outside the repo, so deleting graft/ or cloning fresh no longer loses it. The committed shims carry no developer's home directory, re-init rewrites nothing when nothing changed (a fresh clone stops going dirty), and the unscoped `npx graft` grant is revoked rather than carried forward. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…and account for what it cost A round where every summary call failed produced an empty node set, and the reconcile step then pruned every existing concept node — including the human notes written below the generated block. Nothing is pruned now when synthesis produced nothing. A 429 during synthesis no longer discards the per-file summaries already paid for in phase one, a truncated reply is no longer cached as an empty summary (stopReason is checked), and crux targets outside the truncation window are no longer asked about. `-j/--concurrency` now reaches the concept pass, where a --deep build spends most of its calls; it used to stop at the wiring tier and sit fixed at 8. Per-run token usage is collected and printed instead of being normalized carefully and thrown away, retries are configurable on every provider, and GRAFT_PROVIDER is validated instead of cast. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This was referenced Aug 17, 2026
Merged
9 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
--deepround where every summary call failed erased the whole concept layer. With no successful summaries the node set is empty, and the reconcile step then pruned every existing concept node — including anything a human wrote below the generated block, which the file format explicitly promises to preserve. One expired key or one 429 storm was enough. Nothing is pruned now when synthesis produced nothing.Also on the money path:
stopReasonwas never checked, so a reply truncated atmax_tokenswas cached as a valid empty summary — and the cache is keyed by content hash, so it stayed wrong until the file changed.cruxtruncated the file at 18k chars but still asked about targets whose line numbers were past the cut.-j/--concurrencynever reached the concept pass, where a--deepbuild spends most of its calls; it sat fixed at 8 regardless of the flag.Usagewas normalized carefully across providers and then thrown away. A run now reports what it cost.GRAFT_PROVIDERwas cast, not validated, so a typo produced an undefined model and an error from deep inside an SDK.Part of a stack. This work started as an audit of
mainand is split by area so each piece is reviewable on its own. Order, each based on the one before it:feat/subscription-provider—--deepwithout an API key, + the locale bugfix/graph-extraction— Python imports, JSX edges, WASM leakfix/query-and-viz-security— ReDoS, DNS rebinding, XSS,--infix/hosts-settings-safety— thesettings.jsonwipefix/llm-build-robustness— the concept-layer wipe, usage accountingfix/windows-and-cli-ux— the dead npm path on Windowschore/ci-and-packaging— type-check the tests, run the packaged artifactdocs/config-reference— the config surface the above introducedCross-fork PRs can only target
main, so GitHub shows the cumulative diff here. This PR own diff: fix/hosts-settings-safety...christian-jorge:Graft:fix/llm-build-robustnessEvery link in the stack is green on its own:
tscclean and the full suite at 0 failures on Windows. Happy to reorder, rebase, drop any piece, or squash the lot back into one — just say which.🤖 Generated with Claude Code