Skip to content

feat: reserved invocation_settings envelope field on generated /invoke - #72

Closed
CyMule wants to merge 1 commit into
mainfrom
feat/invocation-settings-envelope
Closed

feat: reserved invocation_settings envelope field on generated /invoke#72
CyMule wants to merge 1 commit into
mainfrom
feat/invocation-settings-envelope

Conversation

@CyMule

@CyMule CyMule commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What

Every wrap_in_fastapi-generated /invoke gains a reserved, optional invocation_settings envelope field:

  • Kept out of the function's /schema — settings can never collide with data inputs in the schema namespace.
  • Delivered as a kwarg when the wrapped function declares invocation_settings, or via the new get_invocation_settings() ContextVar accessor otherwise (context propagated across the executor thread; set on both paths so helpers deep in a plugin's call stack can always use the accessor).
  • GET /capabilities advertises support, so callers (the ETL controller) gate injection on capability instead of schema sniffing.
  • The kwarg-declaration check is hoisted to wrap time — requests pay a boolean, not inspect.signature.

Why

Today every plugin freezes its settings from a boot-time mounted file, which pins plugin processes to a single job configuration. That coupling is what forces per-job pod provisioning and per-DAG-template warm pools. A reserved envelope field makes one standing plugin process able to serve work items with differing node settings — the plugin-side prerequisite ("plugins take settings from /invoke — table stakes") for pooled/fleet execution, and immediately useful for per-invoke reconfiguration in the existing architecture.

Companion PRs completing the chain (each independently mergeable; this one first):

  • queue side: Unstructured-IO/platform-etl-orchestration — feat(etl-job-api): deliver invocation_settings with claimed work
  • controller wiring: Unstructured-IO/platform-plugins — feat(controller): forward claim-delivered invocation_settings to plugin /invoke

Testing

75 passed (5 new in test/test_invocation_settings.py): kwarg delivery, accessor delivery, executor-thread propagation, schema exclusion, capabilities endpoint.

Review in cubic

Every wrap_in_fastapi-generated /invoke now accepts an optional
invocation_settings object as a reserved envelope field. It is kept out
of the function's /schema (no namespace collision with data inputs) and
delivered either as a kwarg when the wrapped function declares an
invocation_settings parameter, or via the get_invocation_settings()
ContextVar accessor otherwise (context propagated across the executor
thread). The ContextVar is set even on the kwarg path so helper code
deep in a plugin's call stack can always use the accessor.

GET /capabilities advertises support so callers (e.g. the ETL
controller) can gate injection without schema sniffing. The signature
check for the kwarg path is hoisted to wrap time; requests pay a
boolean, not reflection.

This lets one standing plugin process serve work items with differing
node settings (warm pools, worker fleets, per-invoke reconfiguration)
instead of freezing settings from a boot-time file.

75 tests passed (5 new in test/test_invocation_settings.py).
@CyMule CyMule closed this Jul 19, 2026
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