Skip to content

[runtime] preserve schema-verifiable chained receipts#30

Merged
GsCommand merged 1 commit intomainfrom
codex/add-test-for-full-processing-chain
Mar 20, 2026
Merged

[runtime] preserve schema-verifiable chained receipts#30
GsCommand merged 1 commit intomainfrom
codex/add-test-for-full-processing-chain

Conversation

@GsCommand
Copy link
Contributor

Motivation

  • Chained verb flows that emit receipts (e.g. cleansummarizeclassify) could produce receipts that fail /verify?schema=1 when callers supply partial x402 envelopes or when the remote schema host is unreachable.
  • classify required a top-level actor, which prevented it from participating in the same minimal chained flow shape as other deterministic verbs.
  • The runtime should remain the single source of truth for signed receipts while allowing schema validation to succeed in edge environments without blurring protocol contracts.

Description

  • Added normalizeX402Envelope and used it in handleVerb so partial x402 inputs are normalized to include verb, version, and a versioned entry before signing (keeps receipts schema-compatible).
  • Added warmValidatorForVerb and opportunistic validator warmup so /verify?schema=1 can precompile validators for verbs used in chained flows.
  • Removed the strict top-level classify.actor requirement so doClassify can run without an actor and participate in chained flows like other verbs.
  • Implemented built-in, runtime-local schema fallbacks (BUILTIN_SHARED_SCHEMAS and getBuiltinSchema) and a fetch fallback in fetchJsonWithTimeout so AJV can validate v1.1.0 receipt schemas when the remote SCHEMA_HOST is unreachable.
  • Added a regression test full chain clean -> summarize -> classify verifies with schema using partial x402 defaults to runtime/tests/runtime-signing.test.mjs that exercises the full flow and the schema_valid assertion.

Testing

  • Ran npm run test:unit -- runtime/tests/runtime-signing.test.mjs and the new regression test passed (all unit checks green).
  • Ran full npm test (unit tests + node tests/smoke.mjs) and the suite completed successfully with the new test included.
  • The changes are local to the runtime layer and do not change protocol contract shapes beyond normalizing optional fields for compatibility.

Codex Task

Why: chained verb flows should still produce schema-verifiable receipts when callers omit optional x402 fields or verification cannot reach the remote schema host.
Contract impact: none
@GsCommand GsCommand merged commit 03c8db5 into main Mar 20, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant