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)
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.
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.
- 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
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:RawGatewayEnvelope,packages/runtime/src/shim.ts:17) andtypenames are enumerable viaKNOWN_TRIGGER_CATALOG(@relayfile/adapter-core/triggers) — but theresourcepayload shape is undocumented and undiscoverable. It's decided by adapter normalization + cloud'sbuildEnvelope, which even falls back toresource: payload.resource ?? payload.A simulation whose input has to be guessed only approximately predicts prod behavior.
Proposed work (this repo)
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 formatinvokeconsumes (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.agentworkforce invoke --scaffold <type>(cold start, before any real fire exists) — emit a fixture skeleton: theRawGatewayEnvelopeframe filled in (id/workspace/type/occurredAt;name/cronforcron.tick),resourceleft as an explicit TODO hole for provider events. Validate<type>againstKNOWN_TRIGGER_CATALOGwith the same warn-don't-block stance aslintTriggers.buildEnvelopealready emits fields not present in ourRawGatewayEnvelope(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'sbuildEnvelope) so drift fails CI instead of silently widening.Explicitly out of scope (considered, deferred)
Refs #186, #187, #188, AgentWorkforce/cloud#1841, AgentWorkforce/cloud#1783, AgentWorkforce/cloud#1788