Skip to content

Improvement: provision git author identity in sandbox sessions #2586

Closed

Description

@larryro

What should be improved?

Sandbox sessions provision git credentials but never git identity. An external agent can clone, fetch, and push on its session grant, yet its first git commit fails with Author identity unknown unless identity happens to exist in container-local state — which does not survive sandbox recreation (HOME is ephemeral; only the /user volume persists).

Current behavior

  • services/platform/convex/node_only/sandbox/session_credentials.ts:128-130 injects exactly one config pair via env — GIT_CONFIG_KEY_0=credential.helper → /usr/local/bin/tale-git-credential — when a git grant is present. Credentials only.
  • No other layer writes identity: no git config in the runtime image or its entrypoints/daemon (services/sandbox-runtime/), no ~/.gitconfig in a fresh container, no GIT_AUTHOR_* env.
  • Observed live while an agent authored feat(platform): let external agents call granted workspace tools #2585: git commit → fatal: unable to auto-detect email address / "Author identity unknown"; the agent had to infer an identity from git log and hand-set repo-local config.
  • Side effect: Claude Code's Git user: context line (rendered from git config user.name at conversation start) shows a stale value from an earlier container incarnation — or nothing — instead of a provisioned fact.

Proposed change

Inject the session owner's identity at the same point the credential helper is injected — two more GIT_CONFIG_* pairs resolved from the platform user who owns the session:

GIT_CONFIG_COUNT=3
GIT_CONFIG_KEY_1=user.name    GIT_CONFIG_VALUE_1=<owner name/login>
GIT_CONFIG_KEY_2=user.email   GIT_CONFIG_VALUE_2=<owner email>

Env-injected like the helper, so it needs no in-session git config exec, survives container recreation deterministically, and never touches the persistent volume. Plausibly gated on the same git.length > 0 condition; always-on is also defensible so the CLI's Git user: line is deterministic even without a git grant.

Affected service

Sandbox (injection code lives in the platform service: convex/node_only/sandbox/session_credentials.ts).

Acceptance criteria

  • A fresh sandbox session with a git grant can git commit with no manual git config; the author is the session owner's platform identity.
  • Identity survives sandbox stop/recreate (per-session env, not container state).
  • Claude Code's Git user: context line reflects the injected identity in a fresh container.
  • Covered by a test beside the existing credential-helper injection coverage for session_credentials.ts.

Related: #2585 (PR whose authoring hit this gap).

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions