refactor(router): route simple intents to workers_ai as primary executor#73
Conversation
) Replaces the previous O(2N) sequential D1 edge traversal with a 2-query bulk snapshot (SELECT kg_nodes, SELECT kg_edges) fed into @stackbilt/wasm-core WasmGraph.spreadActivation. Cuts D1 round trips from 2N to a flat 2 regardless of graph size. - activateGraph: Promise.all bulk load → WasmGraph BFS → free() - vitest: vite-plugin-wasm + server.deps.inline for WASM in v4 - Tests: graph, recall-baseline, recall-pipeline, recall-mindspring all updated to new 2-query mock structure (1539 passed, 1 skipped) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tor (closes #71) - DEFAULT_ROUTES: greeting, general_knowledge, tarot_pulse, tarot_trajectory → workers_ai - selectDefaultExecutor: greeting fixed route → workers_ai - Verify zone low-complexity no-tool → workers_ai (restoring intent behind // workers_ai → gpt_oss comment) - Degraded procedure fallback: ?? 'claude' → ?? 'workers_ai' - Router tests: 6 updated assertions + 5 new tests for changed routes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
stackbilt-admin
left a comment
There was a problem hiding this comment.
APPROVED
The routing changes are correct and match the issue spec. Posting one structural note and one flag on the bundled scope.
Routing correctness (✓ all match spec)
DEFAULT_ROUTES—greeting,general_knowledge,tarot_pulse,tarot_trajectory→workers_ai(web/src/kernel/router.ts:102–113)memory_recallstays ongpt_osswith the equity-recall comment (router.ts:103) ✓- Degraded fallback
?? 'claude'→?? 'workers_ai'(router.ts:452) ✓ - Verify-zone low-complexity no-tool →
workers_ai(router.ts:172) ✓ — reverting the previous intentional bump back to where the issue spec wants it selectDefaultExecutorgreeting fixed-route updated to match (router.ts:137) ✓
Test coverage (✓)
- New tests:
general_knowledge,tarot_pulse,tarot_trajectory,tarot_deep(counter-test keepinggpt_oss),greetingbaseline (router.test.ts:1096–1118) - Verify-zone test renamed + assertion updated (router.test.ts:1125, 1134)
- Degraded-procedure and broken-procedure tests updated (router.test.ts:1152, 1162)
executor-router.test.tsuntouched — correct, that file tests executor registration not dispatch routing
One structural note (non-blocking)
The internal trigger path at router.ts:219 and :240 still has ?? 'direct' as its unknown-classification fallback. The issue spec called out "line 452" specifically, so the internal path is arguably out of scope. Worth a follow-up issue if you want the internal path to also fall to workers_ai instead of direct for unknown classes — but it's a different semantic (internal triggers with unknown classifications are a different error condition than external routing misses).
Bundled scope flag
This PR bundles a substantial unrelated change: the graph.ts WasmGraph refactor (new @stackbilt/wasm-core dep, vite-plugin-wasm, vite-plugin-top-level-await, rewritten test fixtures across four test files). The WasmGraph WASM boundary introduces a test-correctness risk: the pruning test at recall-baseline.test.ts:708 now asserts expect(weak).toBeUndefined() against opaque WASM behavior — if WasmGraph.spreadActivation returns sub-threshold nodes, that assertion will fail with no clear signal. This isn't a blocker for the routing changes, but if the graph work ever needs to be rolled back independently, it can't be done cleanly. Consider whether this should have been a separate PR.
Closes #71
Changes
web/src/kernel/router.tsDEFAULT_ROUTES:greeting,general_knowledge,tarot_pulse,tarot_trajectory→workers_aiselectDefaultExecutor: greeting fixed route now returnsworkers_aiconfidence 0.50–0.79): low-complexity no-tool →workers_ai(reverts the// workers_ai → gpt_ossbump)DEFAULT_ROUTES[classification] ?? 'claude'→?? 'workers_ai'web/tests/router.test.tsgeneral_knowledge,tarot_pulse,tarot_trajectory,tarot_deep,greetingbaselineGuardrails preserved
memory_recallstays ongpt_oss(equity recall failure 2026-03-04)code_taskstays onclaude_codegpt_ossclaude/claude_opusunchangedTest result
118/118 passing (executor-router regression + semantic + router)