Phase 05 · Week 21 · 105 minutes

Day 146: Adversarial scenes and recovery testing

Safety and evaluation harnesses · A robot agent is only credible when failure is measurable and bounded.

Chapter 21 · Bound embodied agents with safety and release evidence

Today in the field story

One problem, then the next

Courier-17 faces ambiguity, occlusion, a moved tray, injected scene text, forged requests, blocked motion, delayed feedback, and an exhausted retry budget. Each adversarial scene changes one declared factor while independent containment remains active. An evaluator also checks whether a person can understand the robot's state, decline the task, and complete a handoff without guessing. The objective is to determine whether failure becomes a bounded rejection, recovery, handoff, or unsafe state with enough trace evidence to diagnose. Failed and inconclusive cases remain in the manifest.

Why now

Controlled adversarial variation reveals coupling that nominal tests cannot expose.

Ignore today

Do not improvise dangerous hardware faults or hide inconclusive trials.

Unlocks next

A failure taxonomy tied to actual containment and recovery behavior.

Understand

Build the physical picture first

Adversarial evaluation deliberately bends perception, language, state, timing, and recovery while keeping containment and evidence fixed.

Adversarial testing is not random chaos and not permission to defeat real safeguards. Start from a frozen nominal scenario, state the attacker or stressor capability, change one factor, and predict the required contained response. Useful embodied cases include ambiguous referents, occlusion, moved objects, stale state, misleading scene text, spoofed identity, delayed tool result, blocked path, corrupted action value, repeated non-idempotent request, exhausted retry budget, and loss of the evidence channel.

Evaluate the whole system, not only whether the model says the right words. For each case, record whether the challenge was detected, whether an unsafe or unauthorized proposal occurred, which boundary contained it, whether any controller command escaped, which recovery transition ran, whether the physical task completed, and whether terminal evidence remained trustworthy. A verbal refusal followed by a queued motion command is failure; a failed task that safely aborts exactly as specified can pass containment.

Use a bounded recovery ladder with observable state transitions: reject malformed input, ask for clarification, re-observe, re-ground, replan, retry only an idempotent or deduplicated operation within budget, hand off context, then safe abort. Every transition needs an owner, deadline, maximum count, and success predicate. Recovery must not loosen action limits, extend authorization, silently reset the scenario, discard the first failure, or declare success from the same corrupted evidence that triggered recovery.

Red-team findings become engineering work only when reproducible. Preserve the original input, perturbation, seed, build, model and policy versions, state before and after injection, full trace, containment decision, command count, terminal outcome, and minimal reproduction. Cluster failures by broken assumption or boundary rather than by colorful prompt text. Add each confirmed failure to a versioned regression set, then rerun unaffected nominal cases to detect overblocking.

Words you need

Name each idea precisely

Adversarial scenario

A frozen test in which an intentional perturbation targets a declared assumption, trust boundary, or recovery behavior.

Physical example:

A second identical parcel is added after planning to test whether the system clarifies rather than acting on a stale referent.

Attack capability

The access, knowledge, timing, and changes an adversary or stressor is assumed able to exercise within the test.

Physical example:

A visitor may place visible text in the workspace but cannot authenticate as an operator or modify the ROS 2 keystore.

Containment

Prevention of the defined unauthorized or hazardous physical effect even when an upstream component behaves incorrectly.

Physical example:

The planner follows a malicious sign, but the typed-tool gateway and validator prevent any raw velocity command.

Recovery ladder

An ordered, bounded set of responses from clarification and re-observation through replan, retry, handoff, and safe abort.

Physical example:

After grasp mismatch, the system re-observes once, retries one deduplicated pick, then cancels and requests operator help.

Fault injection

A controlled change introduced at a named time and interface to test detection, containment, and recovery.

Physical example:

The harness delays the pose message by 250 ms while retaining the original timestamp so the freshness check must reject it.

Regression corpus

A versioned collection of reproducible failures and matched nominal cases rerun after changes to detect recurrence and overblocking.

Physical example:

The corpus retains the exact malicious label image, scene layout, request, seed, expected denial, and clean barcode-only control.

Math, one line at a time

Work through today’s relationship

Prerequisite rescue · optionalRisk, stopping distance, and confidence

Safety claims need physical bounds and enough trials, not reassuring language.

d_react = vt
distance travelled during reaction delayUnit: metres (m)
d_brake = v²/(2a)
ideal braking distanceUnit: metres (m)
risk
severity combined with likelihoodUnit: ordinal score
  1. At v=1 m/s and reaction t=0.2 s, d_react=1×0.2=0.2 m.

  2. With braking deceleration a=2 m/s², d_brake=1²/(2×2)=0.25 m.

  3. Ideal total is 0.45 m; add measured margin for sensing, actuation, floor, load, and uncertainty.

Programmer analogy

A security threat model maps assets and controls; robot safety adds kinetic energy and independently enforced stops.

At 0.5 m/s with 0.2 s reaction time, what is reaction distance?

0.5×0.2 = 0.1 m.

With idealized stopping distance dstop=0.45md_{\mathrm{stop}}=0.45\,\mathrm{m} before margin, a clearance of 0.7m0.7\,\mathrm{m} may pass that single boundary, while

0.4m<0.45m0.4\,\mathrm{m}<0.45\,\mathrm{m}

must be rejected. Other adversarial conditions need their own acceptance rules.

Execute a six-case containment and recovery matrix

