Repository navigation
feat(runtime): refuse-hookless — veto AUTO without safe-state hooks - #231
Merged
Merged
Conversation
Guarantee that autonomous actuation cannot start without a declared safe-state path (decision D6). New evaluate_hookless_auto_gate refuses when automation is enabled, at least one discovered function is actuating (fail-closed via registry::is_actuating — any function not explicitly read-only counts), and no mode_transition_hooks are declared. Enforced as a before-mode-change veto in init_automation: any transition into AUTO is refused (FAILED_PRECONDITION -> HTTP 409) when the gate trips. This is the single choke point into AUTO (BT ticks are mode-gated; AUTO is only reachable via set_mode), so the guarantee holds for the process lifetime and re-evaluates against the live registry across provider restarts. Manual control and POST /v0/estop stay available, and FAULT is never blocked. A loud startup ERROR log names the actuating outputs when the config is AUTO-refused. The manual e-stop path (safety.safe_state) deliberately does not satisfy the gate: it fires only on operator /v0/estop, never on autonomous transitions. Automation test fixtures gain a *->FAULT safe-state hook so their AUTO tests still pass; a new integration test asserts AUTO is refused without hooks while manual control remains. Implements the runtime side of anolishq/anolis-workbench#237.
- Document the safe-state-hooks requirement where users hit it: the automation quickstarts in docs/automation.md, docs/getting-started.md, and README.md showed automation enabled against the sim (which has actuators) with no mode_transition_hooks, so following them verbatim now 409s on AUTO (F1). Add the hook example + a pointer to safety.md; also close an unrelated unclosed fence in the README automation block. - Make the CHANGELOG accurate: the gate re-evaluates per MANUAL->AUTO attempt (not continuously during AUTO), and it checks that hooks are declared, not yet that a hook targets FAULT (F2/F3, interim per D6). - Strengthen the integration test to actually issue a manual /v0/call after the AUTO refusal, proving manual control survives (F4). - Add an empty-registry unit case, and use realistic hooks (with a call) in the hook-satisfaction unit tests instead of an empty ModeTransitionHookConfig the loader would reject (F5/F6). The stronger predicate (require a hook whose `to` matches FAULT) and re-checking the gate on an in-AUTO provider restart are noted as follow-ups.
This was referenced Jul 28, 2026
Merged
CameronBrooks11
added a commit
that referenced
this pull request
Jul 30, 2026
Ships the safety spine + health-staleness work that has accumulated on main since v0.1.38: - #228 surface FunctionPolicy category over /v0 capabilities (is_actuating) - #229 POST /v0/estop software safe-state + actuation latch - #230 install.sh --variant selection + verify-inert boot-inert - #231 refuse-hookless: veto MANUAL->AUTO without safe-state hooks - #234 cadence-derived device-liveness staleness (D7 phase 1) - #235 per-signal quality/freshness into health, new FAULT state (D7 phase 2) Bumps CMakeLists project VERSION + vcpkg.json, rolls CHANGELOG [Unreleased] into [0.1.39] (adds the missing phase-2 entry), and updates the runtime_version in the runtime-http contract examples.
CameronBrooks11
added a commit
that referenced
this pull request
Jul 30, 2026
) 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
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Runtime side of anolishq/anolis-workbench#237. Locked decision D6. The last HARD safety-gate item — with #218 (CATEGORY_ACTUATE), #219 (/v0/estop), and #225 (boot-inert) already merged, this completes the gate.
Guarantee
Autonomous actuation cannot start without a declared safe-state path: the runtime refuses
MANUAL -> AUTOwhen automation is enabled with actuating outputs but no safe-statemode_transition_hooks.Change — BLOCK-AUTO (maintainer's choice)
evaluate_hookless_auto_gate(core/runtime/actuation_gate.{hpp,cpp}): refuses iffautomation.enabledAND at least one discovered function is actuating (fail-closed via Surface CATEGORY_ACTUATE over device capabilities #218'sregistry::is_actuating— any function not explicitly read-only) AND nomode_transition_hooksare declared.init_automation: any transition into AUTO is refused (FAILED_PRECONDITION→ HTTP 409) when the gate trips. This is the single choke point into AUTO (BT ticks are mode-gated; AUTO is only reachable viaset_mode), re-evaluated against the live registry on each attempt. Manual control andPOST /v0/estopstay available;FAULTis never blocked. A startup ERROR log names the actuating outputs.safety.safe_statedeliberately does NOT satisfy the gate — it fires only on manual/v0/estop, never on autonomous→FAULT. Onlymode_transition_hookscount.Behavior change
Automation configs with actuating outputs must now declare
mode_transition_hooksto enter AUTO (a config whose functions are all read-only is unaffected). I updated the automation/scenario test fixtures and the doc quickstarts (automation.md, getting-started.md, README) accordingly, and added a note to safety.md.Tests & verification (local)
MANUAL->AUTOreturns 409, and a manual/v0/callstill succeeds (manual control survives). Existing automation/scenario AUTO tests pass with the added*->FAULThook.Adversarial branch review
Verdict SHIP — the reviewer confirmed the predicate, veto semantics (FAULT-immune, live re-evaluation, single choke point), thread-safety, and no-automation guarding are all correct. Its should-fixes are addressed in
fix(runtime): …: documented the requirement where users hit it (F1), corrected CHANGELOG claims (F2/F3), and strengthened the tests (F4–F6).Follow-ups (noted, not in this PR)
tomatchesFAULT(vs any hook) — the D6 interim checks presence.