Skip to content

An empty balance stops open extraction at the refused chunk, so the job fails once and raises the alert - #1118

Merged
WaylandYang merged 2 commits into
deeplethe:devfrom
asaf-shitrit:fix/open-extraction-out-of-credit
Oct 9, 2026
Merged

WaylandYang merged 2 commits into
deeplethe:devfrom
asaf-shitrit:fix/open-extraction-out-of-credit

Conversation

@asaf-shitrit

Copy link
Copy Markdown
Contributor

Why

Closes #1095. Open extraction kept an OutOfCredit refusal as a string and moved to the next chunk, so the job used all 3 attempts and no llm.out_of_credit alert fired.

What changes

call_and_parse_one_chunk returns the error with its chain intact when utopia_llm::out_of_credit finds it, next to the no-chat-model case. unextracted stays a list of strings, and nothing outside the helper changes.

Afterwards, chunks applied before the refusal stay in the graph with extracted_at set. The document is failed, with the refusal as its graph_error. The next run continues from the refused chunk. Like the other errors inside the chunk loop, this exit skips the end-of-run refresh_disambiguators.

How it was checked

A test in extraction_open_out_of_credit_tests.rs uses a scripted endpoint and a real database. It extracts 3 chunks, and the endpoint refuses the second one. The third chunk is not called, the error is hopeless at attempt 1 of 3, and one llm.out_of_credit alert fires. The fact from chunk 0 stays, only chunk 0 has extracted_at, and the document is failed.

The test fails on dev without the fix.

Before review

  • Every commit is signed off (git commit -s)
  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace pass

…ob fails once and raises the alert

Closes deeplethe#1095

Signed-off-by: Asaf Shitrit <asafshitrit.dev@gmail.com>

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. This is the small fix we agreed on #1095: one arm in call_and_parse_one_chunk returns the refusal with its chain intact, and nothing outside the helper moves.

The test covers what the issue asked for: the third chunk is not called, the error is final at the first attempt, one llm.out_of_credit alert fires, and the chunk applied before the refusal stays. Thank you also for stating what the document looks like afterwards, including that this exit skips the end-of-run disambiguator refresh like the other errors in the loop.

Merging after the release sync that is in flight. Thanks again.

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.

2 participants