Skip to content

fix(deep): retry pending nodes — don't cache empty meaning summaries (#172) - #177

Merged
shhdwi merged 2 commits into
trailhq:mainfrom
Frankie-Xu:fix/172-deep-pending-state
Aug 24, 2026
Merged

shhdwi merged 2 commits into
trailhq:mainfrom
Frankie-Xu:fix/172-deep-pending-state

Conversation

@Frankie-Xu

Copy link
Copy Markdown
Contributor

Summary

graft build --deep could finish successfully while leaving every wiring node summary: null / pending, then graft check told you to re-run --deep forever. That is exactly #172.

Root cause

Two silent paths in the meaning tier (not thrown provider errors — those are already covered by #127):

  1. Empty reply treated as success. When describeFile returned [] (gateway ignored tool_choice and left toolCalls empty, or the model omitted every symbol), collectFileCrux returned { results: ∅ } with no error. Enrich left nodes pending, failedFiles stayed 0, the CLI exited 0, and check’s only advice was “run graft build --deep”.
  2. Blank summaries cached as ready. node.summary = r.summary || null still set summary_state: "ready", so the next --deep was a permanent body-hash cache hit with summary: null.

The reporter’s Together / DeepSeek-V4-Flash setup is the same trigger as #129 (content instead of tool calls). This PR is the meaning-tier / pending-state fix: fail loudly, don’t cache empties, recover crux payloads from content when present, and make check name the stuck nodes. Full synth-side recovery for #129 is still separate.

Changes

  • enrich: total miss → error + failedFiles (CLI deep build swallows per-file LLM failures (incl. 429) and exits successfully #127 path exits 1); whitespace-only summaries stay pending and remain retryable.
  • ChatCruxSummarizer: if toolCalls is empty, recover {symbols:…} from content (plain JSON, fences, or [{name, parameters}] emulation).
  • graft check: list pending ids and say that if a deep build already left them pending, look at that build’s errors — re-running alone will not clear a failed meaning pass.

Test plan

  • test/graph-enrich-pending.test.ts — empty reply → failedFiles; blank summary not cached as ready; check wording; content recovery
  • npm run build && npm test — 758 pass
  • Optional with a real key: issue repro (src/calc.py) → build --deep either fills meaning or exits non-zero with a readable error; graft check names pending nodes if any remain

Closes #172

Made with Cursor

Frankie-Xu and others added 2 commits August 21, 2026 16:00
…ding (trailhq#172)

Silent empty tool/content responses left every node pending, exited 0, and made
graft check loop on "run --deep". Reject blank summaries as cache hits, recover
crux payloads from content when gateways ignore tool_choice, and name pending
nodes in check with a real next step.

Co-authored-by: Cursor <[email protected]>
@shhdwi

shhdwi commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Verified locally on top of current main (rebased past a trivial package-lock.json version-string conflict — took main's 0.12.1; the PR changes no deps; build clean).

Fixes #172's two silent-success paths in enrich.ts: (1) a blank summary no longer flips a node to ready with summary=null — the guard is now if (!r || !r.summary.trim()), so the node stays pending and retryable; (2) a total-miss now surfaces a fileError into the degraded-exit gate, and check.ts reports the stuck node ids.

Load-bearing evidence: the PR's 4 new #172 tests fail 0/4 against base main (base emits the exact stuck "…not yet summarized; run graft build --deep") and pass 4/4 with the PR; a working summarizer retries the pending nodes next run (computed=4, cached=0). graph-enrich* all green. Fixes #172. Merging.

@shhdwi
shhdwi merged commit bd6bf6b into trailhq:main Aug 24, 2026
4 of 6 checks passed
shhdwi pushed a commit that referenced this pull request Aug 27, 2026
…ores tool_choice (#129) (#216)

* fix(llm): parse emulated tool calls from content when the gateway ignores tool_choice (#129)

DeepSeek-class gateways drop tool_calls and write the payload in content, so
ChatSynthesizer returned [] with no warning. Recover the same JSON conservatively
(array / object / fence), reuse #177's empty-result retry, and log per-batch
node/link counts so a 0-link multi-batch run is visible.

Co-authored-by: Cursor <[email protected]>

* fix(llm): parse gateway tool-call content without backtracking regex (#129)

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>
shhdwi pushed a commit that referenced this pull request Aug 31, 2026
…or (#235) (#254)

Empty/unusable crux replies stay failed and uncached (#177), but consecutive
content-quality misses no longer trip LlmFailureGate. Quota/auth still stop
immediately. Per-file errors now include miss class and finish_reason.

Co-authored-by: Cursor <[email protected]>
FrancescoMerenda pushed a commit to FrancescoMerenda/Graft that referenced this pull request Sep 7, 2026
…ding (trailhq#172) (trailhq#177)

Silent empty tool/content responses left every node pending, exited 0, and made
graft check loop on "run --deep". Reject blank summaries as cache hits, recover
crux payloads from content when gateways ignore tool_choice, and name pending
nodes in check with a real next step.

Co-authored-by: Cursor <[email protected]>
Co-authored-by: Shrish Dwivedi <[email protected]>
FrancescoMerenda pushed a commit to FrancescoMerenda/Graft that referenced this pull request Sep 7, 2026
…ores tool_choice (trailhq#129) (trailhq#216)

* fix(llm): parse emulated tool calls from content when the gateway ignores tool_choice (trailhq#129)

DeepSeek-class gateways drop tool_calls and write the payload in content, so
ChatSynthesizer returned [] with no warning. Recover the same JSON conservatively
(array / object / fence), reuse trailhq#177's empty-result retry, and log per-batch
node/link counts so a 0-link multi-batch run is visible.

Co-authored-by: Cursor <[email protected]>

* fix(llm): parse gateway tool-call content without backtracking regex (trailhq#129)

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>
FrancescoMerenda pushed a commit to FrancescoMerenda/Graft that referenced this pull request Sep 7, 2026
…or (trailhq#235) (trailhq#254)

Empty/unusable crux replies stay failed and uncached (trailhq#177), but consecutive
content-quality misses no longer trip LlmFailureGate. Quota/auth still stop
immediately. Per-file errors now include miss class and finish_reason.

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build --deep leaves nodes permanently pending; graft check then reports an unresolvable "not yet summarized" state

2 participants