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
| Option | Type | Default | Description |
|---|---|---|---|
enabled | bool | true | Enable 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):
~/.config/git/config— the user's commit identity (user.name/user.email),core.hooksPath, and the signature.~/.config/codumentor/git-hooks/— thecommit-msghook that adds the signature, plus pass-through scripts so a repository's own.git/hooks/*still run.
Limits:
- No session HOME, no setup. Only workspace isolation with
persistent_home: true(the default) provides one (ctx["workspace_home"]). Withpersistent_home: false, underlight_sandbox, or with no isolation at all, nothing is written: shell commits get no user identity and no signature, only whatever git finds in the sandbox. The Windows AppContainer sandbox HOME gets the host's git identity (sandbox/backends/windows_appcontainer.py), not the user's. - The repository's own
core.hooksPathwins. It is set in.git/config(husky, for example) and overrides the session config, so the signature hook never runs.git commit --no-verify/-nalso skips it. - Inherited git config locations bypass the file. An env mode that passes the host's
XDG_CONFIG_HOMEorGIT_CONFIG_GLOBALinto the sandbox makes git read a different global config. Examples:env_mode: inherit_all, or either variable listed ininherit_env_varsor set by a project'ssandbox.env. Identity, hooks path and signature are then all lost. - A repo-local identity wins. A
user.name/user.emailin the checkout's own.git/configoverrides the session identity.
What users do
- The agent commits with
git commitin 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 emitsplugin.scm_push.committed. - The Push button in the chat header lights up.
- 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:
- Each file is a disclosure — fold a long one away to reach the ones under it; Collapse all / Expand all does the lot. Folds survive the dialog's re-renders (a commit landing, a turn ending).
- A file's diff scrolls inside its own box, so the horizontal scrollbar stays beside the long line instead of below the whole file, and add/delete highlights span the full scrolled line.
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:
- Push to a branch of its own — one click fills in a free branch name. This always works, and it is what to reach for when in doubt.
- Merge the remote branch into this work and push the merge — two clicks, deliberately. The first computes the merge on the server and shows exactly what it would add to the branch; only then does a separate Merge and push appear. If the merge conflicts, the conflicting files are named and no push is offered at all.
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:
- Settings → SCM Push — per-user name/email (the form pre-fills from the auth profile).
- Authenticated profile — display name and email, when available.
- 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). - 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
- There is no commit tool: committing is ordinary
git commitin the shell, approved like any other shell command. A commit the user requested from the Push dialog (Commit, the merge hand-off) runs as thescm_push.commitcommand, whose turn maygit add/git commitwithout asking. - Nothing in the sandbox pushes. Push is host-side, triggered by the UI, using a host-only secret.
- Publishing is an access feature (
access_features.PUBLISH, dependent on thescm_publishnon-tool permission). A profile whose policy denies it —permissions: chat_only, the closedqa_readonly— is not sent the Push widget;/pending-commits,/pending-commits-batch,/diff,/remote-state,/push,/reconcile-preview,/reconcile-pushand/sync-workspaceanswer an audited 403 (after the 404 ownership check);/conversation-statusanswers "nothing pending"; thescm_push.commitcommand requiresscm_publish; and the workflow note is not injected. The button hides itself if the batch answers 403./working-diff,/abort-sync-merge,/auditand/settingspublish nothing and stay open.permissions: {preset: chat_only, allow: [scm_publish]}restores publishing admission, subject to scope prerequisites and strict run restrictions. See Access profiles. - A main agent that holds
shell(not pruned by a goal worker's denial or the access profile) and may publish, in a workspace with at least one git checkout also gets a static[Commits and Push]context note (workflow_note.py): commit withgit commitin the shell onto the private session branch, never create/switch/rebase branches, the base branch comes from the Branch Selector of a new conversation, and only the user's Push sends commits — fast-forward only, to the configured remote (or the credential's remote URL), onto a target branch the dialog suggests and the user can edit. It also forbids sending the user togit pushfrom their machine or handing over patches instead. An unattended run (ui_type: unattended— scheduled runs, triggers, goal-worker ticks, PR reviews) gets a short variant instead: commit withgit commitin the shell, leave branches alone, nobody pushes during the run, and a user can Push later from the conversation. - After a commit (any shell run that moved HEAD), the session workspace is pinned against TTL cleanup so unpushed commits survive eviction until they are pushed (or the pin is released).
- Uncommitted work is not pinned — nothing would release such a pin, so the workspace would never be reclaimed. It survives on the ordinary 30-day
upper_dir_ttlinstead, which is why the dialog now surfaces it after a restart rather than waiting to be asked.