Skip to content

githubApp() connections: authoring, CLI, dashboard Repositories tab, api-edge - #650

Open
ZIJ wants to merge 4 commits into
mainfrom
feat/github-app-connections
Open

githubApp() connections: authoring, CLI, dashboard Repositories tab, api-edge#650
ZIJ wants to merge 4 commits into
mainfrom
feat/github-app-connections

Conversation

@ZIJ

@ZIJ ZIJ commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Public half of the GitHub App integration (serverless-agents-ws .agents/work/010-github-app-integration.md). Companion to diggerhq/blue#32 (private edge: mint, attachments, routes) and diggerhq/blue#31 (independent proxy fix).

What ships

  • @opencomputer/agent: githubApp({ permissions }) — a credential reference for defineConnection headers. Permissions are a required argument validated against the supported set (contents, pull_requests, issues, metadata, checks; read-only keys enforced); valid only on GitHub API origins. Replaces PAT-in-secret for GitHub: the platform mints a ~1h installation token scoped to the project's repositories and the declared permissions, attached at managed egress — agent code never sees a credential, and there is no token to create, paste, or rotate.
  • CLI: static parser + bundled shim support (permissions must be an inline object literal — enforced with a targeted error), manifest emits {kind: "github_app", permissions}, opencomputer github status|connect, and a dev-loop warning when code uses githubApp() but development has no GitHub connection. Secrets origin-inference now skips non-secret header kinds.
  • Dashboard: project-level Repositories tab (per-environment, like Secrets): connect the shared OpenComputer app or create a dedicated per-project GitHub App via the manifest wizard; all/selected repository scope with dormant selections visibly retained and truncation honesty; the full connection state model including unavailable → Retry (a GitHub outage never renders as disconnected); app management (webhook-secret/private-key re-entry, delete). Scope logic lives namespaced in managed-agents/github-scope.ts — deliberately not shared with the legacy repository-access module.
  • api-edge: explicit allowlist entries for the project GitHub routes, plus an unauthenticated public surface for the two GitHub browser callbacks and the App webhook ingress (authorized at the private edge by one-time state / HMAC). The public origin is what gets baked into GitHub app manifests.
  • Local dev: OC_MANAGED_TARGET Vite proxy bypass (mirrors OC_V3_KEY) — point the dashboard at a local wrangler dev of the private edge; the dedicated-app flow round-trips real GitHub against localhost.

Verification

  • agent/, cli/, api-edge: tsc clean; CLI 38 tests, api-edge 95 tests green. New compiler tests: literal-permissions manifest output + non-literal rejection.
  • web: typecheck + build clean; 189 tests green incl. new scope-logic units (dormant retention, truncation-omission never classified as revoked).

Not in this PR

Public docs (repo rule: only after the slice is verified on default branches); OC shared-app registration per environment (ops); repo checkout/publish (explicitly deferred to its own design).

🤖 Generated with Claude Code

ZIJ and others added 4 commits August 20, 2026 17:24
Public half of the GitHub App integration (serverless-agents-ws work 010):

- @opencomputer/agent: githubApp({ permissions }) credential reference for
  defineConnection headers. Permissions are required, validated against the
  supported key set (contents, pull_requests, issues, metadata, checks) with
  read-only keys enforced; valid only on GitHub API origins. The connection
  headers type widens to include the reference.
- CLI: the static connection-header parser accepts githubApp() with an
  inline object-literal permissions argument (variables/spreads are rejected
  with a targeted error), the bundled authoring shim gains the same helper,
  and the compiled manifest carries {kind: "github_app", permissions}. The
  secrets origin inference and secret-set flows now skip non-secret header
  kinds. New commands: `opencomputer github status|connect`. `opencomputer
  dev` warns once when compiled code uses githubApp() but the development
  environment has no GitHub connection, pointing at the connect flow.
- api-edge: explicit allowlist entries for the project GitHub management
  routes, and an unauthenticated public surface for the two browser
  callbacks and the App webhook ingress, forwarded to the private edge which
  authorizes them by one-time state / HMAC. The public origin is what gets
  baked into GitHub app manifests — never the private hostname.

Compiler tests cover the literal-permissions manifest output and the
non-literal rejection; agent/cli/api-edge type-checks and suites green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ting

Mirrors the OC_V3_KEY pattern: with OC_MANAGED_TARGET set, Vite forwards
/api/managed-agents/* to a local `wrangler dev` of the private edge as
/v1/*, which in development mode accepts unauthenticated requests as the
local account. GitHub browser callbacks ride the same rewrite, so the
dedicated-app manifest flow round-trips through real GitHub against
localhost.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Project-level dashboard surface for the GitHub App integration (work 010
J1–J4): per-environment connection status with the full state model
(not_connected / connected / auth_required / app_suspended / app_deleted /
unavailable — the last renders a Retry with retained selections, never a
reconnect prompt or an empty grant), the shared-OC-app install flow, an
attach-existing installation picker, the dedicated-app manifest wizard
(SlackWizard step pattern; form-POSTs the manifest to GitHub in a new tab
and detects completion as a transition from a baselined attachment), and
the all/selected scope editor with dormant no-longer-granted selections
visibly retained, truncation warned once, and mode semantics (install-wide
token vs per-id mint) stated inline. Scope logic re-derived namespaced in
github-scope.ts rather than importing the other product's
repository-access module. App management: webhook-secret and private-key
re-entry, delete, Configure-on-GitHub deep link.

Typecheck, build, and 189 web tests green; scope logic unit-tested
(dormant retention, truncation-omission never classified as revoked).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cookie auth can't bridge localhost to the prod edge, but the vite proxy can
attach an existing prod oc_session server-side — same pattern as OC_V3_KEY,
the value never enters the browser bundle. Lets the dashboard shell run
against prod while managed-agents traffic goes wherever OC_MANAGED_TARGET
points.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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