fix: attach_command from one builder, no kill/start_command, row-less stop, one herdr name rule, registry format 2 (Issue #71) #73

Merged
Godopu merged 15 commits from fix/issue-71 into main 2026-10-26 22:28:51 +00:00
Showing only changes of commit 5cd72d2df3 - Show all commits
+13 -3
View File
@@ -37,15 +37,25 @@ AGENT_SESSIONS_YAML="${AGENT_SESSIONS_YAML:-$WORKSPACE_ROOT/.mam/agent-sessions.
# (Issue #71). The herdr shim gets this same definition: _init_herdr_isolation # (Issue #71). The herdr shim gets this same definition: _init_herdr_isolation
# writes it in with `declare -f`. A long name needs its SHA-1 suffix; with no # writes it in with `declare -f`. A long name needs its SHA-1 suffix; with no
# shasum, sha1sum, openssl or python3 to make it, this fails (stderr, nonzero) # shasum, sha1sum, openssl or python3 to make it, this fails (stderr, nonzero)
# rather than return a name herdr never registered. # rather than return a name herdr never registered. A name that is not ASCII
# is lowercased and replaced by python3 (tr/sed differ from str.lower() there),
# and fails the same way without it.
_sanitize_herdr_agent_name() { _sanitize_herdr_agent_name() {
local n="$1" local n="$1"
if [ -z "$n" ]; then if [ -z "$n" ]; then
printf 'agent\n' printf 'agent\n'
return 0 return 0
fi fi
local s local s=""
s=$(echo "$n" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9_-]/-/g') if [ -z "$(printf '%s' "$n" | LC_ALL=C tr -d '\000-\177')" ]; then
s=$(printf '%s' "$n" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9_-]/-/g')
elif command -v python3 >/dev/null 2>&1; then
s=$(python3 -c 'import re,sys; sys.stdout.write(re.sub(r"[^a-z0-9_-]", "-", sys.argv[1].lower()))' "$n") || s=""
fi
if [ -z "$s" ]; then
echo "ERROR: cannot make the herdr name of '$n': it is not ASCII and there is no python3 to convert it" >&2
return 1
fi
if [[ ! "$s" =~ ^[a-z] ]]; then s="x-$s"; fi if [[ ! "$s" =~ ^[a-z] ]]; then s="x-$s"; fi
if [ "${#s}" -gt 32 ]; then if [ "${#s}" -gt 32 ]; then
local h="" local h=""