Repository navigation
Extraction waits in the queue, not in the worker (#526) - #640
Merged
Merged
Conversation
rollroyces
force-pushed
the
refactor-chat-extract-ui
branch
from
September 13, 2026 04:13
f97cab1 to
20ece3c
Compare
* A Deferred marker joins Terminal in utopia_core * jobs::mark_failed recognises Deferred (queued + attempts-1 + run_at = now + retry_in) * ontology_index::gate_required enqueues embed_ontology and signals a wait * extraction::run defers at the top of run(); set_graph_status no longer fires before the wait * Drop the redundant inline ontology_index::refresh; the gate is now the single owner of that work * gate_required propagates a missing-kb as Err instead of Ok(false) * Add an integration test that two Deferred round-trips don't burn attempts Signed-off-by: Royce <roycelam@umich.edu> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* S.chat.noSourcesConsulted joins the i18n bundles in en + zh * Chat.tsx renders the mark under the bubble when sources is empty and the turn is no longer streaming * The mark sits in text-ink-2 and adds no new colour Signed-off-by: Royce <roycelam@umich.edu> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* chat_policy.rs holds the five branches chat.rs:790-1015 grew: no_tool_on_empty_answer, force_final_answer_message, should_nudge_stalled_turn, classify_nudge_response, should_degrade_to_one_shot_rag * AfterNudge lives in chat_policy; chat.rs aliases it * chat.rs now calls into the policies; the existing stall_tests exercise the new functions directly * Drop the duplicate answer_rests_on_nothing in chat.rs The maintainer's stated direction is still rig-core (on_completion_call, ModelTurnAction, tool_choice: required). The five functions here are the building blocks for that port. Signed-off-by: Royce <roycelam@umich.edu> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
DB-gated test against a real job row: * Two Deferred round-trips leave attempts at 0, not at the failed-after-3s threshold * run_at lands ~30s in the future, so the same waiting condition can't race the queued embed_ontology job for the per-kb lock A second test pins the Terminal-overrides-Deferred contract. Signed-off-by: Royce <roycelam@umich.edu> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
rollroyces
force-pushed
the
refactor-chat-extract-ui
branch
from
September 13, 2026 04:33
87ec05d to
0b8ac49
Compare
This was referenced Sep 13, 2026
Contributor
|
Thanks @rollroyces — this was a useful PR, and splitting the commits per issue made it easy to take apart. I've split it so each piece can be reviewed and merged on its own:
Follow-up on #526 (
🤖 Generated with Claude Code |
Signed-off-by: WaylandYang <wayland0916@gmail.com> # Conflicts: # crates/utopia-core/src/error.rs
Signed-off-by: WaylandYang <wayland0916@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 13, 2026
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.
Summary
Four commits for four issues. The maintainer's stated direction in each issue body drives the shape:
extraction::runno longer holds a worker waiting on the ontology index.utopia_core::Deferred { retry_in }is the symmetric counterpart ofTerminal;jobs::mark_failedrecognises it and writesqueued + attempts-1 + run_at = now + retry_in. The same waiting condition produces the same offset, not30s × attempts².ontology_index::gate_requiredenqueuesembed_ontologyonce, returnsOk(true)sorun()defers immediately, and the old inlinerefresh(which raced with the queued job for the per-kb lock) is gone.S.chat.noSourcesConsulted(未引用任何来源) renders under the assistant bubble whensourcesis empty and the turn is no longer streaming.text-ink-2, no new colour.chat.rs:790-1015's five branches become named functions inapi/chat_policy.rs:no_tool_on_empty_answer,force_final_answer_message,should_nudge_stalled_turn,classify_nudge_response,should_degrade_to_one_shot_rag. The chat loop calls them;stall_testsnow exercise them directly. The next step isrig-core'son_completion_call/ModelTurnAction/tool_choice: required— the trait rewrite will be a translation, not a redesign.a_deferred_job_does_not_spend_its_budget— DB-gated test pinning both contracts: two Deferred round-trips leave attempts at 0, and Terminal wins when both markers are attached.#520(TPC-H harness) is not in this PR. Itssql_right/answer_rightcolumns belong in their own harness binary.Test plan
cargo check --workspace --testscleancargo test --workspace --lib→ 241 passcargo test -p utopia-server chat_policy stall_tests→ 12 passpnpm typecheck,pnpm test,pnpm guard,cargo fmt --checkcleanUTOPIA_TEST_REQUIRE_DBNotes
is_terminal/is_deferredread the top-levelanyhow::Error, notchain(). anyhow'sContext::context(E)for non-Errorinner types (e.g.&str) selects theDisplayimpl, which doesn't preserve the marker as an Error —chain().find_map(...)would silently miss it. Both real call-site patterns (Error::new(MARKER).context(...)andanyhow::Error::from(e).context(MARKER)) place the marker at the top.gate_requiredreusesextraction::build_listsvia apub(crate) full_ontology_chars()so the budget calculation can't drift from the actual铺全部path.