Skip to content

stop the gate demanding what a session cannot do - #36

Merged
ayushcodes10 merged 1 commit into
mainfrom
fix/stop-gate-must-be-satisfiable
Sep 2, 2026
Merged

stop the gate demanding what a session cannot do#36
ayushcodes10 merged 1 commit into
mainfrom
fix/stop-gate-must-be-satisfiable

Conversation

@ayushcodes10

Copy link
Copy Markdown
Owner

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_active never bounded anything

I 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-memory pending --done <paths>

echo-memory is not on PATH for 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 returns command not found.

It now prints the hook's own ECHO_MEMORY_BIN, falling back to the bare name only when argv[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_episode in 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

  • 401 pass, 6 added — including one that fires the gate twice for the same session id and asserts silence the second time
  • migration 0010 verified to apply and reverse standalone
  • the pytest-argv[0] fallback is pinned by its own test

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.
@ayushcodes10
ayushcodes10 merged commit bd3f475 into main Sep 2, 2026
2 checks passed
@ayushcodes10
ayushcodes10 deleted the fix/stop-gate-must-be-satisfiable branch September 2, 2026 08:50
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant