stop the gate demanding what a session cannot do - #36
Merged
Conversation
An eigen session reported "Ran 5 stop hooks" on 2026-09-02 and spent 27 minutes unable to satisfy any of them. Three separate faults, all mine. stop_hook_active does not bound this. It is set only while a session is CONTINUING from a stop hook; once the agent answers and stops again it is a fresh stop with the flag clear. So "fires once per session" was never enforced. Gated sessions are now recorded in stop_gate_fired (migration 0010) and never gated twice, whatever the flag says. The command in the reason could not run. It printed a bare `echo-memory`, which a virtualenv install does not put on PATH - so the one route that did not need the MCP tool did not work either. It now prints the hook's own ECHO_MEMORY_BIN, and falls back to the literal name only when argv[0] is not this CLI. The gate had no way out. It cannot see the session's tool list, and that session had no write_episode in it. The reason now tells a session that can reach neither the tool nor the CLI to say so in one line and stop, and states that the gate will not fire again for it. An unsatisfiable demand with no stated exit is worse than no gate at all. 401 tests pass, 6 added. Migration 0010 verified to apply and reverse standalone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An eigen session reported "Ran 5 stop hooks" and spent 27 minutes unable to satisfy any of them. Three separate faults, all mine, all in #33.
1.
stop_hook_activenever bounded anythingI claimed "fires once per session" and shipped it as a headline safety property. The flag is set only while a session is continuing from a stop hook — once the agent answers and stops again, it is a fresh stop with the flag clear. The bound was never enforced.
Gated sessions are now recorded in
stop_gate_fired(migration 0010) and never gated twice, whatever the flag says. Inferred bounds don't hold; recorded ones do.2. The command it printed could not run
The reason said:
echo-memoryis not onPATHfor a virtualenv install. So the one route that did not need the MCP tool did not work either — the session was told to run something that returnscommand not found.It now prints the hook's own
ECHO_MEMORY_BIN, falling back to the bare name only whenargv[0]is not this CLI (imported under pytest,argv[0]is the pytest binary — caught by an existing test).3. There was no way out
The gate cannot see the session's tool list, and that session had no
write_episodein it. Blocking achieved nothing and cost real time.The reason now tells a session that can reach neither the tool nor the CLI to say so in one line and stop, and states plainly that the gate will not fire again for it and the files stay queued for a session that can. An unsatisfiable demand with no stated exit is worse than no gate at all.
Testing
argv[0]fallback is pinned by its own test