Codumentor logo Codumentor Enterprise

SCM Push Plugin

The scm_push plugin lets the agent make real commits inside the credential-free sandbox with plain git commit in its shell, authored as the user. Those commits stay in the conversation's workspace overlay until a person clicks Push in the UI. The host-side push gateway then transports them using credentials the sandbox and the agent never see.

Requires Workspace Isolation and User Secrets.

Configuration

plugins:
  - module: codumentor.plugins.scm_push
    class: ScmPushPlugin
    priority: 25
    dependencies: ["workspace_isolation", "user_secrets"]
    args:
      enabled: true
OptionTypeDefaultDescription
enabledbooltrueEnable or disable the plugin.

Every agent commit message gets a Made with Codumentor. line after a blank line, added by a commit-msg hook in the session HOME — unless the message already carries the signature, in which case it is left as is (the check ignores the trailing dot). A user's own ! commits get no signature. Lines starting with # count as message text when git keeps them (-m, -F, --no-edit, or commit.cleanup set to verbatim/whitespace/scissors), so the signature goes at the end. When git strips them (an editor was opened, or commit.cleanup=strip), it goes after the last real line. A --cleanup= option on the command line is invisible to the hook.

Placement versus trailers: when the message ends with a trailer block (Key: value lines with a blank line above, as the goals and memory writers produce), the signature goes before that block. A non-trailer line after a trailer block makes git's %(trailers) and git interpret-trailers discard the whole block, which would hide provenance such as the teach flow's Verification: label from every later reader. The hook detects the block with git's line rules (Token: value lines and indented continuations; a kept # comment line after the block means git reads no trailers there anyway, so the signature stays at the end).

Session git setup

At the start of every turn (onContextReady), the plugin writes into the session HOME (ctx["workspace_home"], see session_git.py):

Limits:

What users do

  1. The agent commits with git commit in its shell (or the user does, with a ! command). Commits land in this session's overlay only — they are not pushed. The plugin notices every shell run that moved a repository's HEAD (commit_watch.py), pins the workspace and emits plugin.scm_push.committed.
  2. The Push button in the chat header lights up.
  3. The user confirms the repo, branch, and SHA. Push runs on the host, never as an agent tool.

Bind a host-only push secret (HTTPS token or SSH key) in Settings → SCM Push, scoped to a repo (or glob), remote URL, and optional branch patterns. SSH bindings can also pin a host public key.

Until that binding exists — or while the secret it names is still empty — the dialog says so and its Push button stays disabled, so a missing credential is read before it is discovered. Readiness is answered by user_secrets' secret_store.has_host_secret, which reports only whether a value is set; the value itself is still read once, host-side, at push time.

Reviewing the changes

The dialog shows uncommitted work and pending commits for each repository. Review changes loads a per-file diff:

Uncommitted work is read from the conversation's own workspace, so it stays visible after a server restart or a session eviction: the dormant overlay is re-mounted read-only (writes discarded) to ask git what changed. When even that is impossible — no bwrap, or the workspace is gone — the dialog says the changes are unknown rather than reporting none, and sending any message reactivates the workspace.

When the target branch has moved on

Before the push is attempted, the dialog asks the remote what the target branch currently holds. If somebody else pushed to it while the session worked, it says so up front rather than letting a rejected push be the way you find out, and offers two ways forward:

The merge happens host-side in a throwaway git directory: nothing is fetched into the session's workspace, no credential ever enters the sandbox, and the result is an ordinary fast-forward — the gateway has no force of any kind and never rewrites what is already on the remote. The merge commit is the one commit Codumentor's server authors rather than transports; it is stamped with your commit identity and recorded in the push history under its own label ("Merged & pushed").

Merging is offered only while the conversation's workspace is readable. For a dormant conversation whose workspace has been swept, the branch-of-its-own remains available.

Commit identity (session commits vs auto-commit)

Commits made in a sandbox shell carry the user's identity from Settings → SCM Push. The identity is resolved once per turn in this order:

  1. Settings → SCM Push — per-user name/email (the form pre-fills from the auth profile).
  2. Authenticated profile — display name and email, when available.
  3. The host's git config — user.name / user.email, used only when both are set. This covers surfaces with no authenticated user (the TUI, unattended runs).
  4. Fallback — "Codumentor (identity unset)" <codumentor@localhost>. Commits are never blocked on a missing identity.

A merge commit the push dialog builds host-side resolves the same order against the repository's own git config (identity.resolve_commit_identity).

This is not workspace isolation's integration.auto_commit. Auto-commit runs after an isolated subagent finishes and uses a generic "Codumentor" <codumentor@local> identity. It does not push and does not use the user's SCM Push identity.

Push history

The Push dialog includes the authenticated user's recent push operations, including pushes from earlier conversations and after a page reload. Entries are newest first and the dialog loads the last 10 operations (the API accepts a limit of 1–100, default 50).

The history sits in a disclosure that is closed by default and is loaded lazily: the /audit request is made only the first time the user opens it, so opening the dialog costs nothing until the history is actually wanted. The open state is recorded on the element, so a re-render (a commit landing, a turn ending) does not snap it shut. After a successful push the list is refreshed only if it is already open; otherwise the first open fetches it fresh, including the just-completed operation.

History is user-scoped; it is not limited to the currently selected conversation. Each operation is one row showing the repository, target branch, the resulting commit SHA, a commit count, the result, and a timestamp. Expanding a row reveals the list of commits that operation carried — each as an abbreviated SHA and subject — and, for a failed attempt, the bounded Git failure detail. The commit list is captured at push time (the set base..expected_head would transport, using the same effective-base computation as the pending-commit preview) and recorded on the audit row, because the push watermark is overwritten on success and the range cannot be reconstructed afterwards. A failed attempt records the set it tried to push; the row's result is what tells you whether it landed. A reconcile push records the session's own work as its commit list while keeping the host-authored merge commit as the row's resulting SHA.

Rows written before the commit list was recorded (and any operation whose range could not be resolved) show no commit list and no count, rather than implying zero commits. Remote URLs, credential names, and credential values are not exposed in the history response.

The pending-commit badge remains conversation-specific: a history entry does not mean that the current conversation has work waiting to be pushed.

Notes