Skip to content

[P0][Integration] Make RuntimeBridge the production effect executor for Runtime-backed Loop runs #695

Description

@wesleysimplicio

Objective

Promote RuntimeBridge from an isolated/tested transport into the production effect path of the Simplicio Loop runner whenever the Runtime-backed profile is selected.

Today the main runner invokes Mapper and Dev CLI operators directly, while RuntimeBridge is exercised primarily by transport tests. This leaves two parallel effect paths and prevents Runtime from being the authoritative executor/evidence boundary for Runtime-backed runs.

Non-negotiable architecture

  • Loop remains usable standalone without Runtime.
  • When Runtime-backed execution is selected, every mutating/process effect must go through Runtime MCP or an explicitly supported native binding.
  • Mapper may remain a read-only context producer.
  • Dev CLI may compile plans/verification proposals, but writes/process effects in integrated mode are applied by Runtime.
  • No silent direct-subprocess or direct-file fallback after Runtime selection.
  • Any compatible coordinator can drive Loop; Simplicio Agent is optional.

Implementation steps

  1. Add an explicit execution profile: standalone and runtime-backed.
  2. Resolve profile from CLI/config/contract, never from accidental binary presence alone.
  3. Instantiate one lazy RuntimeBridge per Loop Hub/session and workspace registry.
  4. Add a production runner effect adapter with map/read/edit/exec/validate/checkpoint/evidence methods.
  5. Translate Loop work-item identity, attempt, lease, fencing token, deadline, cancellation and write set into EffectTransaction/v1.
  6. Route Dev CLI planned mutation through the Runtime adapter instead of applying it directly.
  7. Route tests/build/process execution through simplicio_exec with bounded env, cwd, output and timeout.
  8. Persist Runtime receipt references in operator, watcher, delivery and loop-execution receipts.
  9. Prevent direct filesystem/subprocess mutation from runtime-backed runner stages with a policy guard and tests.
  10. Handle Runtime unavailable, incompatible, disconnected and uncertain-effect states explicitly.
  11. Keep standalone path behavior and contracts intact.
  12. Expose active profile, executor identity, Runtime generation and fallback status in CLI/status/progress.
  13. Add migration notes and minimum Runtime version.
  14. Make the installed-package E2E release-blocking.

State and recovery

  • Before effect: safe retry with the same idempotency key.
  • During/after uncertain effect: reconcile; never blindly replay.
  • Runtime disconnect: pause the affected lane, preserve unrelated lanes.
  • Capability drift: stop before mutation and provide exact repair.
  • Cancellation: honor only at Runtime safe boundaries.
  • Shutdown: drain, close and verify zero owned processes.

Tests

  • Standalone run without Runtime.
  • Runtime-backed mechanical task with all effects through MCP.
  • Semantic task coordinated by two different hosts.
  • Direct mutation bypass attempt is rejected.
  • Runtime missing before effect.
  • Runtime crash before, during and after effect.
  • Duplicate idempotency key and reconnect.
  • Mapper stale context and Dev CLI rejected plan.
  • Watcher validation through Runtime.
  • Multi-item drain with mixed success/failure.
  • Installed minimum/latest versions.

Acceptance criteria

  • Runtime-backed runner has one authoritative effect adapter.
  • Process trace proves no direct mutation/process bypass.
  • Every effect has transaction, gate, lease/fence, validation and receipt correlation.
  • Standalone Loop remains functional and separately tested.
  • Runtime selection never silently downgrades.
  • Uncertain effects reconcile without duplication.
  • Status and final receipt name the real executor and profile.
  • Runtime contract verification reaches VERIFIED only with complete evidence.
  • Unit, integration, failure-injection, regression and installed E2E tests pass locally/containerized.
  • p50/p95 latency, process count, tokens and RSS are measured; unavailable values are null with reason.

Relations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions