AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

`HumanInTheLoopMiddleware` Silently Drops Configured `Args_schema` From Interrupt Payload

When `HumanInTheLoopMiddleware` is configured with an `InterruptOnConfig` that includes an explicit `args_schema`, the generated `ReviewConfig` in the interrupt payload omits that schema. This is a silent configuration failure: the schema is accepted but not propagated, preventing schema-driven client-side handling.

mediumConfidence 95%LangchainAffected V1.3.18

Origin Analysis

In `HumanInTheLoopMiddleware._create_action_and_config()`, the `ReviewConfig` object is constructed using only `action_name` and `allowed_decisions`, ignoring the optional `args_schema` field from the corresponding `InterruptOnConfig`. No code path reads or forwards `InterruptOnConfig.args_schema` into `ReviewConfig`.
Run the provided reproduction script with `langchain==1.3.18`. Assert that the captured `review_config` from the mocked interrupt includes `args_schema`; it fails because the field is missing.

Fixing Code Block

def _create_action_and_config( self, action_name: str, config: InterruptOnConfig ) -> tuple[Action, ReviewConfig]: """Create an action and its review config from an InterruptOnConfig.""" # Preserve explicitly supplied args_schema when present. args_schema = config.get("args_schema") review_config = ReviewConfig( action_name=action_name, allowed_decisions=config["allowed_decisions"], args_schema=args_schema, ) # Existing action construction from config remains unchanged. action = Action( name=action_name, description=config.get("description"), when=config.get("when"), ) return action, review_config
The hotfix adds the missing `args_schema` argument when instantiating `ReviewConfig`, sourced directly from the already validated `InterruptOnConfig`. This preserves explicit user-provided schemas while leaving behavior unchanged when the field is omitted (`None`).

Edge Case Audit

The change only adds a field to `ReviewConfig`; if downstream consumers expect a strictly minimal payload, they may see a new key, but this is the intended contract. No destructive changes are introduced. Rollback is a simple revert of this single-line addition. Concurrency and threading are unaffected because the construction is purely local. Future versions that add schema inference should ensure explicit user schemas always take precedence.

Ecosystem Topology