Personal Telegram developer console for GitHub

feat/telegram-pr-merge
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
md 6.91 KB

Safe GitHub Operator Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Add reusable Telegram approvals and safe GitHub workflow operations on top of the production-accepted plugin foundation.

Architecture: Keep the existing resolve -> policy -> execute boundary. Add an HMAC-backed approval service between the first approval-required dispatch and a second approved dispatch, persist one-time consume semantics through a SQLite Cloudflare Durable Object, then extend the existing GitHub plugin/service/menu with workflow read/write actions.

Tech Stack: JavaScript ES modules, Node test runner, Cloudflare Workers Web Crypto, Cloudflare Durable Objects with SQLite storage, Telegram Bot API, GitHub REST API.

Spec: docs/superpowers/specs/2026-10-03-safe-github-ops-design.md

Global Constraints

  • Owner-only authorization remains enforced at the Worker boundary.
  • READ executes immediately; WRITE and DESTRUCTIVE require verified approval.
  • Approval tokens use HMAC-SHA-256 and never appear in audit logs.
  • One-time approval consumption is persisted through APPROVAL_REPLAY_GUARD; missing replay protection fails closed.
  • No optional AI/browser/third-party paid service is enabled in this phase; the Durable Object namespace is part of the required security architecture for replay protection.
  • Existing GitHub repository/file UX remains backward compatible.
  • Provider failures remain explicit; no fabricated success.

Review Focus

  • Tampered/expired/wrong-owner approval callback must never reach provider execution.
  • Telegram callback-data size overflow must fail closed before rendering an unusable button.
  • GitHub token 401/403/409/422 responses must surface as failures, not success.
  • Duplicate approval callback must not execute provider code twice even across Worker isolates.
  • Missing Durable Object binding must fail closed for approved WRITE execution.
  • Existing READ navigation and Cloudflare fetch regression must remain green.

Task 1: Approval service and policy semantics

Files: - Create: src/core/approval.js - Modify: src/core/action-policy.js - Test: test/approval.test.js - Test: test/action-policy.test.js

Interfaces: - Produces: ApprovalService.issue(payload) -> token, ApprovalService.verify(token, expectations) -> payload, ApprovalService.consume(token, expectations) -> payload. - Produces: ActionPolicy.evaluate({ action, isOwner, approved }).

  • Write failing tests for valid issue/verify, tamper, expiry, wrong owner, wrong action, oversize and replay.
  • Run targeted tests and verify RED.
  • Implement minimal approval service using Web Crypto HMAC-SHA-256 and bounded base64url payloads.
  • Extend policy to allow approved owner WRITE/DESTRUCTIVE actions.
  • Run targeted tests and verify GREEN.

Task 2: Router approved dispatch and audit lifecycle

Files: - Modify: src/core/router.js - Test: test/plugin-router.test.js - Test: test/audit.test.js

Interfaces: - Consumes: context.approved === true after approval verification. - Produces: policy-enforced execution and approval lifecycle audit records without signed tokens.

  • Add failing tests proving unapproved write does not execute and approved write does.
  • Verify RED.
  • Pass approved into policy and add safe audit fields.
  • Verify GREEN and full router/audit tests.

Task 3: GitHub workflow REST service

Files: - Modify: src/github.js - Test: test/github.test.js

Interfaces: - Produces: listWorkflowRuns, getWorkflowRun, listWorkflowJobs, rerunFailedWorkflowRun, cancelWorkflowRun.

  • Add failing path/method/body/error tests.
  • Verify RED.
  • Implement minimal authenticated REST methods through existing request helper/repository resolver.
  • Verify GREEN including 401/403/404/409/422 failure handling.

Task 4: GitHub plugin actions and workflow views

Files: - Modify: src/plugins/github/manifest.js - Modify: src/plugins/github/plugin.js - Test: test/github-plugin.test.js - Test: test/navigation.test.js

Interfaces: - Produces READ actions for workflow runs/jobs and WRITE actions for rerun/cancel. - Produces compact Telegram views and callback IDs using repository/run IDs.

  • Add failing route/view/risk tests.
  • Verify RED.
  • Add manifest actions, callback resolvers and bounded workflow views.
  • Verify GREEN and existing navigation regression suite.

Task 5: Telegram confirmation flow and durable replay protection

Files: - Modify: src/bot.js - Modify: src/index.js - Create: src/core/durable-replay-store.js - Create: src/durable/approval-replay-guard.js - Modify: wrangler.jsonc - Test: test/approval-flow.test.js - Test: test/durable-replay.test.js

Interfaces: - Consumes router requiresApproval response. - Produces approve:<token> and cancel:<token> callbacks and a second approved dispatch. - Persists nonce consumption through APPROVAL_REPLAY_GUARD so a token cannot be consumed again from another Worker isolate.

  • Add failing tests for confirmation rendering, cancel, verified approval, malformed/expired token and duplicate consume.
  • Verify RED.
  • Integrate ApprovalService with bot callback flow; never log token.
  • Add Durable Object replay adapter/guard and fail closed when the binding is unavailable.
  • Export ApprovalReplayGuard and declare its SQLite Durable Object binding in Wrangler.
  • Verify GREEN and existing /start, /repos, stale callback tests.

Task 6: Local runtime command and documentation

Files: - Modify: package.json - Modify: README.md - Modify: PROJECT_MEMORY.md

Interfaces: - Produces npm start -> wrangler dev for local Worker development.

  • Change local start command without altering production deploy workflow.
  • Document safe operations, Durable Object replay guard and provider permission requirement.
  • Update project checkpoint with exact test/PR/deploy evidence after verification.

Task 7: PR, CI, deployment and runtime verification

Files: none unless fixes are required.

  • Run full PR CI and inspect logs: run 37094394332, 15 test files, 78/78 tests passed, 0 failed/skipped.
  • Review complete PR diff for scope and secret leakage.
  • Merge only after green CI.
  • Verify post-merge main CI and exact-commit Cloudflare deployment.
  • Verify the APPROVAL_REPLAY_GUARD binding and SQLite Durable Object on the active Cloudflare deployment.
  • Verify owner-device READ navigation telemetry on current version.
  • Attempt a write smoke only if the configured runtime GitHub token already permits the chosen operation and the owner explicitly confirms it in Telegram; otherwise record provider-permission smoke as NOT VERIFIED without rotating secrets automatically.