mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 21:07:26 +01:00
fix(loki): proactive review skips the deterministic fleet fast-paths
THE root cause of the empty-state review returning a bare project list: the messages route's deterministic fast paths (isListProjectsQuery, create-project, develop-all, move-forward) run BEFORE the LLM, and "review my whole fleet / all my projects" tripped the list-projects shortcut → it answered with formatProjectList (meta source:"fleet-list"), never reaching askLoki. (The model was innocent — it answers this perfectly via /api/loki.) chatOnly now bypasses every fast path, so proactive analysis reaches Loki. The warm-session + echo-fallback layers stay as defense-in-depth. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a3a00da0fc
commit
fdd6793673
1 file changed
+9
-5
@@ -223,8 +223,12 @@ export async function POST(
|
||||
const projects = await getUserProjects(userId);
|
||||
const projectNames = projects.map((p) => p.name);
|
||||
|
||||
// Fleet fast paths — deterministic, no LLM.
|
||||
if (isListProjectsQuery(text)) {
|
||||
// Fleet fast paths — deterministic, no LLM. Skipped entirely for chatOnly:
|
||||
// the proactive fleet-review starters ("review my fleet", "all my projects")
|
||||
// are analysis requests that would otherwise be intercepted here (e.g. the
|
||||
// list-projects fast path) and answered with a bare project list. chatOnly
|
||||
// means "let Loki think", so bypass every deterministic shortcut.
|
||||
if (!chatOnly && isListProjectsQuery(text)) {
|
||||
const assistant = await addMessage(conversationId, {
|
||||
role: "assistant",
|
||||
kind: "chat",
|
||||
@@ -234,7 +238,7 @@ export async function POST(
|
||||
return NextResponse.json({ message: assistant });
|
||||
}
|
||||
|
||||
const createReq = parseCreateProjectRequest(text);
|
||||
const createReq = chatOnly ? null : parseCreateProjectRequest(text);
|
||||
if (createReq) {
|
||||
let name = createReq.name;
|
||||
if (!name) {
|
||||
@@ -308,7 +312,7 @@ export async function POST(
|
||||
return NextResponse.json({ message: assistant });
|
||||
}
|
||||
|
||||
if (isDevelopAllFleetRequest(text)) {
|
||||
if (!chatOnly && isDevelopAllFleetRequest(text)) {
|
||||
const scopeKeys =
|
||||
selectedProjects.length > 0 ? selectedProjects : undefined;
|
||||
const outcome = await kickFleet(userId, {
|
||||
@@ -329,7 +333,7 @@ export async function POST(
|
||||
return NextResponse.json({ message: assistant });
|
||||
}
|
||||
|
||||
if (isMoveForwardRequest(text)) {
|
||||
if (!chatOnly && isMoveForwardRequest(text)) {
|
||||
if (selectedProjects.length === 1) {
|
||||
const assistant = await persistDispatch({
|
||||
userId,
|
||||
|
||||
Reference in new issue
Block a user