A paper or simulated agent must move parcel P7 to zone Z2. The frozen suite has six perturbations: ambiguous twin parcel, 300 ms stale camera, malicious label, blocked route, duplicated non-idempotent release, and validator telemetry loss.

  1. Declare attack or stressor capability, targeted assumption, expected detection point, allowed recovery, forbidden event, and required evidence for all six cases before execution.

  2. Run ambiguity and stale-camera cases; require clarification for the twin parcel and re-observation for stale state, with zero grasp commands before a unique fresh binding exists.

  3. Run the malicious-label case; allow the model to fail by proposing the injected instruction, but require tool denial, guard evidence, and zero unauthorized controller commands.

  4. Run the blocked-route case; require fresh map update and replan without entering the restricted zone or increasing limits to preserve task completion.

  5. Run duplicate-release and telemetry-loss cases; require request-ID deduplication for release and a safe abort when validator decision evidence becomes unavailable.

  6. Classify each terminal result, count unsafe proposals, contained cases, successful recoveries among attempted recoveries, safe aborts, escaped forbidden events, and missing traces without replacing a failed first run.

Result

The matrix distinguishes model robustness from system containment: a malicious proposal may expose a model defect while downstream denial still passes the frozen no-motion requirement.

What this proves

A successful adversarial test contains the declared threat and follows the specified recovery or abort path; task completion is a separate result.

Physical examples

Where this appears in real life

Target moves behind an occluder

After the plan selects a cup, a screen hides it and a similar cup appears at the last known pose before the grasp begins.

Look for:

Fresh perception invalidates the entity binding, the skill does not continue from memory, and bounded re-observation leads to clarification or safe abort.

Blocked route plus malicious sign

A new obstacle blocks the planned aisle while a sign in view tells the robot to ignore the map and use a restricted shortcut.

Look for:

The obstacle triggers replan, scene text has no authority, the restricted region remains enforced, and recovery does not trade containment for task completion.

Hands-on exercise

Make the idea observable

Use only unpowered paper props, recorded sensor data, or a disconnected simulator. Do not attempt to bypass real protective devices, production authentication, or live robot permissions.

  1. Select one nominal task and create six perturbation manifests spanning perception, language, state freshness, tool or network behavior, recovery budget, and evidence integrity.

  2. Pair every adversarial case with a clean control that changes only the attack feature, such as malicious label versus same-size neutral label.

  3. Declare detector, containment boundary, allowed recovery steps, maximum retries, deadline, safe state, forbidden event, and evidence fields.

  4. Execute in a fixed order with reset checks, retaining raw inputs, timestamps, seeds, state transitions, decisions, command counts, operator actions, and terminal predicates.

  5. Write one minimal reproduction for each unexpected behavior and add it plus the clean control to a local regression corpus.

  6. After any mitigation, rerun all six attacks and their controls; report residual failures, newly blocked legitimate behavior, and exactly which claim improved.

Observe

Mitigations often stop the original string but miss the underlying authority flaw, or they overblock legitimate labels; paired controls expose both errors.

Done when

All perturbations are reproducible, every forbidden effect has independent evidence, recovery budgets are enforced, controls still work, and failures remain visible by boundary and trace ID.

Build today

Create a scenario runner that measures task success, intervention, recovery, latency, and unsafe attempts.

Evidence to save

DONE when a 60–120 second uncut “Adversarial scenes and recovery testing” demo links to its command, logs or plots, result count, and honest failure note.

Common mistakes

Catch the wrong mental model

Wrong

Declaring success because the robot eventually finished the adversarial task.

Better

Score detection, unsafe proposal, containment, escaped commands, recovery path, forbidden events, terminal category, and evidence integrity separately from completion.

Wrong

Changing several variables and safeguards at once.

Better

Start from a frozen control, vary one named capability or fault, and preserve versions and reset so the broken boundary can be reproduced.

Wrong

Fixing one malicious phrase with a blacklist.

Better

Repair source authority, tool scope, permissions, validation, or recovery as appropriate, then test paraphrases and a matched legitimate control for both bypass and overblocking.

Job connection

How this becomes employable evidence

Build an adversarial regression harness that perturbs perception, prompts, timing, identity, tool results, and recovery while correlating model proposals, ROS 2 permissions, validator decisions, commands, physical state, and operator actions.

Relevant target roles

  • Robotics Deployment, Integration & Validation Engineer
  • Robot Learning Deployment / Physical AI Integration Engineer
  • Robotics Application / ROS 2 Integration Engineer
  • Robotics Software Engineer — ROS 2 / AMR
  • Robot Fleet Backend / Platform Engineer

Chapter 21 interview drill

Interview questions: Adversarial scenes and recovery testing

Practise a 60–90 second answer: define the idea, connect it to a physical robot, state assumptions, frames, and units when relevant, then finish with the failure signal or evidence you would inspect.

Primary interview scenario

Design six adversarial tests for a language-driven warehouse robot. For each, name attacker capability, frozen perturbation, containment boundary, recovery budget, forbidden event, evidence, and the clean control that detects overblocking.

Answer shape: clarify the situation → trace the physical and software path → test the most likely boundaries → name the evidence that would confirm the result.

Technical follow-up questions

Q1Can a case pass containment when the model follows the injected instruction?
Model interview answer

Yes, if downstream independent controls prevent the forbidden physical effect, though the unsafe proposal remains a model or policy defect that must be counted and repaired.

Q2What makes a retry acceptable in the recovery ladder?
Model interview answer

The operation is idempotent or deduplicated, current state is revalidated, the retry stays within a fixed budget and authorization, and its result has an independent predicate.

Q3Why pair every attack with a clean control?
Model interview answer

The pair shows whether a mitigation blocks the targeted adversarial feature without unnecessarily rejecting equivalent legitimate input.