Skip to content

[P2] Derive agent proposal schemas from verified stable-ID record and variant types #64

Description

@wsdt

Audit: 2026-09-05, commit 2b3b1ee24da2.
Classification: Documented agent-language integration gap; next bounded architectural slice. Priority: P2.

Finding

AgentDefinition v1 already provides stable identities, deterministic AgentGraph output, and a byte-preserved Runtime v1 projection. It does not derive the provider's proposal grammar from the program's checked types.

The owning specification explicitly identifies this as the next bounded gate: docs/LANGUAGE-NATIVE-AGENT-OBJECT-V1.md. src/agent_definition.rs currently holds type-role identifiers and structured Runtime v1 material, while src/agent_runtime.rs admits separately authored tool/action schemas.

Proposed implementation boundary

Add a versioned compiler product resolving the Proposal role to actual verified stable-ID record/variant declarations. Derive a closed proposal schema and a typed decoder from the same retained HIR, including exact scalar representations, required fields/cases, numeric bounds, source/type revision, and unsupported-profile facts.

Start with a closed monomorphic scalar-record/variant subset. Reject recursive, borrowed, resource-bearing, or otherwise unadmitted values with explicit diagnostics. Do not expose a loosely typed “JSON object” escape hatch.

The model/provider can be asked to generate this grammar, but decoder validation remains mandatory. A proposal is data and must not construct Authorized<T> or a publication token.

Acceptance criteria

  • Source, HIR, proposal grammar, typed decoder, and AgentGraph all refer to the same stable type identities and revision.
  • A display rename preserves semantic identity while an actual type change invalidates stale proposals/schemas.
  • Wrong case/field, extra field, missing field, unknown schema version, malformed exact integer, and cross-agent proposal are rejected before effects.
  • Generated Python/TypeScript/Rust consumers preserve integers beyond JavaScript's safe-integer range.
  • An offline scripted provider exercise uses the generated grammar and independently replays the resulting evidence.
  • AgentDefinition/Profile v1 known answers remain byte-frozen; use additive versioning.
  • Add the gate to the existing agent-runtime/image harnesses and update only the affected completion claims.

Dependencies: checked record/variant metadata already exists; broad collections and live provider integration are not required for this first slice.

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-17

Suggested scope: L. Dependencies: None required.

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