Skip to content

Introduce the core entry seam; the execution loop becomes its only caller #819

Description

@tobyhede

Parent

#799. Design record: .scratch/render-execution-unit/spec.md — read it before starting; it records why this shape was chosen over two alternatives.

What to build

A single core-owned seam that enters an execution unit: it renders the unit's description, prompt, and command against the loop frame, observes the entry, and classifies what the caller must do next. The execution loop becomes its only caller.

The result is a discriminated union with three arms — nothing to run, a command to run, or a child runbook to compose inline. That replaces the loop's current reliance on an undefined rendered-command field as its control-flow signal.

Rendering moves off the CLI entirely: the loop stops merging effective variables, building the step frame, choosing which expander applies to which field, and assembling the metadata. It sends state and steps, and reads back a classified entry.

No new dependency injection is required. The actor service already accepts a helper registry and already holds a canonicalised working directory.

Behaviour is unchanged in this ticket — collect still builds its own entry, and the divergence pinned in the characterisation ticket is still green.

Acceptance criteria

  • The loop enters through the new seam and no longer renders anything itself.
  • The rendered command reaches command execution only through the returned value; there is no path from the result back to unexpanded text.
  • The awaiting / runnable / inline-launch decision is exhaustive, with no undefined-as-signal remaining in the loop.
  • hasCommand is derived from the parsed unit rather than from whether a rendered command happens to be present.
  • All characterisation assertions from the first ticket remain green.
  • pnpm run verify green; pnpm run test:mutate:changed reports no survivors in the changed ranges.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2: mediumFeature / architectural cleanupenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions