Spaces:
Paused
Paused
Commit History
-
refactor: replace ARQ+Redis stream with direct async SSE for Nexus chat
dushyantsingh0 +1: Claude Sonnet 4.6LangGraph/LLM work is pure async I/O, so running it directly in a FastAPI coroutine eliminates the ARQ enqueue hop, Redis Stream relay, and 50-300ms pickup lag. Browser disconnects now cancel the LangGraph coroutine via asyncio.CancelledError (no wasted LLM tokens). - nexus_stream.py: full rewrite — event_generator() runs astream_events() directly and yields SSE tokens; _persist_interaction fire-and-forget via safe_create_task after 'done' - tasks/nexus_ai.py: remove nexus_stream_task; keep _persist_interaction - core/tasks.py: drop nexus_stream_task re-export - nexus_worker.py: remove nexus_stream_task from imports and HeavyWorkerSettings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>2e01964
-
fix: delete thread drops paginated sessions, Groq 20s retry, empty response, invisible NX avatar
dushyantsingh0 +1: Claude Sonnet 4.6deleteThread: optimistic removal instead of fetchSessions() refetch — refetching only page 1 caused sessions loaded via scroll-pagination to disappear temporarily Groq LLM: max_retries=0 disables Groq's internal 20s exponential backoff so LazyFailoverChatModel immediately catches the rate-limit error and switches to the backup provider instead of stalling the response for 20+ seconds Responder prompt: replaced vague 'synthesize into briefing' + '2-4 sentences max' with explicit rule — response IS the delivery channel, never say 'I've provided', always present full ticket data inline with GFM tables. Length scales with data. NexusHub: fix invisible NX avatar in loading indicator (var(--primary-gradient) → var(--banner-gradient) which actually exists in the design tokens) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>53d8723 -
backend sprint
dushyantsingh0cf96a4f
-
Initial commit
dushyantsingh0aa510be -
Initial commit
dushyantsingh0d8744fd -
Initial commit
dushyantsingh017923f1 -
backend change
dushyantsingh0f6cdafe
-
backend stabilisation
dushyantsingh033e1eb1 -
fix: corrected gemini model and parameter passing; build: optimize frontend install
dushyantsingh02404ef0 -
backend stabilisation
dushyantsingh06bf2d17 -
backend stabilisation
dushyantsingh0e190dbe -
backend stabilisation
dushyantsingh02bb9807
-
backend stabilisation
dushyantsingh0129c849
-
backend stabilisation
dushyantsingh00030c4d -
backend stabilisation
dushyantsingh0dd5705d -
backend stabilisation
dushyantsingh033d43ee
-
Fix: security gaps, silent failures, and validation holes found in codebase audit
dushyantsingh0 +1: Claude Sonnet 4.6- agents/nexus_master.py: Replace bare except: with except Exception: in router fallback to stop masking KeyboardInterrupt/SystemExit - core/cache.py: Log instead of silently swallow errors in invalidate_cache and delete_by_pattern; add 10s asyncio.wait_for timeout around both embedding calls in SemanticCacheManager (check_cache + set_cache) to prevent indefinite hangs - api/v1/nexus_stream.py: Add workspace-level rate limit (50 req/min customers, 200 req/min staff) on top of per-user limit to prevent coordinated flooding; add UserWorkspace.is_active==True filter in cross-workspace membership check so deactivated users cannot bypass the guard - api/v1/tickets.py: Clamp limit query param with Query(le=500) on list endpoint and Query(le=200) on paginated endpoint to prevent bulk data extraction; replace untyped payload: dict in reopen_ticket with typed TicketReopenRequest - schemas/ticket.py: Add TicketReopenRequest Pydantic model with max_length=2000 on reason field C…55ffd6d
-
Fix: job ID sync and worker health visibility
dushyantsingh08c5af7e
-
backend stabilization
dushyantsingh04fa956a -
Fix WebSocket stale-token reconnect loop
dushyantsingh0 +1: Claude Sonnet 4.6Root cause: clients reconnected with the same near-expired access token after a disconnect, causing endless Signature has expired 403 rejections in a loop. Backend: - Add create_ws_ticket() in core/security.py - 60-second JWT with type ws_ticket - Add POST /api/v1/auth/ws-ticket/ endpoint - returns a fresh ticket for WS auth - Update _authenticate_ws() to accept both access and ws_ticket token types - Send close code 4001 on expired token so client can distinguish from 4003 Frontend (customer + internal TopBar): - connect() now calls POST /auth/ws-ticket/ before opening each WebSocket - axios interceptor silently refreshes access token first if needed - onclose: stop retrying on 4001/4003/1008, retry on network drops - Remove redundant upfront token expiry check Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0243ced
-
backend stabilization
dushyantsingh07b3791b -
backend stabilization
dushyantsingh0c361b46 -
backend stabilization
dushyantsingh0cbe40ee -
backend stabilization
dushyantsingh0ff97dfb
-
fix: resolve all identified backend and frontend bugs
dushyantsingh0 +1: Claude Sonnet 4.6Backend fixes: - agents/nexus_master.py: Wrap each tool task with asyncio.wait_for(15s) so slow KB/embedding calls cannot stall the entire LangGraph graph (B2). Add outer + per-block try/except in sanitize_mermaid so a bad diagram never crashes the responder (B8). Reduce identity cache TTL from 3600s to 300s so role changes propagate to the agent within 5 minutes (B12). - core/config.py: Strengthen SECRET_KEY guard — now raises RuntimeError whenever DEBUG=False regardless of NEXUS_ENV, catching any non-dev deployment that ships with the insecure default key (B5). - core/token_blocklist.py: On Redis failure in blocklist_token, write to in-memory cache (TTL capped at 300s) so revocations are honoured within the process even when Redis is unavailable (B6). Also populate L1 cache on successful Redis write to avoid an immediate Redis round-trip. - core/websockets.py: _dispatch_local now captures dead connections returned by _send_all and removes them from the appropriate…9eaba40 -
fix: update ai models and kb search alignment
dushyantsingh01bccf7d -
backend stabilization
dushyantsingh0902d554 -
backend stabilization
dushyantsingh0a7ed06e -
perf: reduce Redis EXISTS/UNWATCH storm from token blocklist and SLA monitor
dushyantsingh0 +1: Claude Sonnet 4.6- token_blocklist: cache non-blocked JTIs for 300s (up from 60s) to cut per-process EXISTS calls by ~80%; blocked tokens still evict at 60s - monitor_sla_thresholds: replace N individual redis.get(latch) calls inside the 500-ticket loop with a single MGET before the loop (1 round trip vs 500) - monitor_sla_thresholds: add missing latch for Tier 1 BREACHED notifications; the missing latch caused re-enqueue on every 2-min cron run, producing the WATCH→EXISTS→UNWATCH burst (428 UNWATCH/snapshot) visible in monitoring Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>d559c49 -
fix: resolve agent context loss, silent responses, and concurrency failures
dushyantsingh0 +1: Claude Sonnet 4.6Agent behaviour fixes: - Router: remove yes/ok/yep from CONVERSE_SHORT_CIRCUIT so confirmations reach the LLM with full context instead of being short-circuited - Router: increase history slice 5 → 8 messages to retain multi-turn HITL context - Router keyword fallback: use word-boundary regex for 'create' to avoid 'who created the ticket' incorrectly triggering CREATE_TICKET - Responder: exclude internal sentinel strings (NO_ACTION, PROCEED, etc.) from the empty-LLM fallback so they never appear in the chat UI Frontend streaming fixes: - NexusContext: add replace_all SSE handler — backend uses this event for sanitize_mermaid output and empty-LLM fallbacks; without it those responses were silently dropped - NexusContext: give each query() invocation a stable _msgId; token/replace_all updates now find their slot by ID instead of position, eliminating the concurrent-stream race where two simultaneous queries overwrite each other - NexusContext: push empty assistant placehol…8c62622 -
fix: resolve 18 bugs across auth, workers, agents, frontend, and infra
dushyantsingh0 +1: Claude Sonnet 4.6CRITICAL - nexus_master: fix AttributeError — User.name→full_name, NexusInteraction.query→input_query, .response→ai_answer (BUG-1) - nexus_master: lazy-init asyncio.Lock to avoid 'no event loop' crash on import (BUG-2) - token_blocklist: fix no-op shutdown — actually close core.cache._redis_client (BUG-3) - database: sslmode now conditional on cloud URL; local Postgres no longer fails SSL handshake (BUG-4) - auth: verify password before allowing existing user to join a new workspace (auth bypass) (BUG-5) HIGH - nexus_worker: add refresh_active_workspace_insights to HeavyWorkerSettings.functions so cron job executes (BUG-8) - deps: remove 3sc_admin customer-portal bypass — all staff are blocked equally (BUG-9) - NexusContext: use messagesRef.current for chat_history to fix stale-closure on multi-turn context (BUG-10) - system/nexus_stream: propagate owner_id into metadata_json so job-status endpoint no longer returns 403 (BUG-12) - nexus: title param annotated as Body(...) — fixes 422 …dbc31e7
-
backend stabilization
dushyantsingh0f887fd1 -
backend stabilization
dushyantsingh05f19b92 -
backend stabilization
dushyantsingh05af7d2f -
backend stabilization
dushyantsingh0b5594ba -
backend stabilization
dushyantsingh09fe8d84 -
fix: guard against invalid ARQ_REDIS_URL scheme and fix CSP blocking Swagger UI
dushyantsingh0 +1: Claude Sonnet 4.6- core/config.py: get_redis_settings() now validates that ARQ_REDIS_URL uses redis:// or rediss:// before calling RedisSettings.from_dsn(). Falls back to LOCAL_REDIS_URL (localhost:6379) if the scheme is anything else (e.g. Upstash REST URLs use https://, which arq rejects with "invalid DSN scheme"). This was crashing both ARQ workers and the API lifespan at startup. - main.py: SecurityHeadersMiddleware now applies a relaxed CSP (adds 'unsafe-inline' to script-src) only for /docs, /redoc, and /openapi paths. Swagger UI injects inline scripts that the previous blanket CSP was blocking, rendering the docs page completely blank. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>a1f89d3 -
fix: stop Anthropic LLM crashes and enqueue_task Depends passthrough
dushyantsingh0 +1: Claude Sonnet 4.6`_init_anthropic` was leaking `timeout` and `format` into `**f_kwargs`: - `timeout` was set explicitly AND still present in `**f_kwargs` → `ChatAnthropic() got multiple values for keyword argument 'timeout'` - `format="json"` (Ollama-only kwarg from nexus_master router node) was forwarded to `AsyncMessages.create()` → `got an unexpected keyword argument 'format'` Both caused primary LLM to fail on every router call, wasting 30 s of timeout before falling back to DeepSeek. `enqueue_task` used the caller-supplied first argument directly as the ARQ pool when it was not a string. A FastAPI `Depends(get_arq_pool)` object slipped through in some code paths → `'Depends' object has no attribute 'enqueue_job'`. Function now always uses its own singleton pool regardless of what is passed as the first argument. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>878b20d -
fix: use local Redis for WebSocket pub/sub, not Upstash
dushyantsingh0 +1: Claude Sonnet 4.6The previous approach (polling get_message every 100ms across 4 workers) would have consumed ~3.5M Upstash commands/day — far beyond any free tier. Root cause was using CACHE_REDIS_URL (Upstash) for pub/sub. Upstash is a serverless/HTTP Redis designed for short request-response operations. It imposes a 30-second idle-connection timeout and bills per command, making it fundamentally unsuitable for a persistent pub/sub listener. Fix: route WebSocket pub/sub through LOCAL_REDIS_URL (localhost:6379). The local Redis is already started by run_prod.sh and all 4 Gunicorn workers share the same host, so local pub/sub fan-out works correctly. Zero Upstash commands consumed. No idle timeouts. No polling hacks needed. Changes: - main.py: pass settings.LOCAL_REDIS_URL to ws_manager.start_pubsub() instead of settings.clean_cache_redis_url - core/websockets.py: revert subscriber to clean listen() loop (no polling, no keepalive PING), simplify _get_pub_redis() to use local URL directly Note…5df217f -
fix: prevent Upstash pub/sub idle-disconnect with 20s keepalive PING
dushyantsingh0 +1: Claude Sonnet 4.6Upstash Redis closes idle TCP connections after 30 seconds. The previous listen() loop had no way to send keepalive traffic, so each worker's WebSocket subscriber would timeout and reconnect every ~30 s, causing: - Noisy WARNING logs every 30 s per worker process - 2-second gap per reconnect where cross-process WS delivery fell back to local-only mode Fix: replace listen() with a get_message(timeout=0.1) polling loop that sends pubsub.ping() every 20 s on the pub/sub connection itself. PING resets Upstash's server-side idle timer, so the connection stays open indefinitely. Also removes socket_timeout from the subscriber connection config since the 100 ms poll interval now controls responsiveness. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>b34dce7 -
feat: scale backend to 10K concurrent users via Redis pub/sub + ARQ streaming
dushyantsingh0 +1: Claude Sonnet 4.6Four root bottlenecks addressed: 1. WebSocket cross-process delivery (core/websockets.py, main.py) - ConnectionManager now publishes broadcasts to Redis pub/sub channels (nexus:ws:workspace/user/role/ticket:{id}) instead of delivering directly to in-process sockets. - Each API worker runs a background subscriber task that receives published messages and delivers them to its own WebSocket objects. - Fallback to local-only delivery when Redis is unreachable. - Without this, multi-worker deployments silently dropped most WebSocket messages because each process held its own isolated connection map. 2. SSE streaming decoupled from HTTP workers (tasks/nexus_ai.py NEW, api/v1/nexus_stream.py) - POST /nexus/stream/ now: auth → rate-limit → enqueue nexus_stream_task to ARQ heavy queue → return SSE that reads Redis Stream via XREAD. - nexus_stream_task (new ARQ heavy task) runs LangGraph and publishes each SSE event to nexus:stream:{job_id} vi…356a201 -
backend stabilization
dushyantsingh020489ff -
backend stabilization
dushyantsingh0d8fc13a -
backend stabilization
dushyantsingh074ca20c -
backend stabilization
dushyantsingh0460fc16 -
fix: restore database_host and image dim for boot stability
dushyantsingh0e91119b -
fix: restore missing AI_IMAGE_EMBEDDING_DIM to settings
dushyantsingh058e4719 -
backend stabilization
dushyantsingh092ce952 -
backend stabilization
dushyantsingh00e4346b -
backend stabilization
dushyantsingh0f280d44