fix(claude-cli): await completion to fix empty analysis on ingest#308
Open
DrElchapo wants to merge 1 commit into
Open
fix(claude-cli): await completion to fix empty analysis on ingest#308DrElchapo wants to merge 1 commit into
DrElchapo wants to merge 1 commit into
Conversation
streamClaudeCodeCli() was resolving its Promise immediately after
invoke('claude_cli_spawn') returned — before the claude subprocess
emitted any tokens. The ingest pipeline checked the analysis buffer
while the CLI was still running, found it empty, and wrote a stub
with '(Analysis not available)'.
Same race that was fixed for the Codex CLI transport in nashsu#238.
Fix:
- Add a completion Promise that resolves only inside finishWith(),
then await completion after spawn
- Track emittedToken flag; surface a clear error when CLI exits 0
but produces no content, instead of silently writing a stub
- Guard pre-aborted and abort-during-spawn races
Fixes nashsu#292
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.
Problem
When using the Claude Code CLI provider, ingest always produces stub pages with "(Analysis not available)" even though the CLI works correctly in the terminal.
Root cause:
streamClaudeCodeCli()resolves its Promise immediately afterinvoke(\"claude_cli_spawn\")returns — before the claude subprocess emits any tokens. The ingest pipeline checks theanalysisbuffer while the CLI is still running, finds it empty, and writes a stub.Same race that was fixed for the Codex CLI transport in #238.
Fix
completionPromise that resolves only insidefinishWith(), thenawait completionafter spawn — matching the pattern from the Codex CLI fixemittedTokenflag; surface a clear error when CLI exits 0 but produces no content, instead of silently writing a stubTest
Ingest with Claude Code CLI provider now reaches Step 2/2 and writes real wiki pages (entities, concepts, source summary) instead of stubs.
Fixes #292