[P0] ZARA-003 — Stop Prolog command execution from reporting false success #4

Closed
opened 2026-07-18 19:18:15 +00:00 by lost-rob0t · 0 comments
lost-rob0t commented 2026-07-18 19:18:15 +00:00 (Migrated from github.com)

Problem

modules/commands.pl has a catch-all execute(Intent, Args) clause that always succeeds. Unknown or unimplemented intents therefore appear executed and prevent fallback/recovery.

run_system_command/1 catches launch errors, prints a message, then succeeds because of its cut. zara/prolog_engine.py::start_timer() and reload_config() similarly return success without checking query_once().

This creates fake confirmations for commands that did nothing.

Required fix

  • Remove or replace the success catch-all with an explicit unsupported-intent failure/result.
  • Make command handlers return failure when the side effect could not be launched.
  • Preserve explicit handlers only; enumerate currently supported intents.
  • Propagate structured success/failure through PrologEngine and the wake fallback path.
  • Do not add new commands in this issue.

Required tests

  • Prolog tests for known success, unknown intent, missing executable, malformed arguments, and handler exception.
  • Python tests proving failed Prolog execution falls back instead of returning Executed:.
  • Add scripts/test-command-routing.sh that runs SWI-Prolog non-interactively against deterministic no-side-effect predicates.

Acceptance

  • Unknown/unimplemented intents fail closed.
  • Missing commands do not emit success replies.
  • Fallback is invoked exactly once after a real failure.
  • All tests and the command-routing script pass under nix develop.

Branch

fix/zara-003-fail-closed-commands

Dependencies

ZARA-001, ZARA-002.

## Problem `modules/commands.pl` has a catch-all `execute(Intent, Args)` clause that always succeeds. Unknown or unimplemented intents therefore appear executed and prevent fallback/recovery. `run_system_command/1` catches launch errors, prints a message, then succeeds because of its cut. `zara/prolog_engine.py::start_timer()` and `reload_config()` similarly return success without checking `query_once()`. This creates fake confirmations for commands that did nothing. ## Required fix - Remove or replace the success catch-all with an explicit unsupported-intent failure/result. - Make command handlers return failure when the side effect could not be launched. - Preserve explicit handlers only; enumerate currently supported intents. - Propagate structured success/failure through `PrologEngine` and the wake fallback path. - Do not add new commands in this issue. ## Required tests - Prolog tests for known success, unknown intent, missing executable, malformed arguments, and handler exception. - Python tests proving failed Prolog execution falls back instead of returning `Executed:`. - Add `scripts/test-command-routing.sh` that runs SWI-Prolog non-interactively against deterministic no-side-effect predicates. ## Acceptance - Unknown/unimplemented intents fail closed. - Missing commands do not emit success replies. - Fallback is invoked exactly once after a real failure. - All tests and the command-routing script pass under `nix develop`. ## Branch `fix/zara-003-fail-closed-commands` ## Dependencies ZARA-001, ZARA-002.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/zara#4
No description provided.