Skip to content

Feat/v512 monitoring mcp - #233

Merged
POWERFULMOVES merged 22 commits into
mainfrom
feat/v512-monitoring-mcp
Nov 6, 2025
Merged

POWERFULMOVES merged 22 commits into
mainfrom
feat/v512-monitoring-mcp

Conversation

@POWERFULMOVES

@POWERFULMOVES POWERFULMOVES commented Nov 6, 2025

Copy link
Copy Markdown
Owner

Title: v5.12 Stabilization: Monitoring + Channel Monitor metrics, Archon MCP wiring, UI defaults

Summary

  • Added channel-monitor GET health + Prometheus metrics and instrumented counters.
  • Monitoring stack now probes channel-monitor /healthz and scrapes metrics; Grafana provision/mount paths fixed; dashboard shows channel-monitor panels.
  • Gated cAdvisor behind a linux profile with Make toggle.
  • Archon headless ports published (8091 API, 8051 MCP, 8052 agents); Archon UI defaults to archon-server:8091 API inside Docker.
  • Agent Zero MCP seeding script + Make targets; Archon MCP smoke target.
  • Added Archon API /mcp/describe shim to report MCP bridge status in JSON.

Key Files

  • Channel Monitor: pmoves/services/channel-monitor/channel_monitor/main.py, requirements.txt, README.md
  • Monitoring: pmoves/monitoring/prometheus/prometheus.yml, pmoves/monitoring/docker-compose.monitoring.yml, pmoves/monitoring/grafana/*
  • Agents: pmoves/docker-compose.yml, pmoves/docker-compose.agents.images.yml, pmoves/docker-compose.agents.integrations.yml, pmoves/AGENTS.md
  • MCP: pmoves/tools/seed_agent_zero_mcp.py, pmoves/Makefile (a0-mcp-seed, archon-mcp-smoke, archon-ui-smoke)
  • Docs: pmoves/docs/SMOKETESTS.md, pmoves/docs/services/monitoring/README.md, pmoves/docs/context/pmoves_v_5.12_tasks.md

How to Verify

  1. Channel Monitor
    • docker compose -p pmoves up -d --build channel-monitor
    • curl http://localhost:8097/healthz → 200
    • curl http://localhost:8097/metrics → Prometheus text
  2. Monitoring
    • MON_INCLUDE_CADVISOR=true make -C pmoves up-monitoring
    • Prometheus targets UP; Grafana at http://localhost:3002 → Services Overview shows channel-monitor panels
  3. Archon
    • make -C pmoves up-agents-ui
    • curl http://localhost:8091/healthz → 200
    • make -C pmoves archon-ui-smoke → API/UI 200s
    • make -C pmoves archon-mcp-smoke → prints HTTP code for :8051 (404 acceptable)
    • curl http://localhost:8091/mcp/describe → JSON with endpoint + probe statuses
  4. MCP Seeding (Agent Zero)
    • Add A0_MCP_SERVERS in pmoves/env.shared (examples in env.shared.example)
    • make -C pmoves a0-mcp-seed → writes runtime mapping to pmoves/data/agent-zero/runtime/mcp/servers.env

Reviewer Notes

  • Node exporter remains optional on Desktop/WSL; cAdvisor covers container metrics and is now gated.
  • Archon MCP bridge routes vary by upstream; /mcp/describe ensures we can assert liveness without knowing the exact route shape.
  • No RLS/profile changes were required; Archon retains single‑env Supabase REST alignment.

@codex review

Summary by CodeRabbit

Release Notes

  • New Features

    • Single-User (Owner) Mode for personal-first operation with auto-authentication
    • Monitoring Stack with dashboards (Prometheus, Grafana, Loki)
    • Tailscale network integration for secure connectivity
    • Chat, Monitor, and Notebook dashboards in console
    • Agent Zero and Archon UI integrations
    • Real-time video updates in dashboard
    • GPU gateway support
    • Jellyfin media mounting configuration
  • Improvements

    • Enhanced API authentication and health checks
    • Unified environment configuration management
    • Extended documentation and operational guides
    • Agent integrations with MCP seeding support
    • Expanded observability and monitoring capabilities

Codex Agent and others added 22 commits November 6, 2025 08:21
…and add grants\n\n- supabase/config.toml: include pmoves_core, pmoves_kb in [api.schemas]\n- new migration: pmoves/db/v5_13_pmoves_core_rest_grants.sql (USAGE/SELECT for anon/authenticated/service_role)\n- docs: update SMOKETESTS/LOCAL_DEV/Jellyfin+PMOVES.YT guides to default to /rest/v1 and note PostgREST as optional fallback\n- docs index/services readme: link to unified REST notes\n\nRefs: Stabilization sprint, unify REST surface before broader smokes
…ent Zero dirs\n\n- tools/brand_defaults.py: generate strong defaults (NEO4J_AUTH, MEILI, Invidious, MinIO buckets, Supabase REST vars) and stamp .env.generated\n- scripts/with-env.sh: unified, safe env sourcing for all bash scripts\n- tailscale brand helpers: init/up scripts with branded defaults\n- docs: ENVIRONMENT_POLICY, SCRIPTS_ENV, SECURITY_SINGLE_USER\n- add Agent Zero runtime directories (.gitkeep) to ensure persistence mounts exist\n\nRefs: Stabilization sprint – eliminate env drift and whack‑a‑mole
…Advisor\n\n- Add compose bundle and configs under pmoves/monitoring\n- Starter Grafana dashboard and datasource provisioning\n- Blackbox HTTP probes targeting core services\n- Operator helper script monitoring_report.py\n- Docs: services/monitoring/README with quickstart and make targets\n\nRefs: ROADMAP ‘observability baseline’, Stabilization sprint
…or YTDLP_VERSION; prepare for GHCR tags\n- requirements: decouple yt-dlp pin; upgrade paths\n- yt.py: SABR/nsig fallback to Invidious/Companion, offline transcript prefetch, REST precedence (SUPABASE_REST_URL)\n- README/docs: workflow summary and Jellyfin integration updated\n\nRefs: Stabilization sprint – downloader resilience, reproducible builds
…ts\n\n- Fix videos dashboard realtime init order; eliminate ‘refresh before init’\n- Presign client retry + /api/health/presign diagnostic endpoint\n- Monitor and Notebook panels; chat stub APIs\n- Supabase server/client: explicit keys for middleware edge env\n- Playwright E2E for videos realtime; with-env.mjs env layering\n\nRefs: UI stabilization, smoke coverage
…optional hosts-compose for Jellyfin AI overlay and host mapping file\n- Helper script to generate Jellyfin mounts\n- Enhanced Jellyfin smoketest script\n\nRefs: Jellyfin Bridge integration runbook
…ocs\n\n- Makefile: first-run, smokes, monitoring targets; GPU/CPU port parametrization\n- docker-compose: env_file alignment, Agent Zero volume, Neo4j auth via .env.generated only\n- agents images/integrations compose updates\n- CI: integrations GHCR workflow tweaks\n- Docs: CI images + local tooling reference updates\n\nRefs: Stabilization sprint – reduce service/env drift
…i tweaks\n\n- docs/ARC/network_fabric.md: internal service mesh and ports map\n- scripts: ui_videos_realtime_smoke.sh + cleanup using unified env loader\n- tools/mini_cli.py: helpers for local ops\n\nRefs: Stabilization – operator ergonomics
…defaults\n\n- hi‑rag v2 README: document stable GHCR GPU image override and cu128 torch pin\n- env.shared.example: add LANGEXTRACT_PROVIDER, agent UIs, SINGLE_USER_MODE, PMOVES.YT image, monitoring ports, Qwen2‑Audio/Gemma toggles\n- add docker-compose.gpu-image.yml override file
…and docs\n\n- Makefile: add tailscale-save-key/join/rejoin/status/logout; hook optional auto-join into first-run\n- env.shared.example: add Tailscale variables (AUTO_JOIN, TAGS, HOSTNAME, routes, sign)\n- ENVIRONMENT_POLICY: document tailnet join, key storage, and rotation paths
…oin commands invoking brand init\n- ARC docs: Tailscale overlay/admin guards quickstart
… API auth env_file wiring\n\n- yt-emit-smoke: resolve point id via REST with retry; fallback to legacy id; final fallback validates via /hirag/query\n- n8n: read tokens from env.shared via env_file and enable API auth flags
@coderabbitai

coderabbitai Bot commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@POWERFULMOVES has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a944c2e and 99d3a1a.

⛔ Files ignored due to path filters (1)
  • pmoves/ui/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (89)
  • .github/workflows/integrations-ghcr.yml (1 hunks)
  • README.md (2 hunks)
  • pmoves/AGENTS.md (1 hunks)
  • pmoves/Makefile (14 hunks)
  • pmoves/PR_BODY_STABILIZATION.md (1 hunks)
  • pmoves/PR_BODY_v512_monitoring_mcp.md (1 hunks)
  • pmoves/compose/docker-compose.core.yml (1 hunks)
  • pmoves/data/agent-zero/instruments/.gitkeep (1 hunks)
  • pmoves/data/agent-zero/knowledge/.gitkeep (1 hunks)
  • pmoves/data/agent-zero/logs/.gitkeep (1 hunks)
  • pmoves/data/agent-zero/memory/.gitkeep (1 hunks)
  • pmoves/data/agent-zero/runtime/.gitkeep (1 hunks)
  • pmoves/db/v5_13_pmoves_core_rest_grants.sql (1 hunks)
  • pmoves/docker-compose.agents.images.yml (1 hunks)
  • pmoves/docker-compose.agents.integrations.yml (1 hunks)
  • pmoves/docker-compose.gpu-image.yml (1 hunks)
  • pmoves/docker-compose.jellyfin.hosts.yml (1 hunks)
  • pmoves/docker-compose.n8n.yml (3 hunks)
  • pmoves/docker-compose.yml (14 hunks)
  • pmoves/docs/ARC/network_fabric.md (1 hunks)
  • pmoves/docs/CI_IMAGES.md (1 hunks)
  • pmoves/docs/ENVIRONMENT_POLICY.md (1 hunks)
  • pmoves/docs/LOCAL_DEV.md (4 hunks)
  • pmoves/docs/LOCAL_TOOLING_REFERENCE.md (2 hunks)
  • pmoves/docs/PMOVES.AI PLANS/JELLYFIN_YOUTUBE_INTEGRATION.md (2 hunks)
  • pmoves/docs/PMOVES.AI PLANS/PMOVES.yt/PMOVES_YT.md (1 hunks)
  • pmoves/docs/PMOVES.AI PLANS/PMOVES.yt/WORKFLOW_SUMMARY.md (1 hunks)
  • pmoves/docs/PMOVES.AI PLANS/PMOVES.yt/pmoves_unified_control.txt (1 hunks)
  • pmoves/docs/PMOVES.AI PLANS/README_DOCS_INDEX.md (2 hunks)
  • pmoves/docs/SCRIPTS_ENV.md (1 hunks)
  • pmoves/docs/SECURITY_SINGLE_USER.md (1 hunks)
  • pmoves/docs/SMOKETESTS.md (5 hunks)
  • pmoves/docs/context/pmoves_v_5.12_tasks.md (1 hunks)
  • pmoves/docs/services/README.md (1 hunks)
  • pmoves/docs/services/hi-rag-gateway-v2/README.md (1 hunks)
  • pmoves/docs/services/monitoring/README.md (1 hunks)
  • pmoves/env.shared.example (7 hunks)
  • pmoves/jellyfin.hosts (1 hunks)
  • pmoves/monitoring/blackbox/blackbox.yml (1 hunks)
  • pmoves/monitoring/docker-compose.monitoring.yml (1 hunks)
  • pmoves/monitoring/grafana/dashboards/services-overview.json (1 hunks)
  • pmoves/monitoring/grafana/datasources/datasource.yml (1 hunks)
  • pmoves/monitoring/grafana/provisioning/dashboards.yml (1 hunks)
  • pmoves/monitoring/prometheus/prometheus.yml (1 hunks)
  • pmoves/monitoring/promtail/config.yml (1 hunks)
  • pmoves/scripts/tailscale_brand_init.sh (1 hunks)
  • pmoves/scripts/tailscale_brand_up.sh (1 hunks)
  • pmoves/scripts/with-env.sh (1 hunks)
  • pmoves/services/archon/main.py (2 hunks)
  • pmoves/services/channel-monitor/README.md (1 hunks)
  • pmoves/services/channel-monitor/channel_monitor/main.py (4 hunks)
  • pmoves/services/channel-monitor/requirements.txt (1 hunks)
  • pmoves/services/pmoves-yt/Dockerfile (1 hunks)
  • pmoves/services/pmoves-yt/README.md (1 hunks)
  • pmoves/services/pmoves-yt/requirements.txt (1 hunks)
  • pmoves/services/pmoves-yt/yt.py (4 hunks)
  • pmoves/supabase/migrations/20251105_chat_messages.sql (1 hunks)
  • pmoves/tools/brand_defaults.py (1 hunks)
  • pmoves/tools/generate_jellyfin_mounts.py (1 hunks)
  • pmoves/tools/mini_cli.py (7 hunks)
  • pmoves/tools/monitoring_report.py (1 hunks)
  • pmoves/tools/seed_agent_zero_mcp.py (1 hunks)
  • pmoves/ui/README.md (1 hunks)
  • pmoves/ui/__tests__/home-page.test.tsx (1 hunks)
  • pmoves/ui/app/api/chat/messages/route.ts (1 hunks)
  • pmoves/ui/app/api/chat/send/route.ts (1 hunks)
  • pmoves/ui/app/api/health/boot-jwt/route.ts (1 hunks)
  • pmoves/ui/app/api/health/ingest-smoke/route.ts (1 hunks)
  • pmoves/ui/app/api/health/presign/route.ts (1 hunks)
  • pmoves/ui/app/api/monitor/stats/route.ts (1 hunks)
  • pmoves/ui/app/api/notebook/sources/route.ts (1 hunks)
  • pmoves/ui/app/dashboard/agent-zero/page.tsx (2 hunks)
  • pmoves/ui/app/dashboard/archon/page.tsx (2 hunks)
  • pmoves/ui/app/dashboard/chat/page.tsx (1 hunks)
  • pmoves/ui/app/dashboard/ingest/page.tsx (3 hunks)
  • pmoves/ui/app/dashboard/monitor/page.tsx (1 hunks)
  • pmoves/ui/app/dashboard/notebook/page.tsx (1 hunks)
  • pmoves/ui/app/dashboard/videos/page.tsx (6 hunks)
  • pmoves/ui/components/DashboardNavigation.tsx (2 hunks)
  • pmoves/ui/lib/presign.ts (1 hunks)
  • pmoves/ui/lib/supabaseClient.ts (3 hunks)
  • pmoves/ui/lib/supabaseServer.ts (1 hunks)
  • pmoves/ui/package.json (1 hunks)
  • pmoves/ui/scripts/with-env.mjs (1 hunks)
  • pmoves/ui/tests/videos-realtime.spec.ts (1 hunks)
  • scripts/jellyfin_enhanced_smoke.sh (1 hunks)
  • scripts/ui_videos_realtime_cleanup.sh (1 hunks)
  • scripts/ui_videos_realtime_smoke.sh (1 hunks)
  • supabase/config.toml (1 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR introduces comprehensive infrastructure upgrades including Single-User Mode with boot JWT authentication, a complete Monitoring stack (Prometheus/Grafana/Loki), Tailscale networking integration, Agent UI components, expanded integration publishing, MCP bridging, and numerous operational Make targets. Multiple new backend/frontend features, SQL migrations, and configuration systems are introduced.

Changes

Cohort / File(s) Summary
CI/Integrations Publishing
.github/workflows/integrations-ghcr.yml
Extends matrix with archon-ui, open-notebook, wger, firefly-iii, jellyfin, pmoves-yt integration entries
Documentation - Core
README.md, pmoves/AGENTS.md, pmoves/PR_BODY_STABILIZATION.md, pmoves/PR_BODY_v512_monitoring_mcp.md
Added Single-User Mode documentation, MCP wiring sections, Tailscale integration details, monitoring & channel-monitor metrics guidance
Documentation - Local Development
pmoves/docs/LOCAL_DEV.md, pmoves/docs/LOCAL_TOOLING_REFERENCE.md, pmoves/docs/SMOKETESTS.md, pmoves/docs/SCRIPTS_ENV.md
New Monitoring & Observability section, Open Notebook integration details, Personas REST access, Tailscale authkey workflow, unified env loader pattern
Documentation - Environment & Planning
pmoves/docs/ENVIRONMENT_POLICY.md, pmoves/docs/context/pmoves_v_5.12_tasks.md, pmoves/docs/SECURITY_SINGLE_USER.md
Introduced single-file env mode policy, Single-User/Owner Mode security model, v5.12 stabilization implementation notes
Documentation - Network & Services
pmoves/docs/ARC/network_fabric.md, pmoves/docs/services/README.md, pmoves/docs/services/monitoring/README.md, pmoves/docs/services/hi-rag-gateway-v2/README.md, pmoves/docs/CI_IMAGES.md, pmoves/docs/PMOVES.AI PLANS/*
Network fabric blueprint, monitoring stack README, GPU image guidance, yt-dlp workflow docs updates
Makefile & Build Orchestration
pmoves/Makefile
Added 50+ new targets: monitoring stack controls, Tailscale helpers, UI single-user toggles, agents UI, Neo4j tooling, jellyfin enhancements, seed/index operations, yt-integrations workflow
Docker Compose - Core & Services
pmoves/docker-compose.yml, pmoves/docker-compose.core.yml, pmoves/docker-compose.n8n.yml
Migrated to env_file-based provisioning, expanded agent-zero/archon port exposure, added pmoves-yt build config, n8n auth flag updates, removed inline secrets
Docker Compose - Agents & Integrations
pmoves/docker-compose.agents.images.yml, pmoves/docker-compose.agents.integrations.yml
Added archon-ui service with build/environment/port config, network aliases
Docker Compose - Specialized
pmoves/docker-compose.gpu-image.yml, pmoves/docker-compose.jellyfin.hosts.yml
New GPU gateway service (NVIDIA runtime, qdrant/neo4j deps), Jellyfin host media mount overrides
Monitoring Stack
pmoves/monitoring/docker-compose.monitoring.yml, pmoves/monitoring/prometheus/prometheus.yml, pmoves/monitoring/grafana/provisioning/dashboards.yml, pmoves/monitoring/grafana/datasources/datasource.yml, pmoves/monitoring/grafana/dashboards/services-overview.json, pmoves/monitoring/promtail/config.yml, pmoves/monitoring/blackbox/blackbox.yml
Full observability stack: Prometheus, Grafana, Loki, Promtail, Blackbox Exporter, cAdvisor with provisioning and services dashboard
Database & Migrations
pmoves/db/v5_13_pmoves_core_rest_grants.sql, pmoves/supabase/migrations/20251105_chat_messages.sql, supabase/config.toml
Added REST grants for pmoves_core/pmoves_kb schemas, chat_messages table with RLS policies, expanded Supabase schema exposure
Environment Configuration
pmoves/env.shared.example, pmoves/jellyfin.hosts
Added 30+ new env vars (Tailscale, monitoring, agent UIs, SINGLE_USER_MODE, YT params, Qwen audio), jellyfin host mount configuration
Backend Tools - Python
pmoves/tools/brand_defaults.py, pmoves/tools/generate_jellyfin_mounts.py, pmoves/tools/monitoring_report.py, pmoves/tools/seed_agent_zero_mcp.py, pmoves/tools/mini_cli.py
Added environment defaults seeding, Jellyfin mount generator, monitoring stats query tool, MCP seeding, Tailscale CLI helpers
Backend - Archon Service
pmoves/services/archon/main.py
Added /mcp/describe endpoint for MCP bridge HTTP probing
Backend - Channel Monitor
pmoves/services/channel-monitor/channel_monitor/main.py, pmoves/services/channel-monitor/requirements.txt, pmoves/services/channel-monitor/README.md
Introduced Prometheus metrics (checks/status updates counters), /metrics endpoint, lightweight /api/monitor/status health probe, prometheus-client dependency
Backend - PMOVES.YT
pmoves/services/pmoves-yt/Dockerfile, pmoves/services/pmoves-yt/requirements.txt, pmoves/services/pmoves-yt/yt.py, pmoves/services/pmoves-yt/README.md
Added YTDLP_VERSION build arg for reproducible builds, prefetch logic for transcription/emission, broader Invidious fallback detection, Supabase REST URL priority chain, fork/GHCR publishing guidance
Data Directories
pmoves/data/agent-zero/{instruments,knowledge,logs,memory,runtime}/.gitkeep
Added placeholder files to preserve Agent Zero runtime directories
Frontend - API Routes
pmoves/ui/app/api/chat/{messages,send}/route.ts, pmoves/ui/app/api/health/{boot-jwt,presign,ingest-smoke}/route.ts, pmoves/ui/app/api/monitor/stats/route.ts, pmoves/ui/app/api/notebook/sources/route.ts
New endpoints: chat messages CRUD with boot JWT auth, boot JWT health, presign service probing, ingest smoke test seeding, monitor stats proxy, notebook sources aggregator
Frontend - Dashboard Pages
pmoves/ui/app/dashboard/{chat,agent-zero,archon,monitor,notebook}/page.tsx, pmoves/ui/app/dashboard/{ingest,videos}/page.tsx
Added Chat dashboard with real-time messaging, Agent Zero/Archon UI links, Monitor stats viewer, Notebook sources browser; updated Ingest/Videos with boot JWT auth and realtime subscriptions
Frontend - Components & Utilities
pmoves/ui/components/DashboardNavigation.tsx, pmoves/ui/lib/supabaseClient.ts, pmoves/ui/lib/supabaseServer.ts, pmoves/ui/lib/presign.ts
Extended navigation with monitor/notebook/chat, implemented boot JWT expiration checks and grace windows, added retry logic for presign auth, conditional auth based on token validity
Frontend - Config & Tests
pmoves/ui/package.json, pmoves/ui/scripts/with-env.mjs, pmoves/ui/__tests__/home-page.test.tsx, pmoves/ui/tests/videos-realtime.spec.ts
Added jose dependency for JWT handling, SINGLE_ENV_MODE toggle for env loading, skipped async home test, added Playwright realtime video smoke test
Frontend - Documentation
pmoves/ui/README.md
Documented Agent Zero/Archon UI URLs, health check path environment variables
Shell Scripts
pmoves/scripts/{tailscale_brand_init.sh,tailscale_brand_up.sh,with-env.sh}, scripts/{jellyfin_enhanced_smoke.sh,ui_videos_realtime_smoke.sh,ui_videos_realtime_cleanup.sh}
New Tailscale provisioning scripts with auth key signing/seeding, unified env loader for scripts, Jellyfin health checks, UI realtime smoke/cleanup workflows

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as PMOVES UI<br/>(Port 3001)
    participant Boot as Boot JWT<br/>Handler
    participant Supabase
    participant Chat as Chat API<br/>(/api/chat/*)

    User->>UI: Load Chat Dashboard
    UI->>Boot: Check boot JWT
    Boot-->>UI: JWT valid + ownerId
    
    Note over UI: Owner mode active
    
    UI->>Chat: GET /api/chat/messages
    Chat->>Supabase: SELECT messages<br/>WHERE owner_id = ?
    Supabase-->>Chat: Chat history
    Chat-->>UI: Messages array
    
    User->>UI: Type message
    UI->>Chat: POST /api/chat/send
    Chat->>Supabase: INSERT chat_message<br/>(owner_id, content, role)
    Supabase-->>Chat: Created record
    Chat-->>UI: Message sent
    
    Note over UI: Poll every 3s
    UI->>Chat: GET /api/chat/messages
    Chat-->>UI: Updated history
    UI->>UI: Render new message
Loading
sequenceDiagram
    participant Make
    participant Tailscale as Tailscale Init<br/>Scripts
    participant Tailnet as PMOVES Tailnet
    participant System as systemctl

    Make->>Tailscale: make tailscale-join
    Tailscale->>Tailscale: Read TAILSCALE_AUTHKEY
    
    alt TAILSCALE_SIGN_AUTHKEY enabled
        Tailscale->>Tailscale: Sign auth key<br/>via tailscale lock sign
        Tailscale->>Tailscale: Write signed key<br/>with 0600 perms
    end
    
    Tailscale->>System: systemctl start tailscaled
    System-->>Tailscale: Service ready
    
    Tailscale->>Tailnet: tailscale up --auth-key
    Tailnet-->>Tailscale: Join confirmation<br/>+ BackendState
    
    Tailscale->>Tailscale: Record sentinel<br/>+ timestamp
    Tailscale-->>Make: Join complete
    
    Note over Make: Idempotent: sentinel<br/>prevents re-join
Loading
sequenceDiagram
    participant Make
    participant Monitor as Monitoring Stack<br/>(docker-compose)
    participant Prometheus
    participant Blackbox
    participant Services as pmoves<br/>Services

    Make->>Monitor: make up-monitoring
    Monitor->>Monitor: Start Prometheus:9090
    Monitor->>Monitor: Start Grafana:3000
    Monitor->>Monitor: Start Loki:3100
    Monitor->>Monitor: Start Promtail
    Monitor->>Monitor: Start Blackbox:9115
    
    Prometheus->>Prometheus: Load scrape configs
    
    par HTTP Health Probes
        Prometheus->>Blackbox: Probe /module=http_2xx
        Blackbox->>Services: GET /healthz (various ports)
        Services-->>Blackbox: 2xx responses
        Blackbox-->>Prometheus: probe_success=1
    and Container Metrics
        Prometheus->>Services: Scrape cadvisor:8080
        Services-->>Prometheus: container_cpu_usage_seconds_total
    and Log Collection
        Prometheus->>Loki: Scrape logs via Promtail
        Loki-->>Prometheus: Log metrics
    end
    
    Note over Prometheus: Metrics aggregated<br/>15s interval
    Prometheus->>Monitor: Update dashboards
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Areas requiring extra attention:

  • Boot JWT Authentication Flow (pmoves/ui/lib/supabaseClient.ts, pmoves/ui/app/dashboard/ingest/page.tsx, pmoves/ui/app/api/health/boot-jwt/route.ts): New auth model with expiration grace periods and token validation—verify JWT decoding, expiration logic, and fallback handling are correct
  • Tailscale Provisioning Scripts (pmoves/scripts/tailscale_brand_init.sh, pmoves/scripts/tailscale_brand_up.sh, pmoves/tools/mini_cli.py): Complex shell and Python integration for key signing, sentinel idempotence, and environment variable workflows—verify all error paths and permission handling
  • Chat & Real-Time Messaging (pmoves/ui/app/dashboard/chat/page.tsx, pmoves/ui/app/api/chat/{send,messages}/route.ts, pmoves/supabase/migrations/20251105_chat_messages.sql): New end-to-end chat flow with RLS policies—verify owner_id isolation, polling intervals, and Supabase client consistency
  • Monitoring Stack Integration (pmoves/monitoring/docker-compose.monitoring.yml, pmoves/monitoring/prometheus/prometheus.yml, pmoves/services/channel-monitor/channel_monitor/main.py): Prometheus/Grafana/Loki wiring with blackbox probes and custom metrics—verify scrape configs, probe target mappings, and metric counter initialization
  • PMOVES.YT Prefetch & Fallback Logic (pmoves/services/pmoves-yt/yt.py): Defensive prefetch blocks in yt_transcript and yt_emit with broad error detection—verify fallback chains and error message matching don't mask real failures
  • Makefile Target Dependencies (pmoves/Makefile): 50+ new targets with complex interdependencies and conditional logic (SINGLE_ENV_MODE, bootstrap sequences)—verify ordering, dependency chains, and idempotence
  • Environment Configuration Migration (pmoves/docker-compose.yml, pmoves/docker-compose.*.yml, pmoves/Makefile, pmoves/env.shared.example): Shift from inline secrets to env_file-based provisioning affects multiple services—verify all services correctly reference new env sources and no secrets are exposed

Possibly related PRs

  • PMOVES.AI#230: Aligns published integration images (Open Notebook, Wger, Firefly, Jellyfin, PMOVES.YT) and introduces Supabase boot-user provisioning/workflows—overlaps with this PR's integration publishing and boot JWT auth
  • PMOVES.AI#232: Modifies the same .github/workflows/integrations-ghcr.yml matrix, adding identical integration entries (archon-ui, open-notebook, wger, firefly-iii, jellyfin, pmoves-yt)—direct code-level overlap
  • Pmoves-open-notebook#2: Introduces Open Notebook GHCR publishing and compose integration—directly related to this PR's Open Notebook inclusion in CI matrix and compose networking

Suggested labels

feature, infrastructure, monitoring, auth, integrations

Poem

🐰 A world of chats and networks grows,
With Tailscale bridges, metrics flow,
Boot JWTs guard each owner's door,
And dashboards show what came before.
From Prometheus to Grafana's glow,
Single-User mode steals the show! 🚀


Note

Free review on us!

CodeRabbit is offering free reviews until Fri Nov 07 2025 to showcase some of the refinements we've made.

Comment @coderabbitai help to get the list of available commands and usage tips.

@POWERFULMOVES
POWERFULMOVES merged commit 61ddaa0 into main Nov 6, 2025
0 of 4 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +17 to +29
export async function GET(req: NextRequest) {
const supabase = getServiceSupabaseClient();
const owner = ownerFromJwt();
const ownerId = owner || req.nextUrl.searchParams.get('ownerId');
if (!ownerId) return NextResponse.json({ items: [] });
const { data, error } = await supabase
.from('chat_messages')
.select('id,role,agent,avatar_url,content,created_at')
.eq('owner_id', ownerId)
.order('created_at', { ascending: false })
.limit(50);
if (error) return NextResponse.json({ error: error.message }, { status: 500 });
return NextResponse.json({ items: data ?? [] });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require authentication before exposing chat history

The new GET /api/chat/messages handler queries Supabase with a service‑role client and accepts an ownerId from the query string when a boot JWT is not present. Because this route is publicly accessible in the Next.js app and no session or shared secret is checked, any unauthenticated caller can supply an arbitrary ownerId and fetch up to 50 messages bypassing the row‑level security policies. This exposes private chat content and should gate the endpoint behind a verified Supabase session or other auth mechanism before using the service role key.

Useful? React with 👍 / 👎.

Comment on lines +17 to +31
export async function POST(req: NextRequest) {
const supabase = getServiceSupabaseClient();
const body = await req.json().catch(() => ({}));
let { content, role, agent, avatar_url, ownerId } = body as any;
if (!ownerId) ownerId = ownerFromJwt();
if (!ownerId) return NextResponse.json({ error: 'ownerId missing' }, { status: 400 });
if (!content || typeof content !== 'string') return NextResponse.json({ error: 'content required' }, { status: 400 });
role = role || 'user';
const { data, error } = await supabase
.from('chat_messages')
.insert([{ owner_id: ownerId, content, role, agent, avatar_url }])
.select('id,role,agent,avatar_url,content,created_at')
.single();
if (error) return NextResponse.json({ error: error.message }, { status: 500 });
return NextResponse.json({ ok: true, message: data });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Protect chat message insertion from unauthenticated callers

The new POST /api/chat/send endpoint inserts rows into chat_messages using a service‑role client but allows ownerId to be provided in the request body and performs no authentication check. In the default single‑user setup any external caller can invoke this route to create messages for arbitrary owners, effectively granting public write access to a table that is supposed to be guarded by RLS. The handler should validate the request against an authenticated Supabase session or reject unauthenticated calls before using the service key.

Useful? React with 👍 / 👎.

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