Skip to content

feat: add lambda-runtime-invocation-id header - #1159

Open
darklight3it wants to merge 2 commits into
mainfrom
feat/add-runtime-invocation-id-header-support
Open

feat: add lambda-runtime-invocation-id header#1159
darklight3it wants to merge 2 commits into
mainfrom
feat/add-runtime-invocation-id-header-support

Conversation

@darklight3it

@darklight3it darklight3it commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Add Lambda-Runtime-Invocation-Id header support for cross-wiring protection.

The RIC now echoes the invocation ID received from RAPID on /next back on /response and /error, enabling RAPID to detect and reject stale responses from timed-out invocations.

Problem

On Lambda Managed Instances (LMI) and On-Demand (OD), when an invoke times out, the runtime process continues running in the background. If a new invoke arrives with the same requestId, RAPID accepts it. The still-running old invocation eventually posts its response, and RAPID matches it to the new invoke — delivering the wrong response (cross-wiring).

Solution

RAPID sends a unique per-invoke nonce via Lambda-Runtime-Invocation-Id header on /next. The runtime echoes it back on /response and /error. RAPID validates the match before accepting the response.

Backward Compatibility

Fully backward compatible in both directions:

  • If RAPID doesn't send the header → RIC doesn't see it → doesn't echo → no behavior change
  • If RIC doesn't echo it (old version) → RAPID skips validation → no behavior change

Testing

  • added unit test
  • added a new dockerized test working with the new RIE.

@darklight3it
darklight3it force-pushed the feat/add-runtime-invocation-id-header-support branch from b60f865 to 048c1e8 Compare August 9, 2026 18:16
@darklight3it
darklight3it force-pushed the feat/add-runtime-invocation-id-header-support branch from 4c28d43 to afb6708 Compare August 26, 2026 16:15
@darklight3it
darklight3it marked this pull request as ready for review August 26, 2026 16:18
@darklight3it
darklight3it force-pushed the feat/add-runtime-invocation-id-header-support branch from afb6708 to de1f2e4 Compare August 26, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant