Skip to content

fix: bypass ReAct for knowledge-base intent (book button) — #209 Fix 1 - #210

Merged
pluginslab merged 3 commits into
devfrom
fix/209-rag-bypass-react
May 15, 2026
Merged

pluginslab merged 3 commits into
devfrom
fix/209-rag-bypass-react

Conversation

@pluginslab

Copy link
Copy Markdown
Owner

Summary

  • New `processWithDocSearch` path: when the user has the docs/book toggle on, skip the ReAct tool-selection loop entirely. Runs a vector-store lookup, builds a context-augmented prompt, and streams a direct LLM answer with no tool calls.
  • Honors the user's "disable thinking before tool" setting (`/nothink` flag); defensively strips any `` blocks Qwen emits anyway.
  • Falls back to a context-less conversational answer (still no tools) when the index is empty or the vector lookup fails — never silently re-routes into ReAct.

Why

Qwen 3 1.7B (the default model, prompt-based JSON mode) hallucinates tool calls when no tool clearly matches. With the book button on, the user has stated their intent — fishing for tools is wrong.

Repro (before): book button on + "Whats the hook that allows me to inject content in the footer?" → invokes `role-capabilities-check` or `rewrite-list`.

After: routes to doc-search, no tool call, clean conversational answer.

Partially addresses #209 (Fix 1 of 3). Fix 2 (post-hoc tool validation) and Fix 3 (soften read-file priming) tracked in the same umbrella.

Notes

  • The commit list shows the v0.11 admin-page-hook fix (`2672eef`) because `dev` is currently missing the v0.11 release commits. That commit will resolve as a no-op once `release/v0-11-prep` merges back into `dev`.

Test plan

  • Build clean (`npm run build`)
  • Lint clean (`npx wp-scripts lint-js`)
  • Unit tests pass (96/99, 3 skipped — unchanged from main)
  • Manual: book button on + knowledge question → no tool call, clean answer
  • Manual: thinking-mode toggle respected (no leaked `` content with it off)
  • Manual: book button on + workflow-keyword query → workflow still wins ("flush cache", etc.)
  • Manual: book button off → existing ReAct path unchanged

🤖 Generated with Claude Code

pluginslab and others added 2 commits May 15, 2026 14:18
The menu slug was renamed from wp-agentic-admin to agentic-admin in #206,
but three hook/screen-id checks still referenced the old slug. As a result,
the dedicated admin page never enqueued the React app (empty page), and
the sidebar diamond button incorrectly rendered on top of it.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
When the user enables the docs/book toggle, route directly to a new
processWithDocSearch path instead of running the ReAct tool-selection
loop. Small models (Qwen 3 1.7B in prompt-based JSON mode) hallucinate
tool calls when no clear match exists — e.g. asking "what hook injects
content in the footer?" with the book button on previously invoked
role-capabilities-check or rewrite-list. The user's explicit RAG intent
should win.

New path runs an in-browser vector search, builds a context-augmented
prompt, and streams a direct LLM answer with no tool selection. Respects
the user's "disable thinking before tool" setting by appending /nothink,
and still defensively strips <think> blocks (Qwen sometimes ignores the
flag — same pattern as react-agent.js:241). Leaked thinking tokens, when
thinking is enabled, route through the standard onThinkingStart/Chunk/End
callbacks so they collapse into the thought-process timeline entry
instead of leaking into the visible chat body.

Falls back to a context-less conversational answer (still no tools) when
the index is empty or the vector lookup fails — never silently re-routes
into ReAct.

Partially addresses #209 (Fix 1). Fixes 2 and 3 (post-hoc tool
validation, soften read-file priming) tracked separately in the same
umbrella issue.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Auto-load paths called modelLoader.isModelCached() and modelLoader.load()
without arguments, falling back to DEFAULT_MODEL (Qwen3-1.7B) regardless
of the user's saved selection. Now reads agentic_admin_model from
localStorage and passes it through.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@pluginslab
pluginslab merged commit 7c5469f into dev May 15, 2026
4 checks passed
@pluginslab
pluginslab deleted the fix/209-rag-bypass-react branch May 15, 2026 13:52
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.

1 participant