Skip to content

[P2] Bind deterministic agent stages to verified source functions and execute one typed lifecycle #72

Description

@wsdt

Audit: 2026-09-05, commit 2b3b1ee24da2.
Classification: Documented core-agent integration gap; proposed bounded language feature. Priority: P2.

Finding

AgentDefinition currently records identities for initialize, observe, authorize, and reduce, but does not execute those declarations as Semaprax functions. The owning specification says so explicitly: docs/LANGUAGE-NATIVE-AGENT-OBJECT-V1.md and docs/LANGUAGE-NATIVE-AGENT-OBJECT-V1.md. src/agent_harness.rs composes existing runtime/payment kernels and likewise disclaims language-level transition execution.

The result is a useful graph/profile bridge, but the semantic program and harness still do not derive operational behavior from one checked source object.

First implementation boundary

After proposal grammar and deployment binding are defined, compile a single acyclic lifecycle whose deterministic stage IDs resolve to actual verified .spx functions. Start with scalar/closed-record task, state, observation, proposal, outcome, and result types. Validate the stage signatures, ownership modes, effects, and graph edges from the same HIR used for ordinary execution.

Execute the deterministic stages with a retained interpreter product and a scripted model proposal. Limit execute initially to one explicitly injected read operation or an effect-free fixture. The authorizing transition must produce an opaque, one-use authorization value bound to the exact proposal/state/policy, not a boolean or hash that any caller can manufacture.

Acceptance criteria

  • Changing a stage's source changes the compiled agent semantics and invalidates old graph/run bindings.
  • Unresolved IDs, incompatible signatures, incorrect ownership, undeclared effects, stale proposals, and substituted states reject before host work.
  • Only the validated authorize stage can construct the one-use authorization value; reduce/observe/model output cannot.
  • Success, rejection, model failure, effect failure, cancellation, and budget exhaustion have deterministic state/cleanup/evidence behavior.
  • One offline end-to-end example proves task → initialize → observe → propose → authorize → execute → reduce → result.
  • Runtime v1 compatibility bytes and APIs remain frozen.
  • Source remains the Git/review authority; descriptive AgentGraph JSON carries no ambient execution or publication capability.

Keep syntax minimal and versioned; a binding document referencing existing declarations can precede a new agent syntax. Durable resume is dependent work, not an implicit property of this lifecycle.

Agent handoff

Recheck the working revision and existing issues first. Read AGENTS.md, the relevant completion-matrix row, and the owning versioned specifications. This proposed slice must preserve canonical source, independent replay, precise target admission, and separately granted authority. Place regressions in the existing owning harness. Execute the applicable quality gates and record what actually ran; unrun native, hosted, or device evidence must stay unpromoted.

Audit revision scope

Runtime observations in this ticket belong to commit 2b3b1ee. A final source-tree comparison against e1c5b56 was used to check for obvious superseding changes. That later snapshot was not rebuilt or exhaustively retested. Reproduce on the intended fixing revision before implementation.

Audit ID: SPX-AUDIT-20260905-21

Suggested scope: L. Dependencies: SPX-AUDIT-20260905-17, SPX-AUDIT-20260905-18.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions