Skip to content

Gateway gates run_python plans on the 'code' slot users never supply #150

Description

@anth-volk

Bug

When the gateway pre-pass routes a message to run_python, the deterministic gate in backend/gateway/policy.py forces a spurious clarifying question on the code slot.

Chain of events:

  1. code is schema-required for run_python (backend/tools/definitions.py, "required": ["code"]), so _base_criticality classifies it as high criticality.
  2. ("run_python", "code") is absent from the INFERABLE set in backend/gateway/policy.py.
  3. The gateway prompt (backend/prompts/gateway.py) tells the classifier to tag a slot assumed when it is guessing — which is always true for code, because users never supply Python source themselves; the model authors it.
  4. slot_gates() therefore fires (assumed + high criticality + not inferable), and gate() returns needs_plan, asking the user to clarify "code" — a slot they cannot meaningfully answer.

An honestly grounded plan routing to run_python can effectively never reach ready.

Fix

Add ("run_python", "code") to INFERABLE in backend/gateway/policy.py, mirroring the existing generate_chart entries whose rationale applies exactly (e.g. ("generate_chart", "data") # comes from an upstream tool, not the user): the model authors the code itself; the user never supplies it. With that entry, an assumed code slot no longer gates and a run_python plan yields ready.

Includes a unit test in backend/tests/test_gateway.py covering the run_python/code path through gate().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions