Skip to content

An open-source, faster Devin alternative

TypeScript

docs(repos): add "How it works" with a per-operation flow diagram

Igor Zalutski53575ca30912
diff --git a/docs/agent-sessions/repos.mdx b/docs/agent-sessions/repos.mdx
index 4a5963fd..25c52f61 100644
--- a/docs/agent-sessions/repos.mdx
+++ b/docs/agent-sessions/repos.mdx
@@ -34,6 +34,65 @@ GitHub uses GitHub Apps as its auth surface. Other providers can add their own a
surface while sessions continue to reference repos and sources the same way.
</Note>
+## How it works
+
+Every authenticated Git operation runs in its own **Git operations sandbox** — a minimal
+box with `git` and nothing else, provisioned for that one operation and destroyed when it
+finishes. The agent's sandbox is never one of these: it never holds a token and never runs
+authenticated `git` or `gh`. Files and patches move between the two through object storage,
+never next to a credential.
+
+```mermaid
+sequenceDiagram
+ participant Agent as Agent sandbox
+ participant CP as Control plane
+ participant Git as Git operations sandbox
+ participant Store as Object storage
+ participant GH as GitHub
+
+ Note over CP,GH: Checkout — before the first turn
+ CP->>Git: Provision for one operation
+ CP->>GH: Mint just-in-time token (read-only, one repo)
+ CP->>Git: Inject token into this box's env only
+ Git->>GH: Clone at the pinned sha
+ Git->>Store: Write files (no .git, no token)
+ Note over Git: Destroyed — token gone
+ Store->>Agent: Extract into the source path
+
+ Note over Agent,GH: Publish — agent calls github_publish_pull_request
+ Agent->>Store: Write a patch (still no token)
+ CP->>Git: Provision a new box
+ CP->>GH: Mint just-in-time token (write-scoped, one repo)
+ Git->>Store: Read the patch
+ Git->>GH: Push an oc/ branch, open the PR
+ Note over Git: Destroyed — token gone
+ GH-->>Agent: PR URL
+```
+
+**Checkout (read), before the first turn:**
+
+1. OpenComputer provisions a fresh Git operations sandbox for the checkout.
+2. The control plane mints a **just-in-time token**: the GitHub App requests an installation
+ token scoped to that one repo with read-only contents permission, and it is injected into
+ the sandbox's environment only — never `.git/config`, the command line, or any log.
+3. The sandbox clones the exact `sha`, then writes the **files** (no `.git`, no remote, no
+ token) to dedicated object storage.
+4. The sandbox is destroyed; the token dies with it.
+5. The agent's sandbox extracts those bytes into `/workspace/sources/<name>`.
+
+**Publish (write), when the agent calls `github_publish_pull_request`:**
+
+1. The agent's sandbox turns its edits into a patch and writes it to object storage. The
+ agent still has no token.
+2. OpenComputer provisions a **new** Git operations sandbox and mints a fresh,
+ **write-scoped** token for that one repo.
+3. The sandbox applies the patch on an `oc/<session>/<source>-<id>` branch, pushes, and
+ opens the PR.
+4. The sandbox is destroyed; the token dies with it. The PR URL is returned to the agent.
+
+The token is minted per operation, scoped to a single repo, lives only inside a box that
+does nothing but Git, and is gone before the next turn.
+
## The OpenComputer GitHub App
In preview, the OpenComputer App is the only GitHub App: OpenComputer owns the App key and