Integration prompt — ai-ahu-chatbot: delete the dead RAG /sessions passthrough (close the last DMZ→Internal thread-history call)
Paste into a Claude Code session inside the
ai-ahu-chatbotrepo. This is a small cleanup, not a feature. It removes a dead cross-zone call path — there is no gateway change and no new behavior for real users.
Why (read first — this is a deletion, verified dead)
The public-web thread-history routes still contain a legacy passthrough to ai-ahu-document-rag's /sessions endpoints. That path is dead on three independent counts, so it should be removed rather than kept (or proxied):
- The RAG endpoints are stubs. In
ai-ahu-document-rag,GET /sessionsandGET /sessions/{session_id}/runsbothreturn []— not implemented, no data. - Thread history already moved to the local ThreadStore (2026-07-08): both routes read an authenticated user's real history from
getThreadStore()(written by/api/orchestrate, ownership-enforced). The RAG calls are already labelled "legacy … stays for cookie-less callers." - The UI never triggers the RAG branch.
apps/public-web/src/components/chat/doc/TanyaSidebar.tsxgatesloadThreads("doc")to Akun users only (theisAnonguard) — the cookie-less branch that reaches RAG is unreachable from the app.
Post production-split, public-web runs in the DMZ and RAG in Internal; that legacy fetch is a latent DMZ→Internal call. Since it's dead and already superseded, deleting it closes the zone boundary properly — no /search-style gateway proxy needed for a path with no data and no caller. (We chose delete over proxy deliberately: proxying would add surface to keep a dead path alive across the boundary.)
Behavior change for real users: none. Cookie-less callers already got [] (RAG returns [], and the catch blocks return [] on any failure), and the UI never routes there. This only removes the cross-zone fetch attempt.
Scope — two route files
1. apps/public-web/src/app/api/threads/doc/route.ts (GET — thread list)
Keep the authenticated (Akun) branch exactly as-is: valid PUBLIC_SESSION_COOKIE → getThreadStore().listThreads(session.email) → map to Thread[] → return.
Remove the trailing cookie-less RAG passthrough (the try { fetch(${UPSTREAM}/sessions?...) … } catch { return NextResponse.json([]) } block). Replace the whole cookie-less tail with a direct honest empty response:
// No account session → no server-side history. (Real history is per-account,
// in the local ThreadStore; the RAG /sessions passthrough was a dead
// cross-zone path — stub upstream, UI never routed guests here — removed to
// close the DMZ→Internal boundary.)
return NextResponse.json([] as Thread[]);
2. apps/public-web/src/app/api/threads/doc/[id]/route.ts (GET — one thread's history)
Keep the Akun branch (getThreadStore().getMessages(id, session.email) → { id, history }).
Remove the cookie-less fetch(${UPSTREAM}/sessions/${id}/runs) passthrough and replace its tail with:
return NextResponse.json({ id, history: [] });
3. Clean up what those deletions orphan (let the typechecker guide you)
- The
UPSTREAMconst + theNEXT_PUBLIC_DOC_RAG_API_URL/NEXT_PUBLIC_AGNO_API_URLreads in these two files (delete the const; it's now unused here). - Now-unused imports in these two files:
mapSessionToThread,unwrapList,ServerSession,runToMessages,ServerRun(from@ahu/ui/lib/threads-upstream). - Then check whether
@ahu/ui/lib/threads-upstreamhas any remaining importer (grep -rn "threads-upstream" apps packages). If these two routes were its only consumers, delete the lib (and its test) too — dead code. If anything else imports it, leave it. - Do NOT blindly delete
NEXT_PUBLIC_DOC_RAG_API_URL/NEXT_PUBLIC_AGNO_API_URLfrom.env*/ compose files yet — first confirm nothing else references them (grep -rn "NEXT_PUBLIC_DOC_RAG_API_URL\|NEXT_PUBLIC_AGNO_API_URL" apps packages infra). Note thatNEXT_PUBLIC_AGNO_API_URLmay be used by the DataTool/agent path — if so, keep it. Remove only env entries that end up with zero references, and say which you removed.
Verification
pnpm checkgreen (typecheck will fail loudly on any orphaned import you missed — that's the safety net).grep -rn "/sessions" apps/public-web/srcreturns no runtimefetchto a RAG/sessions*path (comments/docstrings referencing the history are fine to leave or tidy).- Sanity: with an Akun cookie,
/api/threads/docand/api/threads/doc/[id]still return the local ThreadStore history unchanged; without a cookie, both return empty ([]/{id, history: []}) with no outbound RAG call.
Report back
The two routes trimmed; whether threads-upstream (+ test) was orphaned and deleted or kept (and why); which NEXT_PUBLIC_* env entries you removed vs. kept (with the reference that kept them); and confirmation pnpm check is green and no runtime /sessions fetch remains.