Personal Telegram developer console for GitHub
feat/github-advanced-read
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 / DESTRUCTIVE provider 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 | - Telegram callback data and rendered provider text must remain bounded. |
| 35 | |
| 36 | ## Production-Accepted Foundation |
| 37 | ### Plugin Foundation v1 |
| 38 | - PR #14 squash merge `9d95a18659cead269ffa98af08d6bbf041c6135f`. |
| 39 | - Owner-device READ smoke and Cloudflare runtime telemetry accepted. |
| 40 | |
| 41 | ### Safe Actions / GitHub Operator foundation |
| 42 | - PR #15 merged to `main` at `59f0b431b8af86d3aa2b9acb4f5889911972e71a`. |
| 43 | - Post-merge CI run `37095115793` succeeded with 78/78 tests. |
| 44 | - Deploy run `37095129406` succeeded; production Durable Object binding verified. |
| 45 | - CI/Actions pagination subsequently landed on `main` at `074033f5a067283727a38e034a6d19436fcce475`. |
| 46 | |
| 47 | ### Approval and provider-error UX hardening |
| 48 | - PR #17 merged at `2c131ea5fc564faae20cd7aff1ac00831f7fe185`; expired/replayed approvals now visibly update Telegram. |
| 49 | - PR #18 merged at `a2e8a65763516765d47b535e514990f8698ad2a2`; approved provider failures now visibly update Telegram. |
| 50 | - Main CI #155 / run `37099455730` succeeded with 82/82 tests. |
| 51 | - Deploy #90 / run `37099465363` succeeded on the exact merge SHA. |
| 52 | - Active Cloudflare production version after deploy: `1865c8ac-5d05-40cd-8478-8d9f5473e34b` at 100% traffic. |
| 53 | |
| 54 | ## Production Safe Approval WRITE Acceptance — 2026-10-03 |
| 55 | Target: |
| 56 | - CI run #134, Actions run ID `37094321256`. |
| 57 | |
| 58 | Verified sequence: |
| 59 | 1. An early owner approval reached the provider but GitHub returned `403 Resource not accessible by personal access token`; the same approval token was then replayed and correctly rejected as already used. |
| 60 | 2. The owner updated the existing fine-grained GitHub token permission so Actions has write access; no token value was stored or logged. |
| 61 | 3. A fresh owner request produced `approval_required` -> `approval_issued`. |
| 62 | 4. Owner pressed Confirm; production audit recorded `approval_verified` -> approved `action_attempt` with `owner_write_approved`. |
| 63 | 5. Production audit on Worker version `1865c8ac-5d05-40cd-8478-8d9f5473e34b` recorded `action_result=success` for `github.workflow.run.rerun_failed`. |
| 64 | 6. GitHub run #134 moved from `run_attempt=1` to `run_attempt=2`, proving the provider WRITE was accepted. |
| 65 | 7. Attempt 2 itself failed only because it reran the historical PR #15 merge ref from before the later Durable Object binding/config fix; this is historical-code behavior, not a current-main regression. |
| 66 | |
| 67 | Conclusion: |
| 68 | - Owner-bound production approval: VERIFIED. |
| 69 | - No provider WRITE before approval: VERIFIED. |
| 70 | - Durable one-time replay protection: VERIFIED. |
| 71 | - GitHub Actions WRITE authorization and provider POST: VERIFIED. |
| 72 | - Telegram success feedback after accepted provider WRITE: VERIFIED. |
| 73 | |
| 74 | ## Current Work — PR #19 GitHub Advanced READ |
| 75 | - Branch: `feat/github-advanced-read`. |
| 76 | - Design: `docs/superpowers/specs/2026-10-03-github-advanced-read-design.md`. |
| 77 | - Plan: `docs/superpowers/plans/2026-10-03-github-advanced-read.md`. |
| 78 | - Scope is READ-only: workflow job detail/log tail, artifacts metadata, branches/compare, PR detail/files/checks, issues, releases and bounded pagination. No new provider mutation is added in this slice. |
| 79 | |
| 80 | ### TDD evidence |
| 81 | - Provider RED CI #156 / run `37100585034`: 87 tests total, 82 pass / 5 expected failures for missing Advanced provider readers. |
| 82 | - Provider compatibility fix followed after CI #157 exposed two regressions (log clamp and page-1 PR URL compatibility). |
| 83 | - Provider GREEN CI #158 / run `37100892060`: 19 test files, 87/87 pass, 0 fail/skip/cancelled. |
| 84 | - Plugin RED CI #159 / run `37100960176`: 92 tests total, 87 pass / 5 expected failures for undeclared/unimplemented Advanced routes and views. |
| 85 | - Plugin GREEN CI #161 / run `37101099153`: 20 test files, 92/92 pass, 0 fail/skip/cancelled. |
| 86 | - Review hardening RED CI #164 / run `37101390354`: 95 tests total, 92 pass / 3 expected failures for artifact pagination, PR diff pagination and visible READ-provider errors. |
| 87 | - Review hardening GREEN CI #166 / run `37101635682`: 21 test files, 95/95 pass, 0 fail/skip/cancelled. |
| 88 | - Mixed Issue/PR pagination RED CI #167 / run `37101783124`: 97 tests total, 95 pass / 2 expected failures. |
| 89 | - Final GREEN CI #170 / run `37102060845` at head `9fbd33f3ad436c9519d521d704b6f7b882a2bbdd`: 22 test files, 97/97 pass, 0 fail/skip/cancelled. |
| 90 | |
| 91 | ### Implemented in PR #19 |
| 92 | - Bounded raw workflow-job log tail with HTML escaping and visible truncation state. |
| 93 | - Workflow job detail and per-job drill-down from run jobs. |
| 94 | - Workflow artifact metadata view with bounded pagination. |
| 95 | - Branch list and compare-to-default using a validated 40-hex head SHA. |
| 96 | - Advanced PR list/detail/files-diff/checks views; PR diff page size matches rendered page size so files are not silently skipped. |
| 97 | - Issues and releases views; Issue pagination preserves GitHub raw-page continuation even when PR entries are filtered out. |
| 98 | - Pagination is clamped to page 1..100 and page size <=20 where list pagination is exposed. |
| 99 | - New READ callbacks resolve without provider calls before central policy evaluation; callback lengths are regression-tested against Telegram limits. |
| 100 | - READ provider failures now visibly update Telegram, including least-privilege guidance for provider 403, instead of appearing silent. |
| 101 | |
| 102 | ### Review evidence |
| 103 | - PR patch reviewed after hardening: no new provider mutation endpoint was added; only the pre-existing approval-gated workflow rerun/cancel POSTs remain. |
| 104 | - Secret-pattern scan over the PR patch found no `ghp_` or `github_pat_` material. |
| 105 | - Callback/data bounds, raw-log bounds, patch bounds and pagination gaps are regression-tested. |
| 106 | |
| 107 | ### Not yet production-accepted |
| 108 | - PR #19 is not merged at this checkpoint. |
| 109 | - Exact post-merge `main` CI and Cloudflare deploy are NOT VERIFIED. |
| 110 | - Owner-device production smoke for the new Advanced READ paths is NOT VERIFIED until after deploy. |
| 111 | |
| 112 | ## Next Executable Actions |
| 113 | 1. Run one fresh final PR CI after this memory checkpoint, mark ready and squash-merge the exact reviewed head only if green. |
| 114 | 2. Verify exact post-merge `main` CI, deploy, active Cloudflare version and current-version telemetry. |
| 115 | 3. Perform owner-device READ smoke through Telegram for Branches/Compare, PR detail/files/checks, CI Run/Jobs/failed log/artifacts, Issues and Releases. |
| 116 | 4. If live Checks or Issues return 403, add only the specific missing fine-grained PAT READ permission; do not rotate the token unnecessarily. |
| 117 | 5. Then implement remaining GitHub Advanced WRITE items only where useful (workflow dispatch and/or specific-job rerun) as a separate Safe Approval slice. |
| 118 | 6. Continue to the Cloudflare Ops plugin and the broader roadmap. |
| 119 | |
| 120 | ## Remaining Roadmap |
| 121 | 1. Finish GitHub Advanced production acceptance; add workflow dispatch/specific-job rerun only if operationally useful and always via Safe Approval. |
| 122 | 2. Cloudflare Ops plugin: deployments, versions, bindings, health, telemetry/runtime errors and approval-gated rollback/deploy operations. |
| 123 | 3. CI/CD Control Plane and release acceptance orchestration. |
| 124 | 4. Monitoring + Incident Manager. |
| 125 | 5. Automation Engine with resumable/idempotent approval-aware workflows. |
| 126 | 6. AI Copilot with no direct production mutation. |
| 127 | 7. Browser QA real production smoke. |
| 128 | 8. Telegram Mini App backed by real APIs. |
| 129 | 9. Plugin ecosystem and multi-project control plane. |
| 130 | 10. Final hardening, recovery drills, docs and versioning. |
| 131 | |
| 132 | ## Project Boundaries |
| 133 | - Nexa Dev Bot is independent from Finora / Factor-easy unless an explicit adapter is added. |
| 134 | - Do not mix other projects' Supabase/database state into Nexa by default. |
| 135 | - Keep secrets out of code, logs and documentation. |