Skip to content

Normalize /execute request bodies before verb dispatch#50

Merged
GsCommand merged 1 commit intomainfrom
codex/fix-/execute-request-normalization
Mar 21, 2026
Merged

Normalize /execute request bodies before verb dispatch#50
GsCommand merged 1 commit intomainfrom
codex/fix-/execute-request-normalization

Conversation

@GsCommand
Copy link
Contributor

Motivation

  • Handlers expect a flat request body shape, but /execute was forwarding a nested execution envelope which caused validation and handler mismatches.
  • The goal is for /execute to behave identically to legacy per-verb routes so receipts validate and are signed correctly.

Description

  • Normalize /execute request bodies by flattening nested execution into req.body and always setting verb before dispatching to handleVerb by updating the /execute route to merge body and execution into req.body and set verb.
  • Make handleVerb derive the execution envelope from either req.body.execution or the top-level req.body by calling normalizeExecutionEnvelope(req.body?.execution ?? req.body, verb) in both success and error paths.
  • Add a regression test POST /execute normalizes nested execution into the handler body and preserves execution metadata to runtime/tests/runtime-signing.test.mjs that verifies nested execution payloads are flattened and that version/class metadata is preserved in receipts.
  • No protocol contract fields were invented and legacy per-verb routes remain unchanged.

Testing

  • Ran the focused test file with node --test runtime/tests/runtime-signing.test.mjs which passed all tests in that suite (including the new regression test).
  • Ran static sanity with npm run check (node --check server.mjs) which completed without errors.

Codex Task

Why: /execute was forwarding nested execution envelopes to handlers that expect the legacy flat request shape.
Contract impact: none
@GsCommand GsCommand merged commit 876010e into main Mar 21, 2026
1 check passed
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