Commit Graph

40 Commits

Author SHA1 Message Date
Azreen Jamal c38ab45595 add audit report and screenshots for give.charityright.org.uk 2026-03-10 02:46:00 +08:00
Azreen Jamal 702c8b3f74 feat(nexus): 10 major upgrades - context bridge, memory, planner, self-healing, smart routing, synthesis, notifications, /nx commands, smarter classifier, session summaries 2026-03-10 01:48:39 +08:00
Azreen Jamal 1f642c6b66 feat(nexus): OS notification + terminal bell when sub-agent finishes 2026-03-10 01:34:46 +08:00
Azreen Jamal 9bc94b0bab add nexus, hyperloop, model-router extensions and update themeMap, justfile 2026-03-10 01:32:15 +08:00
Azreen Jamal bd2c7d5102 feat: pi-worker now picks up and fixes real bugs from Asana
Major changes:
- Task loop polls Under Review + New Bugs sections (was only checking empty sections)
- Smart project routing: keyword matching maps task names to correct codebase
  (e.g. 'pledge' → legacy-donation-system-laravel)
- Pi executes in the project directory, not /opt/pi-worker
- Git pull before execution to get latest code
- Skips already-attempted tasks (checks Asana comments)
- Config now exposes projectsPath

First real bug fixed autonomously:
  'Duplicate Pledges Detected with Same External Reference'
  → Fixed uniqid() causing duplicate Engage pledges on every sync
  → 1 file changed in app/N3O/Schema.php

Also: fix watchdog to use systemd-notify command (unix_dgram unsupported in Bun),
add debug logging to lock acquire failures
2026-03-09 01:33:24 +08:00
Azreen Jamal cf20646290 fix: pi-worker systemd integration + lock file bug
- Fix FileLock: track 'held' state, only release if acquired, suppress ENOENT
- Upgrade systemd service: Restart=always (was on-failure, caused 2-day outage),
  StartLimitBurst, WatchdogSec=120, MemoryMax=512M, KillMode=mixed
- Add systemd watchdog: health server self-checks at :8787, notifies sd_notify
- Kill orphaned nohup process, restart cleanly via systemd
2026-03-09 01:08:40 +08:00
Azreen Jamal 40ae8f4fb7 feat: increase telegram bot session limit from 100KB to 100,000KB 2026-03-08 22:58:41 +08:00
Azreen Jamal a86865ee25 fix: raw fetch polling loop - bypasses Grammy polling, handles 409 gracefully
- Replaced Grammy bot.start() with manual fetch-based getUpdates loop
- Grammy used only for bot.handleUpdate() (middleware/handlers)
- 409 conflicts handled with 10s backoff + continue (no crash)
- Network errors handled with 3s retry
- Root cause of persistent 409: zombie bun process (PID 72407) from 3:23 AM
  was holding Telegram long-poll lock all day
2026-03-06 21:41:51 +08:00
Azreen Jamal ccfa969261 feat: major telegram bot rewrite - security, UX, smart commands
- SECURITY: cwd=/tmp, strip ANTHROPIC_API_KEY from Pi env
- FIX: recursive retry now has max retries counter
- FIX: await processMessage, proper error handling
- FIX: ESM imports only (no require)
- FIX: full stderr drain, check SSH exit codes
- UX: single progress message edited in-place (no spam)
- UX: HTML formatting for commands output
- UX: session warning at 80KB, auto-clear at 100KB
- UX: block concurrent tasks per user
- SMART: /health command - check pi-worker status
- SMART: /asana command - list open tasks
- SMART: /status uses edit-in-place
- SMART: /ssh shows exit code
- CLEAN: removed dead deps reference
2026-03-06 21:15:18 +08:00
Azreen Jamal ea0ba4ee10 fix: major cleanup - verify cache, section cache, rate limit retry, split sweep from cleanup
- Separate cleanupCompletedMyTasks (fast, no Pi) from sweepIncompleteTasks (with Pi verify)
- Cache verified-not-done tasks for 30min to avoid re-checking every cycle
- Cache project sections for 5min to reduce API calls
- Add rate limit (429) retry with Retry-After header
- Add server error (5xx) retry
- Remove assignee:null - only use assignee_status:later
- Keep tasks assigned to user always
2026-03-06 20:40:31 +08:00
Azreen Jamal fbeb79264a fix: keep tasks assigned to user - only move to Done section, never unassign 2026-03-06 17:33:36 +08:00
Azreen Jamal 0d7f54c239 fix: unassign completed tasks to fully remove from My Tasks 2026-03-06 17:26:59 +08:00
Azreen Jamal 6acadecc7b fix: move completed My Tasks to Done/Resolved section in their respective projects 2026-03-06 17:15:23 +08:00
Azreen Jamal d95dd524be fix: clear completed tasks from Recently Assigned (set assignee_status=later) 2026-03-06 17:02:55 +08:00
Azreen Jamal 91b8ceeac9 feat: sweep My Tasks (Recently Assigned) for already-done tasks 2026-03-06 16:51:01 +08:00
Azreen Jamal 9c3e1e3a24 fix: include Recently Assigned and Awaiting More Info sections in sweep and task pickup 2026-03-06 16:41:15 +08:00
Azreen Jamal 768ccada4b feat: sweep all sections for already-done tasks before picking new work 2026-03-06 16:33:46 +08:00
Azreen Jamal 8309fc1869 fix: faster verification - 2min timeout, no deep scans 2026-03-06 16:09:03 +08:00
Azreen Jamal 086d9a3026 feat: add pre/post verification to task execution pipeline
- Before executing: verify if work is already done on server
- If already done: skip execution, comment evidence, mark complete
- After executing: run verification again to confirm work was applied
- Verification agent uses Pi with read-only investigation prompt
- Adds verification status (PASSED/COULD NOT CONFIRM) to Asana comments
- Prevents redundant work and catches false completions
2026-03-06 15:57:39 +08:00
Azreen Jamal ccdbf94450 fix: detect Pi API errors in event stream (exit code 0 on failure)
Pi CLI exits with code 0 even when the Anthropic API returns errors
(e.g. insufficient credits). The error is only visible in the JSON
event stream as stopReason:"error" with an errorMessage field.

