Oblive Docs
Extend Integrations

Native Git Gateway

Maintain Engineering Git transport, capability exchange, smart HTTP proxying, staged pushes, and enforcement boundaries.

Native Git is an Engineering repository transport layered on the existing GitHub integration. It is not another control-plane CLI and does not replace the GitHub MCP.

Ownership Flow

GitHub integration ID in the task manifest
→ backend authorization and native-Git resolution
→ short-lived integration gateway capability
→ per-run Git URL and header configuration
→ internal smart-HTTP gateway
→ fixed GitHub.com HTTPS origin with the backend-held PAT
  • The Git catalog owns the GitHub integration’s profile grants, authentication contract, and setup guidance.
  • The backend owns authorization, credential decryption, GitHub origin selection, request validation, actions, and staged push bytes.
  • The agent adapter owns ephemeral Git configuration for the active run only.
  • GitHub owns repository graph rules and protected-branch enforcement.

The PAT must never enter the agent process, workspace, remote URL, command line, or logs.

Runtime Resolution

managedIntegrationRuntimes.github.nativeGit.profileKeys grants native Git only to Engineering. Immediately before harness startup, the backend revalidates the organization, profile, integration, credential, access mode, task mode, authorization epoch, and task version.

The adapter configures Git through session-local GIT_CONFIG_* values:

  • rewrite https://github.com/ to the scoped internal gateway;
  • attach the short-lived gateway capability as an HTTP header; and
  • disable interactive credential prompting.

The repository retains its ordinary GitHub HTTPS remote. Do not persist the rewritten gateway URL or mutate shared Git configuration.

Access Matrix

OperationProfileRun Kind and ModePermission Mode
Upload-pack advertisement and RPCEngineeringTask in plan, execute, research, or reviewAny
Receive-pack advertisement and RPCEngineeringTask in executeAsk before writes or Autonomous
Any Git transportAny other profile, chat, or verifyAnyRejected

Internal Routes

Keep the route namespace transport-first, parallel to the MCP and CLI gateways:

MethodRoutePurpose
GET/internal/git/integrations/:integrationId/:owner/:repository/info/refsAdvertise upload-pack or receive-pack.
POST/internal/git/integrations/:integrationId/:owner/:repository/git-upload-packStream a bounded repository read.
POST/internal/git/integrations/:integrationId/:owner/:repository/git-receive-packValidate, stage, and propose or execute a branch push.

Do not move these endpoints under /internal/integrations/git. The transport owns the protocol handler and the integration ID is its scoped resource.

The gateway builds only https://github.com/<owner>/<repository>.git, forwards reviewed headers, uses manual redirect handling, and never accepts an arbitrary upstream URL.

Receive-pack Action Flow

  1. Accept at most 100 MiB.
  2. Parse the packet-line command section before staging.
  3. Accept at most 20 unique refs/heads/* updates.
  4. Reject tags, deletions, invalid or duplicate refs, later capability declarations, and push options.
  5. Hash the complete request and stage it privately under a backend-derived organization/run/integration/SHA-256 key.
  6. Persist only bounded typed action metadata; never persist an agent-selected object key or pack bytes in action JSON.
  7. Revalidate authorization, content type, size, and hash immediately before execution.
  8. Stream the staged request once to GitHub and bound the response to 1 MiB.
  9. Return GitHub’s exact report-status bytes to Git.
  10. Remove staged bytes after success, rejection, reconciliation, or terminal preparation failure.

Approval-required and unknown actions are rendered as valid Git report-status failures containing the exact action ID. The Engineering skill follows task-runtime by preserving its disposable source handoff, submitting action_interrupt, and stopping without retry.

Force-push Boundary

The receive-pack command contains the old object ID, new object ID, and ref. It does not identify whether the client supplied --force or --force-with-lease.

Therefore:

  • the Engineering skill instructionally prohibits force flags and history rewriting;
  • the gateway mechanically rejects tags, deletions, unsupported refs, and push options; and
  • GitHub branch protection or rulesets provide hard graph-aware non-fast-forward enforcement.

Do not add backend repository clones or commit-graph evaluation without a new product requirement that justifies the operational and storage cost.

Change Checklist

When changing this transport:

  1. Update shared runtime/action types before app consumers.
  2. Keep gateway authorization and GitHub origin selection backend-owned.
  3. Keep object keys canonical in @oblive/objectstore.
  4. Preserve protocol-native Git responses for approval, reconciliation, and upstream results.
  5. Update the Engineering skill, GitHub setup guidance, OpenAPI, user documentation, architecture references, and this guide together.
  6. Test runtime configuration, access modes, header sanitization, ref parsing, size bounds, private staging, action execution, cleanup, approval, unknown outcomes, and redirects.

Verification

bun test apps/agents/tests/codex.adapter.test.ts
bun test apps/backend/tests/services/git-gateway.service.test.ts
bun test apps/backend/tests/routes/integration-gateway.route.test.ts
bun test packages/agent-packs/tests/catalog.test.ts
bun run check:all