Skip to content

feat(safety): refuse-hookless requires a hook covering AUTO->FAULT (closes #232) - #238

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/232-refuse-hookless-require-fault-hook
Jul 30, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/232-refuse-hookless-require-fault-hook

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Follow-up to the refuse-hookless AUTO gate (#231, F3 deferral). Strengthens the gate so it's satisfied only by a safe-state hook that actually fires on the AUTO->FAULT transition — not just any declared hook.

The gap

evaluate_hookless_auto_gate previously lifted its refusal when any mode_transition_hook was declared. A config declaring only a non-FAULT hook (e.g. AUTO->MANUAL) passed the gate but had no autonomous safe-state path on a fault — a behavior-tree fault could leave actuators at their last-commanded values.

The fix

The predicate now requires a declared hook (in either transition list) that covers AUTO->FAULT:

  • from matches AUTO (AUTO / "*" / omitted) AND to matches FAULT (FAULT / "*" / omitted).

This exactly mirrors the runtime's two-filter dispatch (hook_mode_matches(from, prev) && hook_mode_matches(to, next)). A hook covering only AUTO->MANUAL, or an IDLE->FAULT hook that never fires from AUTO, no longer satisfies the gate.

⚠️ The from dimension was a review catch: the first pass checked only to, so {from: IDLE, to: FAULT} would have false-satisfied the gate while never firing on AUTO->FAULT. Fixed + covered by tests before this PR.

Blast radius: none

  • bioreactor-v1 automation.yaml + full.yaml use from: "*" to: FAULT → satisfy the stricter gate. Demo unaffected.
  • Every in-repo AUTO-entering fixture (automation_suite.py, test_scenarios.py) declares a to: FAULT hook with wildcard from.
  • Out-of-repo: mixed-bus-dev (anolis-projects, a mock/dev fixture no test loads) would be refused AUTO if it enabled automation with actuators — follow-up there if AUTO is ever needed on it, not bundled here.

Verified

Unit 415/415 (7 new ActuationGateTest cases incl. from: IDLE→refused, from: AUTO→allowed, and one that fails against the old predicate); 16 refuse/auto integration tests (confirms the mode_transition_hooks message substring holds + AUTO-passing fixtures still enter AUTO); builds both ANOLIS_ENABLE_AUTOMATION ON and OFF; clang-format / clang-tidy / ruff / mypy clean. Adversarially reviewed (dispatch-semantics mirroring) — the review found the from gap; re-reviewed clean after fix.

Closes #232

The refuse-hookless AUTO gate (#231) previously lifted its refusal when ANY
mode_transition_hook was declared. A config declaring only a non-FAULT hook
(e.g. AUTO->MANUAL) passed the gate but had no autonomous safe-state path on a
fault — so a behavior-tree fault could leave actuators at their last-commanded
values.

Strengthen the predicate: the gate is satisfied only by a declared hook that
actually fires on the AUTO->FAULT transition — `from` matching AUTO (AUTO/"*"/
omitted) AND `to` matching FAULT (FAULT/"*"/omitted), in either the before- or
after-transition list. This mirrors the runtime's two-filter hook dispatch
(hook_mode_matches(from, prev) && hook_mode_matches(to, next)): a hook covering
only AUTO->MANUAL, or an IDLE->FAULT hook that never fires from AUTO, no longer
satisfies the gate. Message reworded to name the AUTO->FAULT requirement (keeps
the mode_transition_hooks token the integration test asserts); the fail-closed
actuating-output enumeration is unchanged.

No behavior change for configs whose safe-state hook already covers AUTO->FAULT
(incl. the canonical bioreactor-v1 automation/full variants, which use a "*"
from). Pure runtime predicate; actuation_gate.cpp stays automation-namespace-free
and builds ON and OFF.

Closes #232
@CameronBrooks11
CameronBrooks11 merged commit 3821be7 into main Jul 30, 2026
25 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/232-refuse-hookless-require-fault-hook branch August 3, 2026 15:51
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.

Refuse-hookless: require a safe-state hook that targets FAULT (not just any hook)

1 participant