Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

docs: document git commit signing requirement in cloud-agent sandbox (#59435)

inkeep[bot]bbbb4c3454ac
diff --git a/docs/internal/sandboxes-setup-guide.md b/docs/internal/sandboxes-setup-guide.md
index d16ed03e2f7e..a7f59c7f9e91 100644
--- a/docs/internal/sandboxes-setup-guide.md
+++ b/docs/internal/sandboxes-setup-guide.md
@@ -234,17 +234,18 @@ cd /path/to/posthog-code/packages/agent && pnpm build
## Troubleshooting
-| Problem | Solution |
-| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| Docker not running | Start Docker Desktop or the Docker daemon |
-| Temporal not reachable | Ensure Temporal is running on `127.0.0.1:7233`. Check with `temporal server start-dev` |
-| Feature flag not enabled | Re-run `python manage.py setup_background_agents` to (re-)create the `tasks` flag at 100% rollout |
-| Array OAuth app missing | Re-run `python manage.py setup_background_agents` |
-| GitHub token expired | Tokens from GitHub App installations expire after ~1 hour. Re-run the task to get a fresh token |
-| "Task workflow execution blocked" | The `tasks` feature flag is not enabled for this user/org |
-| Sandbox image build fails | Check Docker has enough disk space. Delete old images with `docker system prune` |
-| Agent server health check fails | Check sandbox logs: `docker exec <container_id> cat /tmp/agent-server.log` |
-| `SANDBOX_JWT_PRIVATE_KEY` missing | Re-run `python manage.py setup_background_agents` — it will auto-fill from `.env.example` |
-| Port conflict on sandbox host port | DockerSandbox maps container port 47821 to a dynamic host port. Check sandbox logs or TaskRun state for the assigned port; if another process uses it, stop that process or restart Docker |
-| Sandbox can't reach PostHog API | Don't set `SANDBOX_API_URL` with Docker — auto-transform handles it. If overriding, use port 8000, not 8010 (Caddy returns empty responses from inside Docker) |
-| `DEBUG` not set | `SANDBOX_PROVIDER=docker` requires `DEBUG=1`. Re-run `python manage.py setup_background_agents` to write it |
+| Problem | Solution |
+| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Docker not running | Start Docker Desktop or the Docker daemon |
+| Temporal not reachable | Ensure Temporal is running on `127.0.0.1:7233`. Check with `temporal server start-dev` |
+| Feature flag not enabled | Re-run `python manage.py setup_background_agents` to (re-)create the `tasks` flag at 100% rollout |
+| Array OAuth app missing | Re-run `python manage.py setup_background_agents` |
+| GitHub token expired | Tokens from GitHub App installations expire after ~1 hour. Re-run the task to get a fresh token |
+| "Task workflow execution blocked" | The `tasks` feature flag is not enabled for this user/org |
+| Sandbox image build fails | Check Docker has enough disk space. Delete old images with `docker system prune` |
+| Agent server health check fails | Check sandbox logs: `docker exec <container_id> cat /tmp/agent-server.log` |
+| `SANDBOX_JWT_PRIVATE_KEY` missing | Re-run `python manage.py setup_background_agents` — it will auto-fill from `.env.example` |
+| Port conflict on sandbox host port | DockerSandbox maps container port 47821 to a dynamic host port. Check sandbox logs or TaskRun state for the assigned port; if another process uses it, stop that process or restart Docker |
+| Sandbox can't reach PostHog API | Don't set `SANDBOX_API_URL` with Docker — auto-transform handles it. If overriding, use port 8000, not 8010 (Caddy returns empty responses from inside Docker) |
+| `DEBUG` not set | `SANDBOX_PROVIDER=docker` requires `DEBUG=1`. Re-run `python manage.py setup_background_agents` to write it |
+| `git commit is disabled in PostHog Code` | A PATH shim (`git-guard.sh` at `/opt/posthog/bin/git`) blocks `git commit` and `git push` so unsigned commits can't leave the sandbox. Stage changes with `git add`, then use the `git_signed_commit` tool. To bypass during debugging, set `POSTHOG_ALLOW_UNSIGNED_GIT=1` |
diff --git a/docs/published/handbook/engineering/ai/sandboxed-agents.md b/docs/published/handbook/engineering/ai/sandboxed-agents.md
index 7851e6aefed1..4bda57fcd342 100644
--- a/docs/published/handbook/engineering/ai/sandboxed-agents.md
+++ b/docs/published/handbook/engineering/ai/sandboxed-agents.md
@@ -233,9 +233,24 @@ They can:
- Read, write, and execute files in the cloned repository
- Install dependencies (npm, pip, etc.)
- Run tests, linters, and build tools
-- Create git branches, commits, and pull requests
+- Create git branches and pull requests (commits must be signed — see below)
- Execute arbitrary shell commands within the container
+### Git commit signing
+
+Direct `git commit` and `git push` commands are blocked in the sandbox to ensure all commits are properly signed by GitHub. A PATH shim (`git-guard.sh` at `/opt/posthog/bin/git`) intercepts these subcommands while passing all other git operations through to the real binary.
+
+If an agent attempts to run `git commit` or `git push`, it will see:
+
+```text
+git commit is disabled in PostHog Code: commits must be signed.
+Stage changes with 'git add', then call the git_signed_commit tool.
+```
+
+Agents should stage changes with `git add`, then use the `git_signed_commit` tool to create signed commits.
+
+**Debugging escape hatch**: Set `POSTHOG_ALLOW_UNSIGNED_GIT=1` in the sandbox environment to bypass this restriction. This is intended for debugging only and should not be used in production.
+
### Sandbox isolation
| | Production (Modal) | Local dev (Docker) |