Now the executor parses message_end/turn_end events for errorMessage
and treats them as failures, preventing false "task completed" reports.
2026-03-06 15:41:02 +08:00
Azreen Jamal bf69c43e2f fix: update task-loop section matching for Bug Intake project
- SECTIONS now uses arrays of candidate names searched in priority order
- Maps Bug Intake sections: New Bugs→TODO, Under Review→IN_PROGRESS, Resolved→DONE
- Added findFirstSection helper for array-based section lookup
2026-03-06 15:38:04 +08:00
Azreen Jamal fad45aae27 chore: add pi-worker paths to gitignore 2026-03-06 15:26:44 +08:00
Azreen Jamal 19420cc01d feat: add pi-worker service - autonomous Asana task executor & project improvement agent
- Asana REST API client for task polling, section management, and commenting
- Pi CLI executor for running tasks with specialist agent teams
- Task loop: polls Asana To Do/Pi Worker sections, executes tasks, reports results
- Improvement loop: rotates through 8 improvement categories (code quality, security, docs, testing, etc)
- Health server on :8787
- File-based mutex locks with stale lock detection
- Docker + docker-compose deployment config
- deploy.sh for one-command deployment to cr-server-new via SSH/Incus
2026-03-06 15:26:13 +08:00
Azreen Jamal 6e074fd512 feat: add pi-worker service for autonomous Asana task execution and project improvements 2026-03-06 15:14:43 +08:00
Azreen Jamal 28465884fc telegram-bot: fix streaming JSON, session bloat, prevent local command execution
- Fix progress messages showing [object Object] - parse tool_execution_start/end events
- Auto-clear sessions >200KB to prevent context bloat timeouts
- Restrict bash tool to SSH and curl only - prevent recursive Pi spawning
- Proper error messages for timeouts
2026-03-06 04:20:02 +08:00
Azreen Jamal b5d8665ac0 telegram-bot: rewrite to use Pi CLI with streaming JSON output
- Replaced direct Anthropic API with Pi CLI (uses platform auth, no API key needed)
- Model: claude-sonnet-4-6
- Streaming JSON mode with live progress updates in Telegram
- Per-user session files via Pi's --session/--continue
- Auto-recovery from corrupted sessions
- 5 min timeout, not-lazy system prompt
2026-03-06 02:58:58 +08:00
Azreen Jamal bcce1d4549 update extensions, telegram bot, and add giveaway module 2026-03-05 18:11:32 +08:00
Azreen Jamal a7413075c3 telegram bot: fix env loading, remove markdown, clear stale updates 2026-03-03 04:19:37 +08:00
Azreen Jamal dd2ce7e81f telegram bot: launchd install/uninstall scripts for macOS 2026-03-03 04:16:27 +08:00
Azreen Jamal 5f8f7a1591 telegram bot: hardened auth, rate limiting, dangerous cmd blocking, private-only 2026-03-03 04:14:16 +08:00
Azreen Jamal c6c1e06048 telegram bot: two-way Claude chat + SSH command runner 2026-03-03 04:10:57 +08:00
Azreen Jamal 1389c848b2 infra.md: full topology map, .env: all server credentials 2026-03-03 03:11:11 +08:00
Azreen Jamal dfd64112dd infra.md references .env vars only, no hardcoded values 2026-03-03 03:09:13 +08:00
Azreen Jamal 201aa94056 move infra.md to .pi/ 2026-03-03 03:07:09 +08:00
Azreen Jamal a3c6d09350 remove infra.md.example, infra.md is the source of truth 2026-03-03 03:06:13 +08:00
Azreen Jamal 1ad3033cc1 infra.md: reference only, secrets stay in .env 2026-03-03 03:05:06 +08:00
Azreen Jamal 5e0d80daf9 add infra credentials setup (gitignored secrets, shared template) 2026-03-03 03:01:54 +08:00
Azreen Jamal f832b913d5 feat: add improved pi agent with observatory, dashboard, and pledge-now-pay-later 2026-03-01 23:41:24 +08:00
IndyDevDan ae242436c9 pi vs open code 2026-02-26 15:55:17 -06:00
IndyDevDan 32dfe122cb 🚀 2026-02-22 20:19:33 -06:00