Files
hermes-agent/tests/scripts
Ben Barclay f09f83088a fix(scope): hold scope, home, secrets and terminal policy as one value
Review found three ways around the guards in the first commit: set_terminal_scope
was unguarded (four production callers), set_secret_scope(None) cleared secrets
alone so get_secret fell back to the launch profile, and a stale or out-of-order
reset token moved one piece back while the others stayed. Guards around three
separate context variables leave every unguarded path able to split them.

The four pieces are now one immutable ScopeState in one context variable. Every
setter is a change to that value; a reset removes its own change and replays the
later ones, dropping those made inside a scope the result no longer has, so any
reset sequence lands on a state whole binds produce. Leaving a hosted agent by
any reset other than the bind that entered it refuses.

- set_terminal_scope narrows a bound local scope's own policy; clearing it, or
  setting it in a hosted scope, refuses. set_secret_scope(None) inside a scope
  refuses.
- bind_profile_scope and bind_state refuse a local bind inside a hosted scope.
- The TUI turn holds one token instead of four; housekeeping still runs under
  the session's whole profile scope and the release resets it at once.
- HX016 sees relative imports and no longer flags a local object named like a
  setter's module.
- The historical updater reads the override through get_hermes_home_override
  when hermes_constants no longer exposes the raw context variable.
2026-11-11 09:44:33 -05:00
..