fix: qualify bare external attach names with their rig

This commit is contained in:
dev-guard committed 2026-11-07 05:24:01 +00:00
1 parent b7959ae53f
commit 59417bb47f
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@ export function attachCommand(depsOverride?: StatusDeps): Command {
.option("--member <name>", "Member name for pod attach mode")
.option("--runtime <runtime>", "Runtime for pod attach mode; optional guard for node mode")
.option("--cwd <path>", "Working directory to record", process.cwd())
.option("--display-name <name>", "Display label inside tmux; external session name outside tmux")
.option("--display-name <name>", "Display label inside tmux; external session address outside tmux (bare names gain @rig)")
.option("--print-env", "Print shell exports for OPENRIG_NODE_ID and OPENRIG_SESSION_NAME")
.option("--json", "JSON output, including the activity env the attached app needs. Its token is a credential: don't print or paste it, and use rig whoami for identity")
.action(async (opts: {
@@ -343,9 +343,10 @@ export class SelfAttachService {
return context;
}
const explicit = context?.attachmentType === "external_cli" ? context.sessionName?.trim() : displayName?.trim();
const sessionName = explicit || logicalId.replace(/\./g, "-");
return {
attachmentType: "external_cli",
sessionName: explicit || `${logicalId.replace(/\./g, "-")}@${rigName}`,
sessionName: sessionName.includes("@") ? sessionName : `${sessionName}@${rigName}`,
};
}