Skip to content

The agent that grows with you

fix(activate): key the re-source guard on the deactivate function, not the inherited sentinel

ethernet02e34712d256
diff --git a/activate b/activate
index 74b4af8b801..b9329ac1e55 100755
--- a/activate
+++ b/activate
@@ -23,8 +23,10 @@ if ! (
fi
# Guard against double-sourcing: venv activate precedent (re-activating is a
-# no-op re-save; we keep it idempotent by deactivating first).
-if [ -n "${__HERMES_ACTIVATED:-}" ]; then
+# no-op re-save; we keep it idempotent by deactivating first). Key on the
+# function, not the sentinel: child shells inherit __HERMES_ACTIVATED from an
+# activated parent but never the function, and there is nothing to undo there.
+if [ "$(type -t deactivate 2>/dev/null)" = "function" ]; then
deactivate
fi