Skip to content

Fixture discoverability for invoke: runs export, --scaffold, and an envelope contract test vs cloud #189

Description

@khaliqgant

Problem

#186 (P1 #187, P2 #188) shipped agentworkforce invoke --fixture <file>, but a user authoring a fixture has no way to learn the envelope shape cloud will actually deliver:

  • The frame is typed (RawGatewayEnvelope, packages/runtime/src/shim.ts:17) and type names are enumerable via KNOWN_TRIGGER_CATALOG (@relayfile/adapter-core/triggers) — but the resource payload shape is undocumented and undiscoverable. It's decided by adapter normalization + cloud's buildEnvelope, which even falls back to resource: payload.resource ?? payload.
  • Cloud does not persist the delivered envelope, so there's nothing to copy from. Companion issue: AgentWorkforce/cloud#1841 (persist envelope per run + expose on the runs API).

A simulation whose input has to be guessed only approximately predicts prod behavior.

Proposed work (this repo)

  1. agentworkforce runs export <runId> --fixture event.json — once cloud#1841 lands, pull the captured envelope for a real run and write it in the fixture format invoke consumes (single envelope JSON). This is the primary path: every real fire becomes a replayable fixture, and normalization can never drift from the fixture because the fixture is cloud's normalized output.
  2. agentworkforce invoke --scaffold <type> (cold start, before any real fire exists) — emit a fixture skeleton: the RawGatewayEnvelope frame filled in (id/workspace/type/occurredAt; name/cron for cron.tick), resource left as an explicit TODO hole for provider events. Validate <type> against KNOWN_TRIGGER_CATALOG with the same warn-don't-block stance as lintTriggers.
  3. Cross-repo envelope contract test — cloud's buildEnvelope already emits fields not present in our RawGatewayEnvelope (provider, eventType, deliveryId, paths, resumeContext). Pin the two with a contract test (e.g. a shared JSON-schema fixture both repos assert against, or a checked-in sample envelope set regenerated from cloud's buildEnvelope) so drift fails CI instead of silently widening.

Explicitly out of scope (considered, deferred)

  • Hand-maintained per-event payload schemas in the trigger catalog: drift machine unless generated from adapter normalization code. Revisit only as codegen.
  • Bundled per-adapter sample fixtures: superseded by runs-export once cloud#1841 ships; samples go stale silently.

Refs #186, #187, #188, AgentWorkforce/cloud#1841, AgentWorkforce/cloud#1783, AgentWorkforce/cloud#1788

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions