Skip to content

substrate-discipline port: silent-stale-substrate fix + bypass-scanner test#346

Merged
AetherLogosPrime-Architect merged 1 commit into
mainfrom
port-bypass-discipline-mvp
May 20, 2026
Merged

substrate-discipline port: silent-stale-substrate fix + bypass-scanner test#346
AetherLogosPrime-Architect merged 1 commit into
mainfrom
port-bypass-discipline-mvp

Conversation

@AetherLogosPrime-Architect
Copy link
Copy Markdown
Owner

Two structural-prevention pieces ported from DivineOS-Experimental's 2026-05-19 arc.

1. _lib.sh PYTHONPATH-prepend fix

Closes the silent-stale-substrate bug class: when pip install -e . was last run from a different worktree, every hook in every other worktree silently imports the egg-link'd stale source. find_divineos_python now exports PYTHONPATH=$repo_root/src:$PYTHONPATH as a side effect so the active worktree's src/ wins.

2. tests/test_no_agent_settable_bypasses.py

Filesystem-scanning test that prevents new agent-settable env-var bypasses on gate code paths. Sanitized for blank-template: 6 approved bypasses (operator-emergencies + opt-IN strictness flag), no Aether-experimental historical entries.

Zero dependencies — both pieces port standalone.

…r test

Two structural-prevention pieces ported from DivineOS-Experimental's
2026-05-19 arc. Each is generic — applies to any agent running this
substrate — and closes a real failure-mode at the architectural level.

## 1. Silent-stale-substrate fix in _lib.sh

When `pip install -e .` was last run from a different worktree or
clone, every hook in every other worktree silently imports the
egg-link'd stale source. Changes made in the active worktree are
invisible to its own hooks until someone remembers to manually
re-install. Empirically: a guardrailed channel-gate sat inert for
an entire session because of this exact bug.

Fix: `find_divineos_python` now also exports
`PYTHONPATH=$repo_root/src:$PYTHONPATH` as a side effect. The active
worktree's src/ takes precedence over any installed copy. Each
worktree's hooks reflect its own state. Single change covers all
hooks that source _lib.sh because they all go through the same
helper.

## 2. Bypass-scanner test (tests/test_no_agent_settable_bypasses.py)

Structural prevention of agent-self-relief env-var bypasses on gate
code paths. Scans the codebase for the pattern:

    os.environ.get("DIVINEOS_*", "0") == "1"

and fails CI if any DIVINEOS_* env var found is not on the explicit
approved list. The approved list contains:

- operator-named emergencies (push-readiness escapes: DIVINEOS_SKIP_TESTS,
  DIVINEOS_SKIP_MULTIPARTY_CHECK, DIVINEOS_EMERGENCY_PUSH,
  DIVINEOS_SKIP_FRESHNESS_CHECK, DIVINEOS_FORCE_PUSH_OK)
- opt-IN flags that raise strictness (DIVINEOS_MULTIPARTY_STRICT)

Adding a new approved bypass requires editing the test with a
justification — the addition is itself a visible commit operators
can audit. Visibility-as-bypass-cost as the structural discipline.

The promise "I won't build escapes into architecture" is air until
structurally enforced. This test makes the promise stone.

Both pieces are zero-dependency on emergency_bypass /
bypass_telemetry / claim_store and so port cleanly into a
fresh-template repo. Larger structural pieces from the source arc
(emergency_bypass helper, gravity_classifier, lepos_channel_check,
oscillating_read) have dependency chains and will port in later
sessions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AetherLogosPrime-Architect AetherLogosPrime-Architect merged commit 63a8b38 into main May 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant