fix(t3code): run T3 agents as m3ta-chiron on every host

The identity lived in the m3-hermes service and in home-manager session
variables. Neither reaches the T3 desktop app on m3-kratos, so its agents
committed and pushed as m3tam3re. Wrap the T3 packages via an overlay so
everything T3 spawns inherits commit identity and Gitea push auth,
independent of host and launcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
m3ta-chironandClaude Opus 5.5 committed 2026-11-01 13:14:02 +01:00
1 parent a2d226583f
commit d25015bc9d
3 files changed
+80 -30

No files matched your search

+2
View File
@@ -49,6 +49,8 @@
# with allowUnfree). Do NOT flatten to top-level attrs — see # with allowUnfree). Do NOT flatten to top-level attrs — see
# overlays/default.nix. # overlays/default.nix.
inputs.llm-agents.overlays.shared-nixpkgs inputs.llm-agents.overlays.shared-nixpkgs
# Wraps pkgs.llm-agents.t3code* with the agents' m3ta-chiron identity.
outputs.overlays.t3code-agent-identity
# You can also add overlays exported from other flakes: # You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default # neovim-nightly-overlay.overlays.default
+14 -30
View File
@@ -16,12 +16,12 @@
# so no deploy token) into ~/.agents/skills + ~/.config/opencode/*. A # so no deploy token) into ~/.agents/skills + ~/.config/opencode/*. A
# path unit mirrors skills into ~/.claude/skills for Claude Code # path unit mirrors skills into ~/.claude/skills for Claude Code
# (port of m3ta-home profiles/sets/coding/agents/claude-skills.nix). # (port of m3ta-home profiles/sets/coding/agents/claude-skills.nix).
# - Git identity: every harness spawned by `t3 serve` commits as the # - Git identity and Gitea push auth: m3ta-chiron for every harness spawned
# m3ta-chiron bot account — via service env vars, deliberately NOT via # by T3, baked into the package (overlays/default.nix,
# ~/.gitconfig, so m3tam3re's interactive git on this host is untouched. # t3code-agent-identity), so m3tam3re's interactive git is untouched.
# - Gitea SSH: m3tam3re's ssh config pins User gitea + key ~/.ssh/gitea # - Gitea SSH: m3tam3re's ssh config pins User gitea + key ~/.ssh/gitea
# (one-time keygen; pubkey added to the m3ta-chiron account) — covers # (one-time keygen; pubkey added to the m3ta-chiron account) for
# git remotes AND git+ssh:// flake inputs. Host key pinned system-wide. # interactive use and git+ssh:// flake inputs. Host key pinned system-wide.
# #
# One-time interactive steps after deploy (deliberately NOT declarative — # One-time interactive steps after deploy (deliberately NOT declarative —
# subscription auth must live in each harness's own credential store and # subscription auth must live in each harness's own credential store and
@@ -53,16 +53,6 @@
cockpitUser = "m3tam3re"; cockpitUser = "m3tam3re";
cockpitHome = "/home/${cockpitUser}"; cockpitHome = "/home/${cockpitUser}";
# Commit identity of the T3 Code agents: the fleet bot account. Env
# vars are respected by git in every process the service spawns; they
# survive restarts and stay out of m3tam3re's dotfiles.
gitIdentityEnv = {
GIT_AUTHOR_NAME = "m3ta-chiron";
GIT_AUTHOR_EMAIL = "m3ta-chiron@agentmail.to";
GIT_COMMITTER_NAME = "m3ta-chiron";
GIT_COMMITTER_EMAIL = "m3ta-chiron@agentmail.to";
};
# SSH to the private Gitea for the T3 lane. Sits in m3tam3re's ssh # SSH to the private Gitea for the T3 lane. Sits in m3tam3re's ssh
# config (per-user — Hermes' own gitea access via its own ssh config # config (per-user — Hermes' own gitea access via its own ssh config
# is unaffected). URL-embedded users (gitea@code.m3ta.dev) match the # is unaffected). URL-embedded users (gitea@code.m3ta.dev) match the
@@ -135,21 +125,13 @@ in {
RestartSec = "5"; RestartSec = "5";
}; };
environment = environment = {
{ T3CODE_PORT = toString port;
T3CODE_PORT = toString port; # Deterministic service context: HOME explicit so tools resolve ~ in
# Deterministic service context: HOME explicit so ssh/git resolve # every process this service spawns, however deep t3's pty/sandbox
# ~ in every process this service spawns, however deep t3's # chain resets the environment.
# pty/sandbox chain resets the environment. HOME = cockpitHome;
HOME = cockpitHome; };
# Independent of HOME entirely: git uses exactly this ssh config
# (absolute store path) for every gitea remote.
GIT_SSH_COMMAND = "ssh -F ${t3SshConfig}";
# bd falls back to git's user.name for its audit trail, which would
# be m3tam3re here — keep it in line with the commit identity.
BEADS_ACTOR = gitIdentityEnv.GIT_AUTHOR_NAME;
}
// gitIdentityEnv;
# Harness CLIs, git and the issue tracker for the agents T3 Code spawns. # Harness CLIs, git and the issue tracker for the agents T3 Code spawns.
path = with pkgs; [ path = with pkgs; [
@@ -176,6 +158,8 @@ in {
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d ${cockpitHome}/.ssh 0700 ${cockpitUser} users -" "d ${cockpitHome}/.ssh 0700 ${cockpitUser} users -"
"L+ ${cockpitHome}/.ssh/config - - - - ${t3SshConfig}" "L+ ${cockpitHome}/.ssh/config - - - - ${t3SshConfig}"
# The fleet-wide key path the T3 package expects (see t3code-agent-identity).
"L+ ${cockpitHome}/.ssh/m3ta-chiron - - - - ${cockpitHome}/.ssh/gitea"
]; ];
# ── agent-lib v2 client: skills/commands/agents for the harnesses ──── # ── agent-lib v2 client: skills/commands/agents for the harnesses ────
+64
View File
@@ -74,6 +74,70 @@
opencode-desktop = final.llm-agents.opencode2-desktop; opencode-desktop = final.llm-agents.opencode2-desktop;
}; };
# T3 Code agents act as the m3ta-chiron bot on every host. Baked into the
# T3 packages rather than a session or service: everything T3 spawns
# inherits it, however T3 was launched (desktop launcher, systemd, shell),
# and any host installing T3 gets it. Must come AFTER shared-nixpkgs.
#
# Push auth needs ~/.ssh/m3ta-chiron on each host, with its pubkey on the
# m3ta-chiron Gitea account. A missing key fails the push instead of falling
# back to a personal key. Other hosts keep the user's own ssh config.
t3code-agent-identity = final: prev: let
identity = {
name = "m3ta-chiron";
email = "m3ta-chiron@agentmail.to";
};
giteaKnownHosts = final.writeText "gitea-known-hosts" ''
code.m3ta.dev ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFmmqZ4GgDEXJgj8uYrZAr/EoLIA6LJGkTIyKGQD/60a
'';
# ssh expands ~ from passwd, so this does not depend on $HOME.
sshConfig = final.writeText "t3-agent-ssh-config" ''
Host code.m3ta.dev
User gitea
IdentityFile ~/.ssh/m3ta-chiron
IdentitiesOnly yes
UserKnownHostsFile ${giteaKnownHosts}
# Conditional: IdentityFile accumulates across matching blocks, so a
# personal code.m3ta.dev entry must not be read for this host.
Host * !code.m3ta.dev
Include ~/.ssh/config
'';
wrapperArgs = final.lib.concatStringsSep " " (final.lib.mapAttrsToList (name: value: "--set ${name} ${final.lib.escapeShellArg value}") {
GIT_AUTHOR_NAME = identity.name;
GIT_AUTHOR_EMAIL = identity.email;
GIT_COMMITTER_NAME = identity.name;
GIT_COMMITTER_EMAIL = identity.email;
JJ_USER = identity.name;
JJ_EMAIL = identity.email;
# bd otherwise falls back to the user's git user.name for its audit trail.
BEADS_ACTOR = identity.name;
GIT_SSH_COMMAND = "${final.openssh}/bin/ssh -F ${sshConfig}";
});
wrapT3 = package:
final.symlinkJoin {
inherit (package) name meta passthru;
paths = [package];
nativeBuildInputs = [final.makeWrapper];
postBuild = ''
for program in $out/bin/*; do
wrapProgram "$program" ${wrapperArgs}
done
'';
};
in {
llm-agents =
prev.llm-agents
// {
t3code = wrapT3 prev.llm-agents.t3code;
t3code-desktop = wrapT3 prev.llm-agents.t3code-desktop;
};
};
# temp-packages = final: _prev: { # temp-packages = final: _prev: {
# temp = import inputs.nixpkgs-9e9486b { # temp = import inputs.nixpkgs-9e9486b {
# system = final.stdenv.hostPlatform.system; # system = final.stdenv.hostPlatform.system;