Personal Telegram developer console for GitHub
fix/provider-write-error-feedback
audit/commit-drilldown
audit/finalize-workspace-menu-security
audit/ops-actionability
audit/pr-menu-consolidation
audit/status-menu-consolidation
audit/telegram-menu-e2e
audit/telegram-menu-e2e-wave2
chore/actions-node24-runtime
cleanup/remove-diag
design/cloudflare-ops-read
docs/control-plane-2-7-design
docs/guide-v2-1-sync
docs/menu-audit-final-sync
docs/phase2-acceptance-closeout
docs/phase2-multifile-design
feat/bootstrap-worker
feat/cloudflare-ops-read
feat/cp2-multifile-final
feat/cp2-multifile-workspace
feat/cp3-github-write-final
feat/cp4-cloudflare-ops-final
feat/cp5-cicd-control-plane
feat/cp6-incident-manager
feat/cp7-automation-engine
feat/deep-file-browser
feat/final-delivery-16-20
feat/github-advanced-read
feat/in-app-guide-v2
feat/navigation-recovery-ux-v2
feat/ops-console-v2-1
feat/persistent-menu-code-input
feat/phase2-multifile-workspace
feat/phase2-multifile-workspace-v2
feat/plugin-foundation-v1
feat/safe-github-ops
feat/self-register-webhook
feat/studio-g0-foundation
feat/telegram-main-inline-menu
feat/telegram-pr-merge
feat/ux-platform-8-12
feat/v3a-readonly-copilot
feat/workspace-file-upload
feature/mobile-repo-browser
feature/multi-file-change-set
fix/approval-expiry-feedback
fix/callback-resilience-and-docs
fix/ci-actions-pagination
fix/cloudflare-fetch-binding
fix/editor-request-body-cap
fix/editor-safe-file-options
fix/issues-permission-release-empty-ux
fix/main-menu-callback-fallback
fix/phase2-file-editor-selection
fix/phase2-final-ux
fix/phase2-workspace-ref-persistence
fix/production-auto-deploy
fix/provider-write-error-feedback
fix/repository-id-navigation-fallback
fix/repository-pr-navigation
fix/telegram-callback-updates
fix/telegram-runtime-diagnostics
fix/workspace-editor-flow-v2
fix/workspace-recovery-validation
hardening/ci-zero-test-telegram-token
hardening/pr1-destructive-totp
hardening/pr2-kill-switch
main
multifile-workspace
nexa/edit-BwJEIIY3PW
nexa/edit-IPHT8irO7b
nexa/edit-b4Od3BIMYd
p2-multifile
phase2-20261005
phase2-20261005-a
phase2-20261005-b
phase2-20261005-c
phase2-20261005-d
phase2-20261005-e
phase2-20261005-f
phase2-20261005-g
phase2-20261005-h
phase2-20261005-i
phase2-20261005-j
phase2-20261005-k
phase2-20261005-l
phase2-20261005-m
phase2-20261005-n
phase2-20261005-o
phase2-20261005-p
phase2-20261005-q
phase2-20261005-r
phase2-20261005-s
phase2-20261005-t
phase2-20261005-u
phase2-20261005-v
phase2-20261005-w
phase2-20261005-x
phase2-20261005-y
phase2-20261005-z
phase2-acceptance-closeout
phase2-add-file-hotfix
phase2-change-set
phase2-design-20261005
phase2-design-final
phase2-implementation
phase2-multifile-implementation
phase2-multifile-spec
phase2-spec-final
phase2-workspace
phase2/multifile-workspace
plan/nexa-studio-v2-reviewed
security/remove-telegram-setup
spec/repository-workspace-editor
v3a/multifile
work/multifile
| 1 | # PROJECT_MEMORY.md |
| 2 | |
| 3 | ## Project Identity |
| 4 | - Name: Nexa Dev Bot |
| 5 | - Repository: `davoodmehraban89/nexa-dev-bot` |
| 6 | - Canonical branch: `main` |
| 7 | - Visibility: private |
| 8 | - Purpose: owner-only Telegram developer console for GitHub visibility and controlled developer operations. |
| 9 | - This file is the continuity source of truth; live repository/runtime evidence overrides stale text. |
| 10 | |
| 11 | ## AI Handoff Protocol |
| 12 | 1. Verify live `main`, recent CI/deploy and relevant runtime evidence before changes. |
| 13 | 2. Prefer live evidence over chat memory. |
| 14 | 3. Keep durable checkpoints here and never store secrets/tokens/private keys. |
| 15 | 4. Do not call a phase production-accepted from CI alone; deployment and owner-device/runtime evidence are separate gates. |
| 16 | 5. Production WRITE actions must remain behind Safe Approval and durable one-time replay protection. |
| 17 | |
| 18 | ## Current Architecture |
| 19 | - Cloudflare Worker webhook boundary in `src/index.js`. |
| 20 | - Telegram coordinator and Safe Approval lifecycle in `src/bot.js`. |
| 21 | - Plugin Registry + central Action Policy + Audit Logger + Plugin Router in `src/core/`. |
| 22 | - HMAC approval tokens in `src/core/approval.js`. |
| 23 | - Durable Object replay guard via `APPROVAL_REPLAY_GUARD` / `ApprovalReplayGuard`. |
| 24 | - GitHub plugin in `src/plugins/github/`; provider adapter in `src/github.js`. |
| 25 | - Exact-commit CI/deploy workflows under `.github/workflows/`. |
| 26 | |
| 27 | ## Security / Data-Trust Invariants |
| 28 | - Non-owner Telegram updates are ignored before private-data access. |
| 29 | - `READ` is owner-only; `WRITE` / `DESTRUCTIVE` require verified owner approval. |
| 30 | - Approval is owner/action/risk/target/expiry-bound and one-time consumed through Durable Object storage. |
| 31 | - Provider mutation never executes before policy approval. |
| 32 | - Provider errors are explicit; no fabricated success or fallback data. |
| 33 | - Secrets and signed approval callback tokens must not appear in logs/docs. |
| 34 | |
| 35 | ## Production-Accepted Foundation |
| 36 | ### Plugin Foundation v1 |
| 37 | - PR #14 squash merge `9d95a18659cead269ffa98af08d6bbf041c6135f`. |
| 38 | - Owner-device READ smoke and Cloudflare runtime telemetry accepted. |
| 39 | |
| 40 | ### Safe Actions / GitHub Operator foundation |
| 41 | - PR #15 merged to `main` at `59f0b431b8af86d3aa2b9acb4f5889911972e71a`. |
| 42 | - Post-merge CI run `37095115793` succeeded with 78/78 tests. |
| 43 | - Deploy run `37095129406` succeeded; production Durable Object binding verified. |
| 44 | - CI/Actions pagination subsequently landed on `main` at `074033f5a067283727a38e034a6d19436fcce475`. |
| 45 | |
| 46 | ### Approval rejection UX hardening |
| 47 | - PR #17 merged at `2c131ea5fc564faae20cd7aff1ac00831f7fe185`. |
| 48 | - Main CI #149 / run `37098697859` succeeded. |
| 49 | - Deploy #84 / run `37098710348` succeeded on the exact merge SHA. |
| 50 | - Active Cloudflare version after deploy: `e7182388-ca16-4aeb-b144-6d5f0fc63043` at 100% traffic. |
| 51 | - Expired/replayed approvals now visibly update the Telegram message instead of appearing silent. |
| 52 | |
| 53 | ## Live GitHub WRITE Smoke — 2026-10-03 |
| 54 | Target: |
| 55 | - CI run #134, Actions run ID `37094321256`. |
| 56 | |
| 57 | Observed on production version `e7182388-ca16-4aeb-b144-6d5f0fc63043`: |
| 58 | 1. Owner requested `github.workflow.run.rerun_failed`. |
| 59 | 2. Audit: `approval_required` -> `approval_issued`. |
| 60 | 3. Owner pressed Confirm. |
| 61 | 4. Audit: `approval_verified` -> approved `action_attempt`. |
| 62 | 5. Provider result: `error` with `403 Resource not accessible by personal access token`. |
| 63 | 6. Owner pressed the same approval again; Durable replay guard rejected it as `Approval token already used`. |
| 64 | 7. GitHub run #134 remains `run_attempt=1`; therefore no rerun was accepted by GitHub. |
| 65 | |
| 66 | Conclusion: |
| 67 | - Owner-bound approval path in production: VERIFIED. |
| 68 | - Durable one-time replay protection in production: VERIFIED. |
| 69 | - GitHub WRITE provider authorization: BLOCKED by current Worker `GITHUB_TOKEN` permissions. |
| 70 | - For a fine-grained PAT, GitHub Actions repository permission must be `write` for rerun/cancel endpoints. A classic PAT requires appropriate private-repository `repo` scope. |
| 71 | - Do not rotate or expose `GITHUB_TOKEN` automatically. Permission/credential change requires owner action. |
| 72 | |
| 73 | ## Current Work |
| 74 | ### PR #18 — provider WRITE error feedback |
| 75 | - Branch: `fix/provider-write-error-feedback`. |
| 76 | - Purpose: after a valid approval, provider failures must visibly replace the approval message rather than silently return an error. |
| 77 | - RED CI #150 / run `37099120240`: 18 test files, 82 tests, 81 pass / 1 expected failure in the new provider-error UI regression. |
| 78 | - Implementation commit `75c9e540192ae3b42931329035002a95819f7163` adds Telegram feedback for approved provider failures while preserving one-time approval consumption. |
| 79 | - CI #152 proved the implementation behavior but exposed a false-positive Persian test regex (`ناموفق` contains `موفق`). |
| 80 | - Test correction commit `354f79c6f6f0b4372d85f30cf4ad8ece3e26944d` narrowed the success assertion. |
| 81 | - CI #153 / run `37099346636`: 18 test files, 82 tests, 82 pass, 0 fail/skip/cancelled. |
| 82 | - This file records the live permission blocker and current recovery path. |
| 83 | |
| 84 | ## Next Executable Actions |
| 85 | 1. Review PR #18, squash-merge, verify exact `main` CI/deploy and active Cloudflare version. |
| 86 | 2. Owner must update the Worker GitHub credential so `nexa-dev-bot` has GitHub Actions WRITE on the target repository; never paste the token into repository/docs/logs. |
| 87 | 3. Re-run the owner-device WRITE smoke through Telegram on run #134 (or another safe failed run). |
| 88 | 4. Acceptance requires: approval verified, provider POST accepted, `run_attempt` increases/new attempt appears, result visible in Telegram, replay still rejected. |
| 89 | 5. Only after provider WRITE smoke is green, continue the broader roadmap in verified vertical slices. |
| 90 | |
| 91 | ## Remaining Roadmap |
| 92 | 1. GitHub Advanced: logs, failed-step log view, artifacts metadata, branches/compare, PR detail/diff/checks, issues, releases, workflow dispatch where useful, bounded pagination. |
| 93 | 2. Cloudflare Ops plugin: deployments, versions, bindings, health, telemetry/runtime errors and approval-gated rollback/deploy operations. |
| 94 | 3. CI/CD Control Plane and release acceptance orchestration. |
| 95 | 4. Monitoring + Incident Manager. |
| 96 | 5. Automation Engine with resumable/idempotent approval-aware workflows. |
| 97 | 6. AI Copilot with no direct production mutation. |
| 98 | 7. Browser QA real production smoke. |
| 99 | 8. Telegram Mini App backed by real APIs. |
| 100 | 9. Plugin ecosystem and multi-project control plane. |
| 101 | 10. Final hardening, recovery drills, docs and versioning. |
| 102 | |
| 103 | ## Project Boundaries |
| 104 | - Nexa Dev Bot is independent from Finora / Factor-easy unless an explicit adapter is added. |
| 105 | - Do not mix other projects' Supabase/database state into Nexa by default. |
| 106 | - Keep secrets out of code, logs and documentation. |