Stillness Before Motion: Fail-Closed SQLite Fault Latches for Tabletop Robotics
On this page (3 sections)
When an expressive tabletop robot arrives in the lab, the child in every engineer wants to make it wave its antennas, turn its head, and start talking within twenty minutes. That eagerness is fun in a hackathon demo, and completely backwards when you are engineering a system meant to operate safely in a home.
In reachy-companion, we practiced deliberate restraint: build the brakes, the privacy walls, and the human sign-off gates before connecting a single microphone, camera, or actuator.
Witnessing Hidden Side Effects in Upstream SDKs#
Reading carefully through upstream SDK behavior (107 primary sources and 37 troubleshooting runbooks cataloged in knowledge/) turned up the exact kind of detail you miss when you rush straight to live hardware: even constructing certain robot SDK clients with default flags (automatic_body_yaw=True) immediately engages background motion behavior and network sockets.
That observation set our foundational rule for the scaffold (ready_for_child_use: false): importing or running reachy-companion opens zero outbound network sockets and constructs zero hardware clients until explicit commissioning gates pass.
Three Bottlenecks in Designing Trustworthy Guardrails#
1. Crash-looping retries that forget what just failed#
In naive robot scripts, retry counters live in RAM. If a thermal, audio, or privacy invariant trips and the process restarts under systemd or launchd, the counter resets to zero and the robot tries the exact same unsafe action all over again.
How we fixed it: RecoveryController (src/reachy_companion/recovery.py) reserves every retry attempt atomically in local SQLite before action execution, enforces cooldown windows across process restarts, and permanently latches hardware, privacy, and identity faults until a human performs a verified reset.
2. Making unreviewed content fail closed by default#
All four German guided-play activity templates in content/activities.json ship with "parent_reviewed": false. Rather than trusting a developer flag to remember to check them later, non-simulation ActivitySession calls raise PermissionError immediately unless a parent or caregiver has explicitly reviewed and signed off each prompt.
3. Strictly local loopback envelopes#
Every adapter boundary (docs/adapters.md) validates endpoints against local loopback (127.0.0.1) and strict schema envelopes so a misconfigured config file can never accidentally point a child's play session at a remote cloud voice endpoint.
Step-by-Step: Running the Offline Simulation & Fault Suite#
Requires Python 3.11+ and uv:
Step 1: Clone and sync the locked environment#
git clone https://github.com/TinkeringDao/reachy-companion.git
cd reachy-companion
uv sync --lockedStep 2: Run the boundary doctor and simulated German story-turn demo#
uv run reachy-companion doctor
uv run reachy-companion demo --activity story_turnsStep 3: Verify the SQLite fault-latch and persistence tests#
uv run ruff check .
uv run pytestRestraint in robotics isn't hesitation. Knowing for sure how a system stops — and knowing that it stays stopped when something feels off — is what makes gentle motion possible later.